From: Segher Boessenkool <segher@kernel.crashing.org>
To: Xionghu Luo <luoxhu@linux.ibm.com>
Cc: will schmidt <will_schmidt@vnet.ibm.com>,
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]
Date: Mon, 6 Sep 2021 16:57:03 -0500 [thread overview]
Message-ID: <20210906215703.GB1583@gate.crashing.org> (raw)
In-Reply-To: <cf137b37-5b31-83b8-eb19-cb4dcf9f69b8@linux.ibm.com>
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
prev parent reply other threads:[~2021-09-06 21:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-16 7:10 Xiong Hu Luo
2021-05-06 2:36 ` Ping: " Xionghu Luo
2021-05-14 7:13 ` Xionghu Luo
2021-06-07 5:08 ` Ping^2: " Xionghu Luo
2021-06-30 1:44 ` Ping ^ 2: " Xionghu Luo
2021-07-09 18:40 ` will schmidt
2021-07-12 1:25 ` Xionghu Luo
2021-09-03 2:31 ` Xionghu Luo
2021-09-03 14:51 ` Bill Schmidt
2021-09-03 14:53 ` David Edelsohn
2021-09-03 21:44 ` Segher Boessenkool
2021-09-06 8:59 ` Xionghu Luo
2021-09-06 21:57 ` Segher Boessenkool [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210906215703.GB1583@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=linkw@gcc.gnu.org \
--cc=luoxhu@linux.ibm.com \
--cc=will_schmidt@vnet.ibm.com \
--cc=wschmidt@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).