This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/58542] [4.7/4.8/4.9 Regression] subreg splitting pass mishandles TImode immediates


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58542

--- Comment #5 from UroÅ Bizjak <ubizjak at gmail dot com> ---
The problem actually starts in expand_atomic_compare_and_swap, in:

(gdb) list
7339          create_convert_operand_to (&ops[3], expected, mode, true);
7340          create_convert_operand_to (&ops[4], desired, mode, true);
7341          create_integer_operand (&ops[5], is_weak);
7342          create_integer_operand (&ops[6], succ_model);
7343          create_integer_operand (&ops[7], fail_model);
7344          expand_insn (icode, 8, ops);

ops[4] is converted in unsigned mode, so from "desired" operand:

(gdb) p debug_rtx (desired)
(const_int -1 [0xffffffffffffffff])

we got:

(gdb) p ops[4]
$45 = {type = EXPAND_CONVERT_TO, unsigned_p = 1, unused = 0, mode = TImode,
value = 0x7fffeffc21e0}
(gdb) p debug_rtx (ops[4].value)
(const_double -1 [0xffffffffffffffff] 0 [0] 0 [0] 0 [0])

So, it is actually expansion of atomic_compare_and_swap, which doesn't account
for signedness of "desired" operand.

Manually changing the argument from "true" to "false" for ops[4] generates
correct code.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]