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 229383858D39 for ; Mon, 27 Feb 2023 15:46:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 229383858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com 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 DCCA7C14; Mon, 27 Feb 2023 07:47:04 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.99.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 11A5A3F881; Mon, 27 Feb 2023 07:46:20 -0800 (PST) From: Richard Sandiford To: Uros Bizjak Mail-Followup-To: Uros Bizjak ,Richard Biener , "gcc-patches\@gcc.gnu.org" , andre.simoesdiasvieira@arm.com, richard.sandiford@arm.com Cc: Richard Biener , "gcc-patches\@gcc.gnu.org" , andre.simoesdiasvieira@arm.com Subject: Re: [PATCH] simplify-rtx: Fix VOIDmode operand handling in simplify_subreg [PR108805] References: Date: Mon, 27 Feb 2023 15:46:19 +0000 In-Reply-To: (Uros Bizjak's message of "Fri, 17 Feb 2023 09:51:57 +0100") 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=-34.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Uros Bizjak writes: > On Fri, Feb 17, 2023 at 8:38 AM Richard Biener wrote: >> >> On Thu, 16 Feb 2023, Uros Bizjak wrote: >> >> > simplify_subreg can return VOIDmode const_int operand and will >> > cause ICE in simplify_gen_subreg when this operand is passed to it. >> > >> > The patch prevents VOIDmode temporary from entering simplify_gen_subreg. >> > We can't process const_int operand any further, since outermode >> > is not an integer mode here. >> >> But if it's a CONST_INT then we know it's of int_outermode, no? That is, >> doesn't simplify_subreg (mode, ...) always return something in 'mode' >> and thus we can always pass just 'mode' as third argument to the >> following simplify_gen_subreg call? > > You are right. I am testing the attached patch that works too. Thanks for this, it's the correct fix. But as noted in https://gcc.gnu.org/pipermail/gcc-patches/2023-January/610920.html, the final 0 is also wrong for big-endian. Andre? Richard > > Uros. > > diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc > index 0a1dd88b0a8..3955929bb70 100644 > --- a/gcc/simplify-rtx.cc > +++ b/gcc/simplify-rtx.cc > @@ -7665,7 +7665,7 @@ simplify_context::simplify_subreg (machine_mode outermode, rtx op, > { > rtx tem = simplify_subreg (int_outermode, op, innermode, byte); > if (tem) > - return simplify_gen_subreg (outermode, tem, GET_MODE (tem), 0); > + return simplify_gen_subreg (outermode, tem, int_outermode, 0); > } > > /* If OP is a vector comparison and the subreg is not changing the