public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Meissner <meissner@linux.ibm.com>
To: Michael Meissner <meissner@linux.ibm.com>,
	gcc-patches@gcc.gnu.org,
	Segher Boessenkool <segher@kernel.crashing.org>,
	David Edelsohn <dje.gcc@gmail.com>,
	Bill Schmidt <wschmidt@linux.ibm.com>,
	Peter Bergner <bergner@linux.ibm.com>, Jeff Law <law@redhat.com>,
	Jonathan Wakely <jwakely@redhat.com>
Subject: [PATCH 6/9] PowerPC: If long double is IEEE 128-bit, map q built-ins to *l instead of *f128.
Date: Thu, 24 Sep 2020 16:40:02 -0400	[thread overview]
Message-ID: <20200924204002.GF31597@ibm-toto.the-meissners.org> (raw)
In-Reply-To: <20200924202036.GA28437@ibm-toto.the-meissners.org>

PowerPC: If long double is IEEE 128-bit, map q built-ins to *l instead of *f128.

If we map nanq to nanf128 when long double is IEEE, it seems to lose the
special signaling vs. non-signaling NAN support.  This patch maps the functions
to the long double version if long double is IEEE 128-bit.

gcc/
2020-09-23  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): If long
	double is IEEE-128 map the nanq built-in functions to the long
	double function, not the f128 function.
---
 gcc/config/rs6000/rs6000-c.c | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index f5982907e90..8f7a8eec740 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -681,15 +681,32 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
       builtin_define ("__builtin_vsx_xvnmsubmsp=__builtin_vsx_xvnmsubsp");
     }
 
-  /* Map the old _Float128 'q' builtins into the new 'f128' builtins.  */
+  /* Map the old _Float128 'q' builtins into the new 'f128' builtins if long
+     double is IBM or 64-bit.
+
+     However, if long double is IEEE 128-bit, map both sets of built-in
+     functions to the normal long double version.  This shows up in nansf128
+     vs. nanf128.  */
   if (TARGET_FLOAT128_TYPE)
     {
-      builtin_define ("__builtin_fabsq=__builtin_fabsf128");
-      builtin_define ("__builtin_copysignq=__builtin_copysignf128");
-      builtin_define ("__builtin_nanq=__builtin_nanf128");
-      builtin_define ("__builtin_nansq=__builtin_nansf128");
-      builtin_define ("__builtin_infq=__builtin_inff128");
-      builtin_define ("__builtin_huge_valq=__builtin_huge_valf128");
+      if (FLOAT128_IEEE_P (TFmode))
+	{
+	  builtin_define ("__builtin_fabsq=__builtin_fabsl");
+	  builtin_define ("__builtin_copysignq=__builtin_copysignl");
+	  builtin_define ("__builtin_nanq=__builtin_nanl");
+	  builtin_define ("__builtin_nansq=__builtin_nansl");
+	  builtin_define ("__builtin_infq=__builtin_infl");
+	  builtin_define ("__builtin_huge_valq=__builtin_huge_vall");
+	}
+      else
+	{
+	  builtin_define ("__builtin_fabsq=__builtin_fabsf128");
+	  builtin_define ("__builtin_copysignq=__builtin_copysignf128");
+	  builtin_define ("__builtin_nanq=__builtin_nanf128");
+	  builtin_define ("__builtin_nansq=__builtin_nansf128");
+	  builtin_define ("__builtin_infq=__builtin_inff128");
+	  builtin_define ("__builtin_huge_valq=__builtin_huge_valf128");
+	}
     }
 
   /* Tell users they can use __builtin_bswap{16,64}.  */
-- 
2.22.0


-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797

  parent reply	other threads:[~2020-09-24 20:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 20:20 [PATCH 0/9] PowerPC: Patches to enable changing the long double default to IEEE 128-bit on little endian PowerPC 64-bit Linux systems Michael Meissner
2020-09-24 20:31 ` [PATCH 1/9] PowerPC: Map long double built-in functions if IEEE 128-bit long double Michael Meissner
2020-10-01 23:05   ` Joseph Myers
2020-10-08  5:20     ` Michael Meissner
2020-09-24 20:33 ` [PATCH 2/9] PowerPC: Update __float128 and __ibm128 error messages Michael Meissner
2020-09-24 20:34 ` [PATCH 3/9] PowerPC: Update IEEE <-> IBM 128-bit floating point conversions Michael Meissner
2020-09-24 20:35 ` [PATCH 4/9] PowerPC: Add IEEE 128-bit <-> Decimal conversions Michael Meissner
2020-09-24 20:36 ` [PATCH 5/9] PowerPC: Update tests to run if long double is IEEE 128-bit Michael Meissner
2020-09-24 20:40 ` Michael Meissner [this message]
2020-09-24 20:42 ` [PATCH 7/9] PowerPC: Update IEEE 128-bit built-in functions to work " Michael Meissner
2020-09-24 20:45 ` [PATCH 8/9] PowerPC: Change tests to use __float128 instead of __ieee128 Michael Meissner
2020-09-24 20:47 ` [PATCH 9/9] PowerPC: Use __builtin_pack_ieee128 if long double is IEEE 128-bit Michael Meissner
2020-10-09  4:35 ` [PATCH 1/9, revised] PowerPC: Map long double built-in functions if IEEE 128-bit long double Michael Meissner
2020-10-16 20:30   ` Segher Boessenkool
2020-10-19 19:30     ` Michael Meissner
2020-10-19 21:24     ` Michael Meissner
2020-10-12 23:16 ` Ping: [PATCH 0/9] PowerPC: Patches to enable changing the long double default to IEEE 128-bit on little endian PowerPC 64-bit Linux systems Michael Meissner
2020-10-16 14:37 ` Ping #2: " Michael Meissner
2020-10-16 19:14 ` Segher Boessenkool
2020-10-19 19:12   ` Michael Meissner
2020-10-19 21:50     ` Segher Boessenkool

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=20200924204002.GF31597@ibm-toto.the-meissners.org \
    --to=meissner@linux.ibm.com \
    --cc=bergner@linux.ibm.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=law@redhat.com \
    --cc=segher@kernel.crashing.org \
    --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).