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 0A4C53858423 for ; Fri, 29 Oct 2021 21:46:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0A4C53858423 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 19TLjxg6008829; Fri, 29 Oct 2021 16:45:59 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 19TLjwRJ008828; Fri, 29 Oct 2021 16:45:58 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 29 Oct 2021 16:45:58 -0500 From: Segher Boessenkool To: Peter Bergner Cc: David Edelsohn , GCC Patches , Martin =?utf-8?B?TGnFoWth?= , Tulio Magno Quites Machado Filho , Bill Schmidt Subject: Re: rs6000: Fix up flag_shrink_wrap handling in presence of -mrop-protect [PR101324] Message-ID: <20211029214558.GC614@gate.crashing.org> References: <6c8a8e20-674e-3954-a7e2-63c2eedac828@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6c8a8e20-674e-3954-a7e2-63c2eedac828@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP 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: Fri, 29 Oct 2021 21:47:01 -0000 On Wed, Oct 27, 2021 at 10:17:39PM -0500, Peter Bergner wrote: > Sorry for reposting, but I forgot to CC the gcc-patches mailing list. :-( Whoops, and I replied to your original message :-/ > 2021-10-27 Martin Liska > > gcc/ > PR target/101324 > * config/rs6000/rs6000.c (rs6000_option_override_internal): Move the > disabling of shrink-wrapping when using -mrop-protect from here... > (rs6000_override_options_after_change): ...to here. > > 2021-10-27 Peter Bergner > > gcc/testsuite/ > PR target/101324 > * gcc.target/powerpc/pr101324.c: New test. > +/* Ensure hashst comes after mflr and hashchk comes after ld 0,16(1). */ > +/* { dg-final { scan-assembler "mflr 0.*hashst 0," } } */ > +/* { dg-final { scan-assembler "ld 0,16\\\(1\\\).*hashchk 0," } } */ First: don't use double quotes, or you get double backslashes (or more) as well. Use curlies instead: /* { dg-final { scan-assembler {ld 0,16\(1\).*hashchk 0,} } } */ But, more importantly, "." by default matches anything, newlines as well. You probably do not want that here, because your RE as written can match an "ld" in one function and a "hashchk" many functions later, many million lines later. You can for example do /* { dg-final { scan-assembler {(?p)ld 0,.*\n.*\mhashchk 0,} } } */ (?p) is "partial newline-sensitive matching": it makes "." not match newlines. This is often what you want. This RE also makes sure that "hashchk" is the full mnemonic (not the tail of one), and that it is on the line after that "ld". Similarly you would have /* { dg-final { scan-assembler {(?p)\mmflr 0,.*\n.*\mhashst 0,} } } */ I hope I didn't typo those things, I didn't test them out :-) Okay for trunk with similar robustification. Thanks! Segher