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 6FB3C3857C63 for ; Thu, 15 Jul 2021 20:25:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6FB3C3857C63 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 13CF331B; Thu, 15 Jul 2021 13:25:13 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 92FA63F694; Thu, 15 Jul 2021 13:25:12 -0700 (PDT) From: Richard Sandiford To: Robin Dapp Mail-Followup-To: Robin Dapp , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH 2/7] ifcvt: Allow constants for noce_convert_multiple. References: <20210625160905.23786-1-rdapp@linux.ibm.com> <20210625160905.23786-3-rdapp@linux.ibm.com> Date: Thu, 15 Jul 2021 21:25:11 +0100 In-Reply-To: <20210625160905.23786-3-rdapp@linux.ibm.com> (Robin Dapp's message of "Fri, 25 Jun 2021 18:09:00 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 15 Jul 2021 20:25:14 -0000 Robin Dapp writes: > This lifts the restriction of not allowing constants for > noce_convert_multiple. The code later checks if a valid sequence > is produced anyway. OK, thanks. I was initially worried that this might trump later, more targetted optimisations, but it looks like that's already accounted for: /* If we would only put out one conditional move, the other strategies this pass tries are better optimized and will be more appropriate. Some targets want to strictly limit the number of conditional moves that are emitted, they set this through PARAM, we need to respect that. */ return count > 1 && count <= param; Richard > --- > gcc/ifcvt.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c > index eef6490626a..6006055f26a 100644 > --- a/gcc/ifcvt.c > +++ b/gcc/ifcvt.c > @@ -3269,7 +3269,9 @@ noce_convert_multiple_sets (struct noce_if_info *if_info) > we'll end up trying to emit r4:HI = cond ? (r1:SI) : (r3:HI). > Wrap the two cmove operands into subregs if appropriate to prevent > that. */ > - if (GET_MODE (new_val) != GET_MODE (temp)) > + > + if (!CONSTANT_P (new_val) > + && GET_MODE (new_val) != GET_MODE (temp)) > { > machine_mode src_mode = GET_MODE (new_val); > machine_mode dst_mode = GET_MODE (temp); > @@ -3280,7 +3282,8 @@ noce_convert_multiple_sets (struct noce_if_info *if_info) > } > new_val = lowpart_subreg (dst_mode, new_val, src_mode); > } > - if (GET_MODE (old_val) != GET_MODE (temp)) > + if (!CONSTANT_P (old_val) > + && GET_MODE (old_val) != GET_MODE (temp)) > { > machine_mode src_mode = GET_MODE (old_val); > machine_mode dst_mode = GET_MODE (temp); > @@ -3409,9 +3412,9 @@ bb_ok_for_noce_convert_multiple_sets (basic_block test_bb) > if (!REG_P (dest)) > return false; > > - if (!(REG_P (src) > - || (GET_CODE (src) == SUBREG && REG_P (SUBREG_REG (src)) > - && subreg_lowpart_p (src)))) > + if (!((REG_P (src) || CONSTANT_P (src)) > + || (GET_CODE (src) == SUBREG && REG_P (SUBREG_REG (src)) > + && subreg_lowpart_p (src)))) > return false; > > /* Destination must be appropriate for a conditional write. */