From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from resqmta-c1p-024061.sys.comcast.net (resqmta-c1p-024061.sys.comcast.net [IPv6:2001:558:fd00:56::6]) by sourceware.org (Postfix) with ESMTPS id 55C903858D1E for ; Tue, 18 Apr 2023 18:32:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 55C903858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=comcast.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=comcast.net Received: from resomta-c1p-023411.sys.comcast.net ([96.102.18.231]) by resqmta-c1p-024061.sys.comcast.net with ESMTP id op5OpXn0IGE7Koq7zpRYOX; Tue, 18 Apr 2023 18:32:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=20190202a; t=1681842751; bh=j+CoqAmbU/ilAQp7rXo00B4JlmYorQK9Im/DWWzEENA=; h=Received:Received:From:Content-Type:Mime-Version:Subject:Date:To: Message-Id:Xfinity-Spam-Result; b=2LUoaB9SqiQkJSnJ7BXJnJLvmCatFFdF2B5eWxkXUmXbLfxvVt344FalwCM7JEheO rAGtLEEBTyxduyvpYid+wsjcp2RHTQLQzVhgKgB5ie2PeCwnh3+CCCfyzXv4kNGO9n QsUa6Pyxs/G/89Vk9lX9B50kHTZrZELIcCZ2nZCYybi/MXNG3CBlokI9UPVg6vI2n/ z8f5edYzXhEpwnZLDjnXy7GqhSF9K1mI/xF2bnkoy3ar2Odk8r7chWA9rv6tEvHp4i CXzqoGKJxN2Sq9gXgVPd2g4ngcQKPvDD5APzLt1tfIu0IVBzUcbPfXB/yKJlf8Selj kOVR9Ak14VO1Q== Received: from smtpclient.apple ([73.60.223.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 256/256 bits) (Client did not present a certificate) by resomta-c1p-023411.sys.comcast.net with ESMTPSA id oq7bpaTyJ8Z9ooq7cpkD3T; Tue, 18 Apr 2023 18:32:09 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgedvhedrvdelkedguddvjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucevohhmtggrshhtqdftvghsihdpqfgfvfdppffquffrtefokffrnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhtgfgggfuffhfvfgjkffosehtqhhmtdhhtddvnecuhfhrohhmpefrrghulhcumfhonhhinhhguceophgruhhlkhhonhhinhhgsegtohhmtggrshhtrdhnvghtqeenucggtffrrghtthgvrhhnpedtgeegkedtjeejgfdvgeehjeevieetkeekkeekudekieeuffehgeffvdfffefgffenucfkphepjeefrdeitddrvddvfedruddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopehsmhhtphgtlhhivghnthdrrghpphhlvgdpihhnvghtpeejfedriedtrddvvdefrddutddupdhmrghilhhfrhhomhepphgruhhlkhhonhhinhhgsegtohhmtggrshhtrdhnvghtpdhnsggprhgtphhtthhopedvpdhrtghpthhtohephhhpsegrgihishdrtghomhdprhgtphhtthhopehgtggtqdhprghttghhvghssehgtggtrdhgnhhurdhorhhg X-Xfinity-VMeta: sc=-100.00;st=legit From: Paul Koning Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.3\)) Subject: Re: [PATCH] doc: Document order of define_peephole2 scanning Date: Tue, 18 Apr 2023 14:32:07 -0400 References: <20230418175507.2C40B2040B@pchp3.se.axis.com> To: Hans-Peter Nilsson , Hans-Peter Nilsson via Gcc-patches In-Reply-To: <20230418175507.2C40B2040B@pchp3.se.axis.com> Message-Id: <0442F4ED-45A1-44D3-AB1B-F28657F04D3F@comcast.net> X-Mailer: Apple Mail (2.3696.120.41.1.3) X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: I'm not sure about the meaning of part of this. "...resumes at the last = generated insn." Does that mean: 1. If a match is found at some insn, the replacement defined by the = matching define_peephole2 is performed, and then the scan resumes at the = first of the insns produced by the replacement. or 2. If a match is found at some insn, the replacement defined by the = matching define_peephole2 is performed, and then the scan resumes at the = insn immediately following the ones just matched. "Last generated" seems to fit option 1, but I'm not sure if that's what = you meant. Maybe you could add some words to say more explicitly which = it is. paul > On Apr 18, 2023, at 1:55 PM, Hans-Peter Nilsson via Gcc-patches = wrote: >=20 > Generated pdf inspected. Ok to commit? >=20 > Thoughts on fixing the IMHO wart to also expose all > replacements to all define_peephole2? Looks feasible > (famous last words), but then again I haven't checked the > history yet. >=20 > -- >8 -- > I was a bit surprised when my define_peephole2 didn't match, > but it was because it was expected to partially match the > generated output of a previous define_peephole2. I had > assumed that the algorithm exposed newly created opportunities > to all define_peephole2's. While things can change in that > direction, let's start with documenting the current state. >=20 > * doc/md.texi (define_peephole2): Document order of scanning. > --- > gcc/doc/md.texi | 8 ++++++++ > 1 file changed, 8 insertions(+) >=20 > diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi > index 07bf8bdebffb..0f9e32d2c648 100644 > --- a/gcc/doc/md.texi > +++ b/gcc/doc/md.texi > @@ -9362,6 +9362,14 @@ If the preparation falls through (invokes = neither @code{DONE} nor > @code{FAIL}), then the @code{define_peephole2} uses the replacement > template. >=20 > +Insns are scanned in forward order from beginning to end for each = basic > +block, but the basic blocks are scanned in reverse order of = appearance > +in a function. After a successful replacement, scanning for further > +opportunities for @code{define_peephole2} matches, resumes at the = last > +generated insn. I.e. for the example above, the first insn that can = be > +matched by another @code{define_peephole2}, is @code{(set (match_dup = 3) > +(match_dup 4))}. > + > @end ifset > @ifset INTERNALS > @node Insn Attributes > --=20 > 2.30.2 >=20