[gcc(refs/users/meissner/heads/work023)] PowerPC: Use __builtin_pack_ieee128 if long double is IEEE 128-bit.

Michael Meissner meissner@gcc.gnu.org
Tue Oct 27 16:47:55 GMT 2020


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

commit e3b91a95e2647a6b3213ae6580e90f95cc5dc280
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Tue Oct 27 12:47:07 2020 -0400

    PowerPC: Use __builtin_pack_ieee128 if long double is IEEE 128-bit.
    
    I have split all of these patches into separate patches to hopefully get them
    into the tree.
    
    This patch changes the __ibm128 emulator to use __builtin_pack_ieee128
    instead of __builtin_pack_longdouble if long double is IEEE 128-bit, and
    we need to use the __ibm128 type.  The code will run without this patch,
    but this patch slightly optimizes it better.
    
    I have tested this patch with bootstrap builds on a little endian power9 system
    running Linux.  With the other patches, I have built two full bootstrap builds
    using this patch and the patches after this patch.  One build used the current
    default for long double (IBM extended double) and the other build switched the
    default to IEEE 128-bit.  I used the Advance Toolchain AT 14.0 compiler as the
    library used by this compiler.  There are no regressions between the tests.
    There are 3 fortran benchmarks (ieee/large_2.f90, default_format_2.f90, and
    default_format_denormal_2.f90) that now pass.
    
    Can I install this into the trunk?
    
    We have gotten some requests to back port these changes to GCC 10.x.  At the
    moment, I am not planning to do the back port, but I may need to in the future.
    
    libgcc/
    2020-10-27  Michael Meissner  <meissner@linux.ibm.com>
    
            * config/rs6000/ibm-ldouble.c (pack_ldouble): Use
            __builtin_pack_ieee128 if long double is IEEE 128-bit.

Diff:
---
 libgcc/config/rs6000/ibm-ldouble.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libgcc/config/rs6000/ibm-ldouble.c b/libgcc/config/rs6000/ibm-ldouble.c
index dd2a02373f2..767fdd72683 100644
--- a/libgcc/config/rs6000/ibm-ldouble.c
+++ b/libgcc/config/rs6000/ibm-ldouble.c
@@ -102,9 +102,17 @@ __asm__ (".symver __gcc_qadd,_xlqadd@GCC_3.4\n\t"
 static inline IBM128_TYPE
 pack_ldouble (double dh, double dl)
 {
+  /* If we are building on a non-VSX system, the __ibm128 type is not defined.
+     This means we can't always use __builtin_pack_ibm128.  Instead, we use
+     __builtin_pack_longdouble if long double uses the IBM extended double
+     128-bit format, and use the explicit __builtin_pack_ibm128 if long double
+     is IEEE 128-bit.  */
 #if defined (__LONG_DOUBLE_128__) && defined (__LONG_DOUBLE_IBM128__)	\
     && !(defined (_SOFT_FLOAT) || defined (__NO_FPRS__))
   return __builtin_pack_longdouble (dh, dl);
+#elif defined (__LONG_DOUBLE_128__) && defined (__LONG_DOUBLE_IEEE128__) \
+    && !(defined (_SOFT_FLOAT) || defined (__NO_FPRS__))
+  return __builtin_pack_ibm128 (dh, dl);
 #else
   union
   {


More information about the Gcc-cvs mailing list