From patchwork Wed Apr 29 11:48:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1279207 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Bsim8nQm; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Bxcc07rcz9sRY for ; Wed, 29 Apr 2020 21:49:02 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AA68238930DC; Wed, 29 Apr 2020 11:48:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA68238930DC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588160939; bh=PF+pHw95H7gpENltMxTVYMlvnxSVsSa/syTTElULnjE=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Bsim8nQmQv3C7Dktpb7TqSi9Y8Wqul5OlgGAD1DE+rYNBMXYTK9AR83oLOyN225le HvZhywMgmh6K/U5UHm0LC2yVCL5sqClQ2OLMcAvPz4XuXvHUMPzMiBsfekNKy0/Vsm Q+a0+Ghp6xj7zvwJFm4aC6Mhml7jq0Dw2jOvRgYc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 6F97638930C3 for ; Wed, 29 Apr 2020 11:48:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6F97638930C3 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-194-HCQzXtD7N6WYPUBTKydSlA-1; Wed, 29 Apr 2020 07:48:55 -0400 X-MC-Unique: HCQzXtD7N6WYPUBTKydSlA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 18FC5801E63; Wed, 29 Apr 2020 11:48:54 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-104.ams2.redhat.com [10.36.112.104]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C0275C1BE; Wed, 29 Apr 2020 11:48:52 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id 03TBmosP031743; Wed, 29 Apr 2020 13:48:50 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id 03TBmn85031742; Wed, 29 Apr 2020 13:48:49 +0200 Date: Wed, 29 Apr 2020 13:48:49 +0200 To: Segher Boessenkool , David Edelsohn Subject: [PATCH] rs6000: Fix rs6000_atomic_assign_expand_fenv [PR94826] Message-ID: <20200429114849.GE2424@tucnak> MIME-Version: 1.0 User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-16.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_BL, RCVD_IN_MSPIKE_L3, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi! 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. Bootstrapped/regtested on powerpc64{,le}-linux, ok for trunk? 2020-04-29 Jakub Jelinek 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. Jakub --- gcc/config/rs6000/rs6000.c.jj 2020-04-29 09:00:46.000000000 +0200 +++ gcc/config/rs6000/rs6000.c 2020-04-29 09:33:03.990008223 +0200 @@ -26012,7 +26012,9 @@ rs6000_atomic_assign_expand_fenv (tree * 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 * /* 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 * /* 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 * (*(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,