]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000: AIX long double builtins for 64 bit long double.
authorDavid Edelsohn <dje.gcc@gmail.com>
Thu, 30 Apr 2020 15:29:32 +0000 (11:29 -0400)
committerDavid Edelsohn <dje.gcc@gmail.com>
Tue, 12 May 2020 15:38:18 +0000 (11:38 -0400)
When long doubles are 64 bit, the AIX C library overrides the definitions
but GCC builtins point to 128 bit names.  This patch overrides the
builtins for fmodl, frexpl, ldexpl and modfl to refer to the 64 bit symbols.

Backport from mainline
2020-05-04  Clement Chigot  <clement.chigot@atos.net>
    David Edelsohn  <dje.gcc@gmail.com>

* config/rs6000/rs6000-call.c (rs6000_init_builtins): Override explicit
for fmodl, frexpl, ldexpl and modfl builtins.

gcc/ChangeLog
gcc/config/rs6000/rs6000-call.c

index d89e3c66c7719215a02d11863ec905137bbf70dc..618f60103027b45a4f68b3d50bd918f41d7f0d85 100644 (file)
@@ -1,3 +1,12 @@
+2020-05-12  David Edelsohn  <dje.gcc@gmail.com>
+
+       Backport from mainline
+       2020-05-04  Clement Chigot  <clement.chigot@atos.net>
+                   David Edelsohn  <dje.gcc@gmail.com>
+
+       * config/rs6000/rs6000-call.c (rs6000_init_builtins): Override explicit
+       for fmodl, frexpl, ldexpl and modfl builtins.
+
 2020-05-11  Sebastian Huber  <sebastian.huber@embedded-brains.de>
 
        Backport from mainline
index 7621d6f5278713b2e1eaf061bac90424021b5a8b..68164b912f066c0b4e16f92d599bb37600cdfa9e 100644 (file)
@@ -12070,10 +12070,28 @@ rs6000_init_builtins (void)
   def_builtin ("__builtin_cpu_is", ftype, RS6000_BUILTIN_CPU_IS);
   def_builtin ("__builtin_cpu_supports", ftype, RS6000_BUILTIN_CPU_SUPPORTS);
 
-  /* AIX libm provides clog as __clog.  */
-  if (TARGET_XCOFF &&
-      (tdecl = builtin_decl_explicit (BUILT_IN_CLOG)) != NULL_TREE)
-    set_user_assembler_name (tdecl, "__clog");
+  if (TARGET_XCOFF)
+    {
+      /* AIX libm provides clog as __clog.  */
+      if ((tdecl = builtin_decl_explicit (BUILT_IN_CLOG)) != NULL_TREE)
+       set_user_assembler_name (tdecl, "__clog");
+
+      /* When long double is 64 bit, some long double builtins of libc
+        functions (like __builtin_frexpl) must call the double version
+        (frexp) not the long double version (frexpl) that expects a 128 bit
+        argument.  */
+      if (! TARGET_LONG_DOUBLE_128)
+       {
+         if ((tdecl = builtin_decl_explicit (BUILT_IN_FMODL)) != NULL_TREE)
+           set_user_assembler_name (tdecl, "fmod");
+         if ((tdecl = builtin_decl_explicit (BUILT_IN_FREXPL)) != NULL_TREE)
+           set_user_assembler_name (tdecl, "frexp");
+         if ((tdecl = builtin_decl_explicit (BUILT_IN_LDEXPL)) != NULL_TREE)
+           set_user_assembler_name (tdecl, "ldexp");
+         if ((tdecl = builtin_decl_explicit (BUILT_IN_MODFL)) != NULL_TREE)
+           set_user_assembler_name (tdecl, "modf");
+       }
+    }
 
 #ifdef SUBTARGET_INIT_BUILTINS
   SUBTARGET_INIT_BUILTINS;