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 99A0E3858422 for ; Thu, 2 Mar 2023 10:13:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99A0E3858422 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 8A0711FB; Thu, 2 Mar 2023 02:14:10 -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 9B3FD3F67D; Thu, 2 Mar 2023 02:13:26 -0800 (PST) From: Richard Sandiford To: "Andre Vieira \(lists\)" Mail-Followup-To: "Andre Vieira \(lists\)" ,Uros Bizjak , Richard Biener , "gcc-patches\@gcc.gnu.org" , richard.sandiford@arm.com Cc: Uros Bizjak , Richard Biener , "gcc-patches\@gcc.gnu.org" Subject: Re: [PATCH] simplify-rtx: Fix VOIDmode operand handling in simplify_subreg [PR108805] References: <31f486f6-9e9a-7906-8a9c-208ea67b9b56@arm.com> Date: Thu, 02 Mar 2023 10:13:25 +0000 In-Reply-To: <31f486f6-9e9a-7906-8a9c-208ea67b9b56@arm.com> (Andre Vieira's message of "Thu, 2 Mar 2023 10:08:19 +0000") 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.3 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: "Andre Vieira (lists)" writes: > Hey both, > > Sorry about that, don't know how I missed those. Just running a test on > that now and will commit when it's done. I assume the comment and 0 -> > byte change can be seen as obvious, especially since it was supposed to > be in my original patch... Thanks. And yeah, agree it counts as obvious. Richard > On 27/02/2023 15:46, Richard Sandiford wrote: >> 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