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 5EC2F3857B9C for ; Mon, 27 Jun 2022 14:39:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5EC2F3857B9C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=pass 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 25REcMa2007581; Mon, 27 Jun 2022 09:38:22 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 25REcLbe007580; Mon, 27 Jun 2022 09:38:21 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 27 Jun 2022 09:38:21 -0500 From: Segher Boessenkool To: Roger Sayle Cc: gcc-patches@gcc.gnu.org Subject: Re: [rs6000 PATCH] Improve constant integer multiply using rldimi. Message-ID: <20220627143821.GY25951@gate.crashing.org> References: <006101d8899f$295807b0$7c081710$@nextmovesoftware.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <006101d8899f$295807b0$7c081710$@nextmovesoftware.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Mon, 27 Jun 2022 14:39:24 -0000 Hi! [Something is wrong with your mail program. It puts white lines everywhere, and prefixes a space to the existing white lines.] On Sun, Jun 26, 2022 at 09:56:07PM +0100, Roger Sayle wrote: > It turns out this optimization already exists in the form of a combine > splitter in rs6000.md, but the constraints on combine splitters, > requiring three of four input instructions (and generating one or two > output instructions) mean it doesn't get applied as often as it could. There are no such constraints. Or, it is more complicated, it depends on your viewpoint :-) Combine works on two to four related insns. It combines those insns to one (and one only) instruction, hopefully in canonical form. If that insn is not recognised by recog combine tries to split up this instruction. It has multiple strategies to do that. One is to try a define_split, which indeed is only done if there are at least three input insns. This is left that way even after 2->2 combines: firstly because various backends depend on this, but also because it would cause a lot of code movement without improvement. > This patch converts the define_split into a define_insn_and_split to > catch more cases (such as the one above). > > The one bit that's tricky/controversial is the use of RTL's > nonzero_bits which is accurate during the combine pass when this > pattern is first recognized, but not as advanced (not kept up to > date) when this pattern is eventually split. To support this, > I've used a "|| reload_completed" idiom. Does this approach seem > reasonable? [I've another patch of x86 that uses the same idiom]. No, this does not work. All passes after combine and until reload has completed can then get a nonzero_bits that is a subset of the one combine saw, and thus, the insn no longer matches (as Ke Wen has encountered. Often you do not see this in your testing, but almost always someone will report an ICE within days!) [Btw, you posted the patch as quoted-printable, which means other people can not apply the patch.] Segher