Commit c6647507 by Jakub Jelinek Committed by Jakub Jelinek

re PR target/28924 (x86 sync builtins fail for char and short memory operands)

	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.

From-SVN: r117508
parent a192f4ae
2006-10-06 Jakub Jelinek <jakub@redhat.com>
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.
2006-10-06 J"orn Rennecke <joern.rennecke@st.com>
* print-tree.c (print_node_brief, print_node): Print sign of Inf.
......
......@@ -5494,6 +5494,8 @@ expand_builtin_sync_operation (enum machine_mode mode, tree arglist,
arglist = TREE_CHAIN (arglist);
val = expand_expr (TREE_VALUE (arglist), NULL, mode, EXPAND_NORMAL);
/* If VAL is promoted to a wider mode, convert it back to MODE. */
val = convert_to_mode (mode, val, 1);
if (ignore)
return expand_sync_operation (mem, val, code);
......@@ -5517,9 +5519,13 @@ expand_builtin_compare_and_swap (enum machine_mode mode, tree arglist,
arglist = TREE_CHAIN (arglist);
old_val = expand_expr (TREE_VALUE (arglist), NULL, mode, EXPAND_NORMAL);
/* If OLD_VAL is promoted to a wider mode, convert it back to MODE. */
old_val = convert_to_mode (mode, old_val, 1);
arglist = TREE_CHAIN (arglist);
new_val = expand_expr (TREE_VALUE (arglist), NULL, mode, EXPAND_NORMAL);
/* If NEW_VAL is promoted to a wider mode, convert it back to MODE. */
new_val = convert_to_mode (mode, new_val, 1);
if (is_bool)
return expand_bool_compare_and_swap (mem, old_val, new_val, target);
......@@ -5544,6 +5550,8 @@ expand_builtin_lock_test_and_set (enum machine_mode mode, tree arglist,
arglist = TREE_CHAIN (arglist);
val = expand_expr (TREE_VALUE (arglist), NULL, mode, EXPAND_NORMAL);
/* If VAL is promoted to a wider mode, convert it back to MODE. */
val = convert_to_mode (mode, val, 1);
return expand_sync_lock_test_and_set (mem, val, target);
}
......
2006-10-06 Jakub Jelinek <jakub@redhat.com>
PR target/28924
* gcc.c-torture/compile/20061005-1.c: New test.
2006-10-06 Olivier Hainque <hainque@adacore.com>
* gcc.dg/typename-vla-1.c: New case.
/* PR target/28924 */
char c;
void
testc (void)
{
(void) __sync_fetch_and_add (&c, -1);
}
short s;
void
tests (void)
{
(void) __sync_fetch_and_add (&s, -1);
}
void
testc2 (void)
{
(void) __sync_val_compare_and_swap (&c, -1, -3);
}
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