[Bug target/28924] x86 sync builtins fail for char and short memory operands
--- Comment #9 from pinskia at gcc dot gnu dot org 2006-11-06 20:31 --- *** Bug 29714 has been marked as a duplicate of this bug. *** -- pinskia at gcc dot gnu dot org changed: What|Removed |Added CC||phil dot sidler at ||attachmate dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924
[Bug target/28924] x86 sync builtins fail for char and short memory operands
--- Comment #8 from uros at kss-loka dot si 2006-10-07 06:12 --- Testcase was commited to trunk and 4.1 branch, and now passes everywhere. -- uros at kss-loka dot si changed: What|Removed |Added Status|ASSIGNED|RESOLVED Known to fail|4.1.0 4.2.0 |4.1.0 Known to work||4.2.0 4.1.2 Resolution||FIXED Target Milestone|--- |4.2.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924
[Bug target/28924] x86 sync builtins fail for char and short memory operands
-- pinskia at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|4.2.0 |4.1.2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924
[Bug target/28924] x86 sync builtins fail for char and short memory operands
--- Comment #4 from uros at kss-loka dot si 2006-10-06 08:27 --- Please note, that in addition to http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00250.html, http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00244.html is also needed. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924
[Bug target/28924] x86 sync builtins fail for char and short memory operands
--- Comment #5 from jakub at gcc dot gnu dot org 2006-10-06 16:54 --- Subject: Bug 28924 Author: jakub Date: Fri Oct 6 16:54:43 2006 New Revision: 117508 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=117508 Log: PR target/28924 * builtins.c (expand_builtin_sync_operation, expand_builtin_compare_and_swap, expand_builtin_lock_test_and_set): Use convert_to_mode to handle promoted arguments. * gcc.c-torture/compile/20061005-1.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/compile/20061005-1.c Modified: trunk/gcc/ChangeLog trunk/gcc/builtins.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924
[Bug target/28924] x86 sync builtins fail for char and short memory operands
--- Comment #6 from jakub at gcc dot gnu dot org 2006-10-06 17:07 --- Subject: Bug 28924 Author: jakub Date: Fri Oct 6 17:06:52 2006 New Revision: 117511 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=117511 Log: PR target/28924 * builtins.c (expand_builtin_sync_operation, expand_builtin_compare_and_swap, expand_builtin_lock_test_and_set): Use convert_to_mode to handle promoted arguments. * gcc.c-torture/compile/20061005-1.c: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/gcc.c-torture/compile/20061005-1.c Modified: branches/gcc-4_1-branch/gcc/ChangeLog branches/gcc-4_1-branch/gcc/builtins.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924
[Bug target/28924] x86 sync builtins fail for char and short memory operands
--- Comment #7 from jakub at gcc dot gnu dot org 2006-10-06 17:19 --- We still need the sync-2.c testcase, Uros, can you please commit it? Thanks. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924
[Bug target/28924] x86 sync builtins fail for char and short memory operands
-- jakub at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Last reconfirmed|2006-09-01 14:39:25 |2006-10-05 12:57:54 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924
[Bug target/28924] x86 sync builtins fail for char and short memory operands
--- Comment #3 from uros at kss-loka dot si 2006-09-08 05:47 --- I have been playing with following patch to optabs.c that forces operands in functions expand_sync_operation(), expand_sync_fetch_operation() and expand_sync_lock_test_and_set() into registers through subregs of word-mode temp registers. The testcase in the description is then expanded as: ;; __sync_fetch_and_add_1 (s, 255) [tail call] (insn 10 8 11 (set (reg:SI 58) (const_int 255 [0xff])) -1 (nil) (nil)) (insn 11 10 0 (parallel [ (set (mem/v:QI (symbol_ref:SI (s) var_decl 0x402410b0 s) [-1 S1 A8]) (unspec_volatile:QI [ (plus:QI (mem/v:QI (symbol_ref:SI (s) var_decl 0x402410b0 s) [-1 S1 A8]) (subreg:QI (reg:SI 58) 0)) ] 13)) (clobber (reg:CC 17 flags)) ]) -1 (nil) (nil)) and RTL optimizers are able to optimize this back into: (insn:HI 11 8 12 2 (parallel [ (set (mem/v:QI (symbol_ref:SI (s) var_decl 0x402410b0 s) [-1 S1 A8]) (unspec_volatile:QI [ (plus:QI (mem/v:QI (symbol_ref:SI (s) var_decl 0x402410b0 s) [-1 S1 A8]) (const_int -1 [0x])) ] 13)) (clobber (reg:CC 17 flags)) ]) 924 {sync_addqi} (insn_list:REG_DEP_TRUE 10 (nil)) (nil)) This results in expected asm code: tests: lock addb $-1, s ret However, the patch does not cover all backup code-paths in sync_* expanders, so in some cases an integer argument can still be forced into register in the wrong way. --cut here-- Index: optabs.c === --- optabs.c (revision 116739) +++ optabs.c (working copy) @@ -6023,7 +6023,7 @@ if (GET_MODE (val) != VOIDmode GET_MODE (val) != mode) val = convert_modes (mode, GET_MODE (val), val, 1); if (!insn_data[icode].operand[1].predicate (val, mode)) - val = force_reg (mode, val); + val = gen_lowpart (mode, copy_to_mode_reg (word_mode, val)); insn = GEN_FCN (icode) (mem, val); if (insn) @@ -6156,7 +6156,7 @@ if (GET_MODE (val) != VOIDmode GET_MODE (val) != mode) val = convert_modes (mode, GET_MODE (val), val, 1); if (!insn_data[icode].operand[2].predicate (val, mode)) - val = force_reg (mode, val); + val = gen_lowpart (mode, copy_to_mode_reg (word_mode, val)); insn = GEN_FCN (icode) (target, mem, val); if (insn) @@ -6243,7 +6243,7 @@ if (GET_MODE (val) != VOIDmode GET_MODE (val) != mode) val = convert_modes (mode, GET_MODE (val), val, 1); if (!insn_data[icode].operand[2].predicate (val, mode)) - val = force_reg (mode, val); + val = gen_lowpart (mode, copy_to_mode_reg (word_mode, val)); insn = GEN_FCN (icode) (target, mem, val); if (insn) --cut here-- -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924
[Bug target/28924] x86 sync builtins fail for char and short memory operands
--- Comment #2 from pinskia at gcc dot gnu dot org 2006-09-05 15:41 --- *** Bug 28955 has been marked as a duplicate of this bug. *** -- pinskia at gcc dot gnu dot org changed: What|Removed |Added CC||kawika at QEDmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924
[Bug target/28924] x86 sync builtins fail for char and short memory operands
--- Comment #1 from pinskia at gcc dot gnu dot org 2006-09-01 14:39 --- Confirmed, not a regression. -- pinskia at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC build triplet|i686-pc-linux-gnu | GCC host triplet|i686-pc-linux-gnu | Keywords||ice-on-valid-code Known to fail||4.1.0 4.2.0 Last reconfirmed|-00-00 00:00:00 |2006-09-01 14:39:25 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28924