public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pc at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/103605] [PowerPC] fmin/fmax should be inlined always with xsmindp/xsmaxdp Date: Tue, 26 Apr 2022 18:35:15 +0000 [thread overview] Message-ID: <bug-103605-4-JBHdqkYFcD@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103605-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103605 --- Comment #3 from pc at gcc dot gnu.org --- Here's a test which exercises all three options: - fmin () (glibc 2.28) - xsmincdp (ironically, via __builtin_vsx_xsmindp) - xsmindp (via asm) -- $ cat xsmindp.c #include <stdio.h> #include <math.h> int main (int argc) { double d0 = argc, d1 = argc+1; double rf, rb, rx; printf ("(src1, src2): fmin b-in asm\n"); rf = fmin (d0, d1); rb = __builtin_vsx_xsmindp (d0, d1); asm ("xsmindp %0,%1,%2" : "=wa" (rx) : "wa" (d0), "wa" (d1)); printf ("(+3.0, +3.0): %+3.1f %+3.1f %+3.1f\n", rf, rb, rx); d1 = NAN; rf = fmin (d0, d1); rb = __builtin_vsx_xsmindp (d0, d1); asm ("xsmindp %0,%1,%2" : "=wa" (rx) : "wa" (d0), "wa" (d1)); printf ("(+3.0, NAN): %+3.1f %+3.1f %+3.1f\n", rf, rb, rx); rf = fmin (d1, d0); rb = __builtin_vsx_xsmindp (d1, d0); asm ("xsmindp %0,%1,%2" : "=wa" (rx) : "wa" (d1), "wa" (d0)); printf ("( NAN, +3.0): %+3.1f %+3.1f %+3.1f\n", rf, rb, rx); d0 = NAN; rf = fmin (d0, d1); rb = __builtin_vsx_xsmindp (d0, d1); asm ("xsmindp %0,%1,%2" : "=wa" (rx) : "wa" (d0), "wa" (d1)); printf ("( NAN, NAN): %+3.1f %+3.1f %+3.1f\n", rf, rb, rx); d0 = argc, d1 = argc+1; d1 = __builtin_nans ("0"); rf = fmin (d0, d1); rb = __builtin_vsx_xsmindp (d0, d1); asm ("xsmindp %0,%1,%2" : "=wa" (rx) : "wa" (d0), "wa" (d1)); printf ("(+3.0, SNAN): %+3.1f %+3.1f %+3.1f\n", rf, rb, rx); rf = fmin (d1, d0); rb = __builtin_vsx_xsmindp (d1, d0); asm ("xsmindp %0,%1,%2" : "=wa" (rx) : "wa" (d1), "wa" (d0)); printf ("(SNAN, +3.0): %+3.1f %+3.1f %+3.1f\n", rf, rb, rx); d0 = __builtin_nans ("0"); rf = fmin (d0, d1); rb = __builtin_vsx_xsmindp (d0, d1); asm ("xsmindp %0,%1,%2" : "=wa" (rx) : "wa" (d0), "wa" (d1)); printf ("(SNAN, SNAN): %+3.1f %+3.1f %+3.1f\n", rf, rb, rx); return 0; } $ /opt/gcc-nightly/trunk/bin/gcc --version gcc (GCC) 12.0.1 20220426 (experimental) [remotes/origin/HEAD r12-8269-gcd4acb8cd9] Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ /opt/gcc-nightly/trunk/bin/gcc -fsignaling-nans -D_WANT_SNAN -o xsmindp xsmindp.c -O0 -lm && ./xsmindp (src1, src2): fmin b-in asm (+3.0, +3.0): +1.0 +1.0 +1.0 (+3.0, NAN): +1.0 +nan +1.0 ( NAN, +3.0): +1.0 +1.0 +1.0 ( NAN, NAN): +nan +nan +nan (+3.0, SNAN): +nan +nan +nan (SNAN, +3.0): +nan +1.0 +nan (SNAN, SNAN): +nan +nan +nan $ /opt/gcc-nightly/trunk/bin/gcc -fsignaling-nans -D_WANT_SNAN -o xsmindp xsmindp.c -O3 -mcpu=power10 -lm && ./xsmindp (src1, src2): fmin b-in asm (+3.0, +3.0): +1.0 +1.0 +1.0 (+3.0, NAN): +1.0 +nan +1.0 ( NAN, +3.0): +1.0 +nan +1.0 ( NAN, NAN): +nan +nan +nan (+3.0, SNAN): +nan +nan +nan (SNAN, +3.0): +nan +1.0 +nan (SNAN, SNAN): +nan +nan +nan $ /opt/gcc-nightly/trunk/bin/gcc -fsignaling-nans -D_WANT_SNAN -o xsmindp xsmindp.c -O3 -mcpu=power10 -lm -ffast-math && ./xsmindp (src1, src2): fmin b-in asm (+3.0, +3.0): +1.0 +1.0 +1.0 (+3.0, NAN): +nan +nan +1.0 ( NAN, +3.0): +nan +nan +1.0 ( NAN, NAN): +nan +nan +nan (+3.0, SNAN): +nan +nan +nan (SNAN, +3.0): +nan +nan +nan (SNAN, SNAN): +nan +nan +nan -- Without -ffast-math, the current semantics of fmin() match those of xsmindp. With -ffast-math, the current semantics of fmin() match those of xsmincdp.
next prev parent reply other threads:[~2022-04-26 18:35 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-07 16:21 [Bug target/103605] New: " pc at gcc dot gnu.org 2021-12-07 16:21 ` [Bug target/103605] " pc at gcc dot gnu.org 2022-04-26 9:27 ` guihaoc at gcc dot gnu.org 2022-04-26 18:35 ` pc at gcc dot gnu.org [this message] 2022-04-26 18:46 ` joseph at codesourcery dot com 2022-04-26 20:45 ` pc at gcc dot gnu.org 2022-04-27 5:32 ` guihaoc at gcc dot gnu.org 2022-04-28 3:22 ` linkw at gcc dot gnu.org 2022-05-10 12:21 ` segher at gcc dot gnu.org 2023-07-25 2:43 ` cvs-commit at gcc dot gnu.org 2023-08-17 5:26 ` guihaoc at gcc dot gnu.org
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=bug-103605-4-JBHdqkYFcD@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).