From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 8849E388E829 for ; Thu, 17 Dec 2020 00:47:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8849E388E829 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4787031B; Wed, 16 Dec 2020 16:47:32 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BB2383F66E; Wed, 16 Dec 2020 16:47:31 -0800 (PST) From: Richard Sandiford To: Jeff Law Mail-Followup-To: Jeff Law , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org Subject: Re: [20/23] rtlanal: Add simple_regno_set References: Date: Thu, 17 Dec 2020 00:47:29 +0000 In-Reply-To: (Jeff Law's message of "Wed, 25 Nov 2020 13:31:07 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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-List-Received-Date: Thu, 17 Dec 2020 00:47:34 -0000 Jeff Law writes: > On 11/13/20 1:21 AM, Richard Sandiford via Gcc-patches wrote: >> This patch adds a routine for finding a =E2=80=9Csimple=E2=80=9D SET for= a register >> definition. See the comment in the patch for details. >> >> gcc/ >> * rtl.h (simple_regno_set): Declare. >> * rtlanal.c (simple_regno_set): New function. > So I was a bit confused that this is supposed to reject read-write, but > what it's really rejecting is a narrow subset of read-write.=C2=A0 In > particular it rejects things that are potentially RMW via subregs. It > doesn't prevent the destination from appearing as a source operand.=C2=A0= You > might consider clarifying the comment. Yeah, in hindsight it was a mistake to spell out the RMW point separately when it was really just an extra condition on the subreg. I'd tweaked this comment and the mux-utils.h one (in response to Martin's feedback) while doing the cross-target testing, but forgot to include the changes to the committed version. (The tested versions were otherwise identical, honest.) Tested on aarch64-linux-gnu and x86_64-linux-gnu. OK to install? Thanks, Richard gcc/ * mux-utils.h (pointer_mux::m_ptr): Tweak description of contents. * rtlanal.c (simple_regno_set): Tweak description to clarify the RMW condition. --- gcc/mux-utils.h | 8 ++++---- gcc/rtlanal.c | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gcc/mux-utils.h b/gcc/mux-utils.h index b026a9fa4c1..6ec0669256d 100644 --- a/gcc/mux-utils.h +++ b/gcc/mux-utils.h @@ -139,10 +139,10 @@ public: private: pointer_mux (char *ptr) : m_ptr (ptr) {} =20 - // The pointer value for A pointers, or the pointer value + 1 for B poin= ters. - // Using a pointer rather than a uintptr_t tells the compiler that secon= d () - // can never return null, and that second_or_null () is only null if - // is_first (). + // Points to the first byte of an object for A pointers or the second + // byte of an object for B pointers. Using a pointer rather than a + // uintptr_t tells the compiler that second () can never return null, + // and that second_or_null () is only null if is_first (). char *m_ptr; }; =20 diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 80e72d6049d..f0e66a7b26b 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -1458,11 +1458,13 @@ set_of (const_rtx pat, const_rtx insn) /* Check whether instruction pattern PAT contains a SET with the following properties: =20 - - the SET is executed unconditionally; - - the destination of the SET is write-only rather than read-write; and + - the SET is executed unconditionally; and - either: - the destination of the SET is a REG that contains REGNO; or - - the destination of the SET is a SUBREG of such a REG. + - both: + - the destination of the SET is a SUBREG of such a REG; and + - writing to the subreg clobbers all of the SUBREG_REG + (in other words, read_modify_subreg_p is false). =20 If PAT does have a SET like that, return the set, otherwise return null. =20