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 7852E3857C60; Mon, 6 Sep 2021 21:58:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7852E3857C60 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 186Lv4Vu026481; Mon, 6 Sep 2021 16:57:04 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 186Lv3jk026478; Mon, 6 Sep 2021 16:57:03 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 6 Sep 2021 16:57:03 -0500 From: Segher Boessenkool To: Xionghu Luo Cc: will schmidt , gcc-patches@gcc.gnu.org, wschmidt@linux.ibm.com, dje.gcc@gmail.com, linkw@gcc.gnu.org Subject: Re: Ping ^ 2: [PATCH] rs6000: Expand fmod and remainder when built with fast-math [PR97142] Message-ID: <20210906215703.GB1583@gate.crashing.org> References: <20210416071007.78812-1-luoxhu@linux.ibm.com> <6d438971-4778-91cf-451c-a493b0cf9bdf@linux.ibm.com> <4ead69cf-daac-31bb-ddb5-d7b41cf298e2@linux.ibm.com> <2260972d-e44d-f084-69bb-2b7c96c00525@linux.ibm.com> <20210903214454.GO1583@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, KAM_SHORT, 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: Mon, 06 Sep 2021 21:58:06 -0000 Hi! On Mon, Sep 06, 2021 at 04:59:27PM +0800, Xionghu Luo wrote: > On 2021/9/4 05:44, Segher Boessenkool wrote: > >>+/* { dg-final { scan-assembler-not {\mbl fmod\M} } } */ > >>+/* { dg-final { scan-assembler-not {\mbl fmodf\M} } } */ > >>+/* { dg-final { scan-assembler-not {\mbl remainder\M} } } */ > >>+/* { dg-final { scan-assembler-not {\mbl remainderf\M} } } */ > > > >These are negative tests, so won't spuriously fail, but this does not > >test for the function prefixes we can have. See > >gcc.target/powerpc/builtins-1.c for example. > > Thanks. Verified that different calls are generated on different platforms > without this patch. > > P8BE-64: bl __fmodf_finite > P8BE-32: b __fmodf_finite > P8LE-64: bl fmodf Ah, it won't use the "dot-names" here, okay. I think for Darwin you need to allow a single underscore, but you'll find out (or Iain will, most likely ;-) ) > "l", "__" and "_finite" are optional, so is it OK to check them with below > patterns? > > +/* { dg-final { scan-assembler-not {\mbl? (__)?fmod(_finite)?\M} } } */ > +/* { dg-final { scan-assembler-not {\mbl? (__)?fmodf(_finite)?\M} } } */ > +/* { dg-final { scan-assembler-not {\mbl? (__)?remainder(_finite)?\M} } } > */ > +/* { dg-final { scan-assembler-not {\mbl? (__)?remainderf(_finite)?\M} } } > */ You could even do /* { dg-final { scan-assembler-not {(?n)\mb.*fmod} } } */ /* { dg-final { scan-assembler-not {(?n)\mb.*remainder} } } */ or even /* { dg-final { scan-assembler-not {fmod} } } */ /* { dg-final { scan-assembler-not {remainder} } } */ (and the testcase name will not accidentally match either of those REs either, I checked :-) ) And yeah, on some subtargets the calls will be tail-optimised, good find. You can get around that (in general, on any target) by doing float test1 (float x, float y) { float z = fmodf (x, y); asm (""); // to prevent tail calls return z; } but what you do is fine as well, and much more elegant. Please pick (and test ;-) ) whichever option you like best. Thanks! Segher