diff mbox series

[9/9] PowerPC: Use __builtin_pack_ieee128 if long double is IEEE 128-bit.

Message ID 20200924204736.GI31597@ibm-toto.the-meissners.org
State New
Headers show
Series PowerPC: Patches to enable changing the long double default to IEEE 128-bit on little endian PowerPC 64-bit Linux systems | expand

Commit Message

Michael Meissner Sept. 24, 2020, 8:47 p.m. UTC
PowerPC: Use __builtin_pack_ieee128 if long double is IEEE 128-bit.

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.

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

	* config/rs6000/ibm-ldouble.c (pack_ldouble): Use
	__builtin_pack_ieee128 if long double is IEEE 128-bit.
---
 libgcc/config/rs6000/ibm-ldouble.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

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
   {