public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r9-8890] rs6000: Fix rs6000_atomic_assign_expand_fenv [PR94826] Date: Wed, 16 Sep 2020 19:21:24 +0000 (GMT) [thread overview] Message-ID: <20200916192124.23586395185D@sourceware.org> (raw) https://gcc.gnu.org/g:540e1de23a70360fe9b626df8420be704d02e3a7 commit r9-8890-g540e1de23a70360fe9b626df8420be704d02e3a7 Author: Jakub Jelinek <jakub@redhat.com> Date: Wed Apr 29 15:55:39 2020 +0200 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. (cherry picked from commit c7137fcc7cbc1f1f14f9fed75adcc6bd8f1d418c) Diff: --- gcc/config/rs6000/rs6000.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index d582b324542..55334bfa217 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -39368,7 +39368,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); @@ -39391,12 +39393,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, @@ -39420,12 +39423,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, @@ -39450,13 +39454,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,
reply other threads:[~2020-09-16 19:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200916192124.23586395185D@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).