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 63C643858D3C for ; Tue, 21 Mar 2023 18:22:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 63C643858D3C 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 32LIL6OM014282; Tue, 21 Mar 2023 13:21:06 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 32LIL6TM014281; Tue, 21 Mar 2023 13:21:06 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 21 Mar 2023 13:21:06 -0500 From: Segher Boessenkool To: Pat Haugen Cc: GCC Patches , "Kewen.Lin" , David Edelsohn , Peter Bergner Subject: Re: [PATCH V2, rs6000] Tweak modulo define_insns to eliminate register copy Message-ID: <20230321182106.GI25951@gate.crashing.org> References: <0e1a14ae-a16a-5af7-82be-c868d792d00d@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0e1a14ae-a16a-5af7-82be-c868d792d00d@linux.ibm.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! On Tue, Mar 21, 2023 at 07:10:04AM -0500, Pat Haugen wrote: > Updated patch with review comments addressed: fixed up testcase and added > another testcase to verify peephole is functional. > > Don't force target of modulo into a distinct register. > > The define_insns for the modulo operation currently force the target > register > to a distinct reg in preparation for a possible future peephole combining > div/mod. But this can lead to cases of a needless copy being inserted. Fixed > with the following patch. > +/* { dg-final { scan-assembler-not {\mmodsd\M} } } */ > +/* { dg-final { scan-assembler-not {\mmodud\M} } } */ You can do /* { dg-final { scan-assembler-not {\mmod[su]d\M} } } */ if you want? With or without that, okay for trunk. Thanks! Segher