diff options
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 8 |
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); } |