[gcc(refs/users/meissner/heads/work027)] PowerPC: Allow __ibm128 on older systems.
Michael Meissner
meissner@gcc.gnu.org
Sun Nov 15 05:32:36 GMT 2020
https://gcc.gnu.org/g:1e0c1e2c8c7ddbb08a00e1f3c1afece1b67db697
commit 1e0c1e2c8c7ddbb08a00e1f3c1afece1b67db697
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Sun Nov 15 00:31:25 2020 -0500
PowerPC: Allow __ibm128 on older systems.
In a patch I submitted for libgcc/config/rs6000/ibm-ldouble.c to use
__builtin_pack_ibm128 instead of __builtin_pack_longdouble, Seghar suggested I
allow __builtin_pack_ibm128 and __builtin_unpack_ibm128 on systems that don't
enable __float128. This patch maps those built-in functions and __ibm128 to
their long double counterparts. This way, people could use these types for
library glue code.
gcc/
2020-11-15 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): If we don't
have __float128 support enabled, but long double is IBM 128-bit,
add defines to map __ibm128, __builtin_pack_ibm128, and
__builtin_unpack_ibm128 into their long double counterparts.
libgcc/
2020-11-15 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/ibm-ldouble.c (IBM128_TYPE): Use __ibm128 if there
is a define for it.
(pack_ldouble): Use __builtin_pack_ibm128.
Diff:
---
gcc/config/rs6000/rs6000-c.c | 10 ++++++++++
libgcc/config/rs6000/ibm-ldouble.c | 14 ++++++++------
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index cc1e997524e..e42368278e6 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -695,6 +695,16 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
builtin_define ("__builtin_huge_valq=__builtin_huge_valf128");
}
+ /* If we don't support __float128, we don't create the __ibm128 type, nor do
+ we enable the pack and unpack built-in functions. However, if long double
+ is IBM 128-bit, just map these into the long double versions. */
+ if (!TARGET_FLOAT128_TYPE && FLOAT128_IBM_P (TFmode) && TARGET_HARD_FLOAT)
+ {
+ builtin_define ("__ibm128=long double");
+ builtin_define ("__builtin_pack_ieee128=__builtin_pack_longdouble");
+ builtin_define ("__builtin_unpack_ieee128=__builtin_unpack_longdouble");
+ }
+
/* Tell users they can use __builtin_bswap{16,64}. */
builtin_define ("__HAVE_BSWAP__");
diff --git a/libgcc/config/rs6000/ibm-ldouble.c b/libgcc/config/rs6000/ibm-ldouble.c
index dd2a02373f2..8683efadf14 100644
--- a/libgcc/config/rs6000/ibm-ldouble.c
+++ b/libgcc/config/rs6000/ibm-ldouble.c
@@ -58,10 +58,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define nonfinite(a) unlikely (! isless (fabs (a), inf ()))
/* If we have __float128/_Float128, use __ibm128 instead of long double. On
- other systems, use long double, because __ibm128 might not have been
- created. */
-#ifdef __FLOAT128__
+ other systems, we might have defined __ibm128 to map into long double, so
+ use __ibm128 in that case also. */
+#if (defined (__FLOAT128__) \
+ || (defined (__LONG_DOUBLE_128__) && defined (__LONG_DOUBLE_IBM128__) \
+ && !defined (_SOFT_DOUBLE) && defined (__ibm128)))
#define IBM128_TYPE __ibm128
+#define HAVE_IBM128 1
#else
#define IBM128_TYPE long double
#endif
@@ -102,9 +105,8 @@ __asm__ (".symver __gcc_qadd,_xlqadd@GCC_3.4\n\t"
static inline IBM128_TYPE
pack_ldouble (double dh, double dl)
{
-#if defined (__LONG_DOUBLE_128__) && defined (__LONG_DOUBLE_IBM128__) \
- && !(defined (_SOFT_FLOAT) || defined (__NO_FPRS__))
- return __builtin_pack_longdouble (dh, dl);
+#ifdef HAVE_IBM128
+ return __builtin_pack_ibm128 (dh, dl);
#else
union
{
More information about the Gcc-cvs
mailing list