Commit 464046a6 by Richard Henderson

re PR rtl-optimization/58542 (Arguments of __atomic_* functions are converted in unsigned mode)

PR rtl/58542

* optabs.c (maybe_emit_atomic_exchange): Use create_input_operand
instead of create_convert_operand_to.
(maybe_emit_sync_lock_test_and_set): Likewise.
(expand_atomic_compare_and_swap): Likewise.
(maybe_emit_compare_and_swap_exchange_loop): Don't convert_modes.

From-SVN: r204040
parent bdd833da
2013-08-24 Richard Henderson <rth@twiddle.net>
PR rtl/58542
* optabs.c (maybe_emit_atomic_exchange): Use create_input_operand
instead of create_convert_operand_to.
(maybe_emit_sync_lock_test_and_set): Likewise.
(expand_atomic_compare_and_swap): Likewise.
(maybe_emit_compare_and_swap_exchange_loop): Don't convert_modes.
2013-08-24 Sriraman Tallam <tmsriram@google.com> 2013-08-24 Sriraman Tallam <tmsriram@google.com>
* cgraph.c (cgraph_fnver_htab): Move GTY((...)) to be before htab_t. * cgraph.c (cgraph_fnver_htab): Move GTY((...)) to be before htab_t.
...@@ -7040,8 +7040,7 @@ maybe_emit_atomic_exchange (rtx target, rtx mem, rtx val, enum memmodel model) ...@@ -7040,8 +7040,7 @@ maybe_emit_atomic_exchange (rtx target, rtx mem, rtx val, enum memmodel model)
create_output_operand (&ops[0], target, mode); create_output_operand (&ops[0], target, mode);
create_fixed_operand (&ops[1], mem); create_fixed_operand (&ops[1], mem);
/* VAL may have been promoted to a wider mode. Shrink it if so. */ create_input_operand (&ops[2], val, mode);
create_convert_operand_to (&ops[2], val, mode, true);
create_integer_operand (&ops[3], model); create_integer_operand (&ops[3], model);
if (maybe_expand_insn (icode, 4, ops)) if (maybe_expand_insn (icode, 4, ops))
return ops[0].value; return ops[0].value;
...@@ -7080,8 +7079,7 @@ maybe_emit_sync_lock_test_and_set (rtx target, rtx mem, rtx val, ...@@ -7080,8 +7079,7 @@ maybe_emit_sync_lock_test_and_set (rtx target, rtx mem, rtx val,
struct expand_operand ops[3]; struct expand_operand ops[3];
create_output_operand (&ops[0], target, mode); create_output_operand (&ops[0], target, mode);
create_fixed_operand (&ops[1], mem); create_fixed_operand (&ops[1], mem);
/* VAL may have been promoted to a wider mode. Shrink it if so. */ create_input_operand (&ops[2], val, mode);
create_convert_operand_to (&ops[2], val, mode, true);
if (maybe_expand_insn (icode, 3, ops)) if (maybe_expand_insn (icode, 3, ops))
return ops[0].value; return ops[0].value;
} }
...@@ -7123,8 +7121,6 @@ maybe_emit_compare_and_swap_exchange_loop (rtx target, rtx mem, rtx val) ...@@ -7123,8 +7121,6 @@ maybe_emit_compare_and_swap_exchange_loop (rtx target, rtx mem, rtx val)
{ {
if (!target || !register_operand (target, mode)) if (!target || !register_operand (target, mode))
target = gen_reg_rtx (mode); target = gen_reg_rtx (mode);
if (GET_MODE (val) != VOIDmode && GET_MODE (val) != mode)
val = convert_modes (mode, GET_MODE (val), val, 1);
if (expand_compare_and_swap_loop (mem, target, val, NULL_RTX)) if (expand_compare_and_swap_loop (mem, target, val, NULL_RTX))
return target; return target;
} }
...@@ -7336,8 +7332,8 @@ expand_atomic_compare_and_swap (rtx *ptarget_bool, rtx *ptarget_oval, ...@@ -7336,8 +7332,8 @@ expand_atomic_compare_and_swap (rtx *ptarget_bool, rtx *ptarget_oval,
create_output_operand (&ops[0], target_bool, bool_mode); create_output_operand (&ops[0], target_bool, bool_mode);
create_output_operand (&ops[1], target_oval, mode); create_output_operand (&ops[1], target_oval, mode);
create_fixed_operand (&ops[2], mem); create_fixed_operand (&ops[2], mem);
create_convert_operand_to (&ops[3], expected, mode, true); create_input_operand (&ops[3], expected, mode);
create_convert_operand_to (&ops[4], desired, mode, true); create_input_operand (&ops[4], desired, mode);
create_integer_operand (&ops[5], is_weak); create_integer_operand (&ops[5], is_weak);
create_integer_operand (&ops[6], succ_model); create_integer_operand (&ops[6], succ_model);
create_integer_operand (&ops[7], fail_model); create_integer_operand (&ops[7], fail_model);
...@@ -7358,8 +7354,8 @@ expand_atomic_compare_and_swap (rtx *ptarget_bool, rtx *ptarget_oval, ...@@ -7358,8 +7354,8 @@ expand_atomic_compare_and_swap (rtx *ptarget_bool, rtx *ptarget_oval,
create_output_operand (&ops[0], target_oval, mode); create_output_operand (&ops[0], target_oval, mode);
create_fixed_operand (&ops[1], mem); create_fixed_operand (&ops[1], mem);
create_convert_operand_to (&ops[2], expected, mode, true); create_input_operand (&ops[2], expected, mode);
create_convert_operand_to (&ops[3], desired, mode, true); create_input_operand (&ops[3], desired, mode);
if (!maybe_expand_insn (icode, 4, ops)) if (!maybe_expand_insn (icode, 4, ops))
return false; return false;
......
2013-10-24 Richard Henderson <rth@redhat.com>
PR rtl/58542
* gcc.dg/atomic-store-6.c: New.
2013-10-24 Ian Lance Taylor <iant@google.com> 2013-10-24 Ian Lance Taylor <iant@google.com>
* go.test/go-test.exp (errchk): Combine quoted strings in * go.test/go-test.exp (errchk): Combine quoted strings in
......
/* { dg-do run } */
/* { dg-require-effective-target sync_int_128_runtime } */
/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */
__int128_t i;
int main()
{
__atomic_store_16(&i, -1, 0);
if (i != -1)
__builtin_abort();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment