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 E24C83858D33 for ; Thu, 2 Mar 2023 10:08:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E24C83858D33 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 D2A9A1FB; Thu, 2 Mar 2023 02:09:10 -0800 (PST) Received: from [10.57.79.112] (unknown [10.57.79.112]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DF8213F67D; Thu, 2 Mar 2023 02:08:26 -0800 (PST) Message-ID: <31f486f6-9e9a-7906-8a9c-208ea67b9b56@arm.com> Date: Thu, 2 Mar 2023 10:08:19 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: Re: [PATCH] simplify-rtx: Fix VOIDmode operand handling in simplify_subreg [PR108805] Content-Language: en-US To: Uros Bizjak , Richard Biener , "gcc-patches@gcc.gnu.org" , richard.sandiford@arm.com References: From: "Andre Vieira (lists)" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-16.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,NICE_REPLY_A,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: 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... 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