Richard Henderson <[email protected]> wrote:
> These are the targets that used external __sync calls in gcc 4.6.
> I've been intending to test them myself, but since these aren't
> bare *-elf targets, it's taking me some time to get the various
> cross-environment set up.
>
> Port maintainers, please test.
SH patch looks to work fine, though I've got an ICE when
regtesting:
FAIL: gcc.c-torture/compile/20061005-1.c -O0 (internal compiler error)
In function 'testc2':
trunk/gcc/testsuite/gcc.c-torture/compile/20061005-1.c:22:3: internal compiler
error: in emit_move_insn, at expr.c:3438
#0 fancy_abort (file=0x89448fc "../../LOCAL/trunk/gcc/expr.c", line=3438,
function=0x894553b "emit_move_insn")
at ../../LOCAL/trunk/gcc/diagnostic.c:899
#1 0x082a7e92 in emit_move_insn (x=0xb7de633c, y=0xb7e71970)
at ../../LOCAL/trunk/gcc/expr.c:3437
#2 0x081b8000 in emit_library_call_value_1 (retval=1, orgfun=0xb7e2c770,
value=0xb7de633c, fn_type=LCT_NORMAL, outmode=QImode, nargs=3,
p=<value optimized out>) at ../../LOCAL/trunk/gcc/calls.c:4103
#3 0x081b8271 in emit_library_call_value (orgfun=0xb7e2c770,
value=0xb7de633c, fn_type=LCT_NORMAL, outmode=QImode, nargs=3)
at ../../LOCAL/trunk/gcc/calls.c:4184
#4 0x08444ea7 in expand_atomic_compare_and_swap (ptarget_bool=0x0,
ptarget_oval=0xbfffeba0, mem=0xb7e42654, expected=0xb7de6330,
desired=0xb7de6318, is_weak=0 '\000', succ_model=MEMMODEL_SEQ_CST,
fail_model=MEMMODEL_SEQ_CST) at ../../LOCAL/trunk/gcc/optabs.c:7513
#5 0x0818b26f in expand_builtin_compare_and_swap (mode=QImode,
exp=<value optimized out>, is_bool=0 '\000', target=0xb7de633c)
at ../../LOCAL/trunk/gcc/builtins.c:5199
(gdb) fr 1
#1 0x082a7e92 in emit_move_insn (x=0xb7de633c, y=0xb7e71970)
at ../../LOCAL/trunk/gcc/expr.c:3437
3437 gcc_assert (mode != BLKmode
(gdb) call debug_rtx(x)
(const_int 0 [0])
(gdb) fr 6
#6 0x0819d19b in expand_builtin (exp=0xb7e622ec, target=0xb7de633c,
subtarget=0x0, mode=<value optimized out>, ignore=1)
at ../../LOCAL/trunk/gcc/builtins.c:6529
6529 target = expand_builtin_compare_and_swap (mode, exp, false,
target);
It seems that expand_builtin sets "target" variable to
const0_trx when "ignore" argument is set and this causes
the above ICE. I'm trying a patch
--- ORIG/trunk/gcc/optabs.c 2011-11-11 08:00:04.000000000 +0900
+++ trunk/gcc/optabs.c 2011-11-12 12:34:18.000000000 +0900
@@ -7440,6 +7440,7 @@ expand_atomic_compare_and_swap (rtx *pta
just in case we need that path down below. */
if (ptarget_oval == NULL
|| (target_oval = *ptarget_oval) == NULL
+ || !register_operand (target_oval, mode)
|| reg_overlap_mentioned_p (expected, target_oval))
target_oval = gen_reg_rtx (mode);
though I'm not sure that this is the right thing to do.
Regards,
kaz