aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-10-06 18:54:43 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2006-10-06 18:54:43 +0200
commitc66475078ce85978489b9da5a19ebf21697f2b0d (patch)
tree2e48de3ca5dfde742c2b5979a234d99ce81526c5 /gcc/builtins.c
parenta192f4ae530552597d1153d60f498c82408cec73 (diff)
downloadgcc-c66475078ce85978489b9da5a19ebf21697f2b0d.zip
gcc-c66475078ce85978489b9da5a19ebf21697f2b0d.tar.gz
gcc-c66475078ce85978489b9da5a19ebf21697f2b0d.tar.bz2
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
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 2c81983..2997462 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -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);
}