summaryrefslogtreecommitdiff
path: root/gcc/config/rs6000
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-04-29 15:55:39 +0200
committerJakub Jelinek <jakub@redhat.com>2020-04-29 15:55:39 +0200
commitc7137fcc7cbc1f1f14f9fed75adcc6bd8f1d418c (patch)
tree26182eb998ac9a22e72e252a5216b2252cf843f8 /gcc/config/rs6000
parent1657178f59bf0c5b269a668bcdcc432fac3bbdd0 (diff)
rs6000: Fix rs6000_atomic_assign_expand_fenv [PR94826]
This is the rs6000 version of the earlier committed x86, aarch64 and arm fixes, as create_tmp_var_raw is used because the C FE can call this outside of function context, we need to make sure the first references to those VAR_DECLs are through a TARGET_EXPR, so that it gets gimple_add_tmp_var marked in whatever function it gets expanded in. Without that DECL_CONTEXT is NULL and the vars aren't added as local decls of the containing function. 2020-04-29 Jakub Jelinek <jakub@redhat.com> PR target/94826 * config/rs6000/rs6000.c (rs6000_atomic_assign_expand_fenv): Use TARGET_EXPR instead of MODIFY_EXPR for first assignment to fenv_var, fenv_clear and old_fenv variables. For fenv_addr take address of TARGET_EXPR of fenv_var with void_node initializer. Formatting fixes.
Diffstat (limited to 'gcc/config/rs6000')
-rw-r--r--gcc/config/rs6000/rs6000.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d4e16ce7fcc..017e7704366 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -26012,7 +26012,9 @@ rs6000_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
tree fenv_var = create_tmp_var_raw (double_type_node);
TREE_ADDRESSABLE (fenv_var) = 1;
- tree fenv_addr = build1 (ADDR_EXPR, double_ptr_type_node, fenv_var);
+ tree fenv_addr = build1 (ADDR_EXPR, double_ptr_type_node,
+ build4 (TARGET_EXPR, double_type_node, fenv_var,
+ void_node, NULL_TREE, NULL_TREE));
*hold = build_call_expr (atomic_hold_decl, 1, fenv_addr);
*clear = build_call_expr (atomic_clear_decl, 0);
@@ -26035,12 +26037,13 @@ rs6000_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
/* Mask to clear everything except for the rounding modes and non-IEEE
arithmetic flag. */
- const unsigned HOST_WIDE_INT hold_exception_mask =
- HOST_WIDE_INT_C (0xffffffff00000007);
+ const unsigned HOST_WIDE_INT hold_exception_mask
+ = HOST_WIDE_INT_C (0xffffffff00000007);
tree fenv_var = create_tmp_var_raw (double_type_node);
- tree hold_mffs = build2 (MODIFY_EXPR, void_type_node, fenv_var, call_mffs);
+ tree hold_mffs = build4 (TARGET_EXPR, double_type_node, fenv_var, call_mffs,
+ NULL_TREE, NULL_TREE);
tree fenv_llu = build1 (VIEW_CONVERT_EXPR, uint64_type_node, fenv_var);
tree fenv_llu_and = build2 (BIT_AND_EXPR, uint64_type_node, fenv_llu,
@@ -26064,12 +26067,13 @@ rs6000_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
/* Mask to clear everything except for the rounding modes and non-IEEE
arithmetic flag. */
- const unsigned HOST_WIDE_INT clear_exception_mask =
- HOST_WIDE_INT_C (0xffffffff00000000);
+ const unsigned HOST_WIDE_INT clear_exception_mask
+ = HOST_WIDE_INT_C (0xffffffff00000000);
tree fenv_clear = create_tmp_var_raw (double_type_node);
- tree clear_mffs = build2 (MODIFY_EXPR, void_type_node, fenv_clear, call_mffs);
+ tree clear_mffs = build4 (TARGET_EXPR, double_type_node, fenv_clear,
+ call_mffs, NULL_TREE, NULL_TREE);
tree fenv_clean_llu = build1 (VIEW_CONVERT_EXPR, uint64_type_node, fenv_clear);
tree fenv_clear_llu_and = build2 (BIT_AND_EXPR, uint64_type_node,
@@ -26094,13 +26098,14 @@ rs6000_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
(*(uint64_t*)fenv_var 0x1ff80fff);
__builtin_mtfsf (0xff, fenv_update); */
- const unsigned HOST_WIDE_INT update_exception_mask =
- HOST_WIDE_INT_C (0xffffffff1fffff00);
- const unsigned HOST_WIDE_INT new_exception_mask =
- HOST_WIDE_INT_C (0x1ff80fff);
+ const unsigned HOST_WIDE_INT update_exception_mask
+ = HOST_WIDE_INT_C (0xffffffff1fffff00);
+ const unsigned HOST_WIDE_INT new_exception_mask
+ = HOST_WIDE_INT_C (0x1ff80fff);
tree old_fenv = create_tmp_var_raw (double_type_node);
- tree update_mffs = build2 (MODIFY_EXPR, void_type_node, old_fenv, call_mffs);
+ tree update_mffs = build4 (TARGET_EXPR, double_type_node, old_fenv,
+ call_mffs, NULL_TREE, NULL_TREE);
tree old_llu = build1 (VIEW_CONVERT_EXPR, uint64_type_node, old_fenv);
tree old_llu_and = build2 (BIT_AND_EXPR, uint64_type_node, old_llu,