From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id 3FE0B3858435 for ; Sat, 28 Aug 2021 13:46:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3FE0B3858435 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 17SDjkbb001989; Sat, 28 Aug 2021 08:45:46 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 17SDjj48001988; Sat, 28 Aug 2021 08:45:45 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sat, 28 Aug 2021 08:45:45 -0500 From: Segher Boessenkool To: Jeff Law Cc: Roger Sayle , "'GCC Patches'" Subject: Re: [PATCH] Only simplify TRUNCATE to SUBREG on TRULY_NOOP_TRUNCATION targets Message-ID: <20210828134545.GW1583@gate.crashing.org> References: <000101d79b8e$7d7d6470$78782d50$@nextmovesoftware.com> <9835a1a0-0fbd-2204-3881-4ab3eb2166d3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9835a1a0-0fbd-2204-3881-4ab3eb2166d3@gmail.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no 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: Sat, 28 Aug 2021 13:46:48 -0000 Hi! On Fri, Aug 27, 2021 at 05:20:22PM -0600, Jeff Law via Gcc-patches wrote: > On 8/27/2021 3:57 PM, Roger Sayle wrote: > >As recently remarked by Jeff Law, SUBREGs are the "forever chemicals" > >of GCC's RTL; once created they persist in the environment. The problem, > >according to the comment on lines 5428-5438 of combine.c is that > >non-tieable SUBREGs interfere with reload/register allocation, so > >combine often doesn't touch/clean-up instructions containing a SUBREG. > Forever chemicals.  I like that term. It is a very clever name in its original meaning. Not only are PFAS and the like not degraded in the environment, but that is because the F-C bond is so strong... the "Forever-Chemical" bond. Chemists make even worse puns than compiler developers :-) SUBREGs are like perfluoralkyls in more ways: they have huge problems, but there is no real replacement for them either. > >Alas currently, during combine the middle TRUNCATE is converted into > >a lowpart SUBREG, which subst then turns into (clobber (const_int 0)), > >abandoning the attempted combination, that then never reaches recog. Yeah, combine notices it can optimise away the TRUNCATE (a SUBREG is free, is just a reinterpret_cast thingy, no machine operation). With this code disabled (for !TRULY_NOOP_TRUNCATION_MODES_P) you will get less optimised code. > >But it only affects !TRULY_NOOP_TRUNCATION targets, and the motivating > >example above is derived from the behaviour of backend patches not yet > >in the tree [nvptx is currently a STORE_FLAG_VALUE=-1 target]. Should the TARGET_TRULY_NOOP_TRUNCATION documentation be updated now? In particular the part that talks about TARGET_MODES_TIEABLE_P. Segher