public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work048)] Fix nanq functions if long double is IEEE 128-bit on PowerPC.
@ 2021-04-15 17:21 Michael Meissner
  0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2021-04-15 17:21 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:bb897b9b852dc0489534933c3fd45ce9a7d8b123

commit bb897b9b852dc0489534933c3fd45ce9a7d8b123
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Thu Apr 15 13:21:18 2021 -0400

    Fix nanq functions if long double is IEEE 128-bit on PowerPC.
    
    gcc/
    2021-04-15  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.

Diff:
---
 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 0f8a629ff5a..ae4c61287d8 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -686,15 +686,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}.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-15 17:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 17:21 [gcc(refs/users/meissner/heads/work048)] Fix nanq functions if long double is IEEE 128-bit on PowerPC Michael Meissner

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).