[gcc(refs/users/meissner/heads/work043)] Allow __ibm128 on older PowerPC systems.
Michael Meissner
meissner@gcc.gnu.org
Tue Mar 30 18:24:43 GMT 2021
https://gcc.gnu.org/g:416004060488efade7be62f5749699b653e8237c
commit 416004060488efade7be62f5749699b653e8237c
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Tue Mar 30 14:24:28 2021 -0400
Allow __ibm128 on older PowerPC systems.
In a previous patch, I added code to ibm-ldouble.c to use __builtin_pack_ibm128
if long double is IEEE 128-bit and continue to use __builtin_pack_longdouble
if long double is IBM extended double. This code was needed because
__builtin_pack_ibm128 is not available unless the __ibm128 keyword is
availabe. In the current code, __ibm128 is only enabled if we have support for
both IBM and IEEE 128-bit long double.
Segher suggested that instead I should make __ibm128, __builtin_pack_ibm128,
and __builtin_unpack_ibm128 available on older systems that don't support IEEE
128-bit floating point but does support the IBM extended double floating point.
This patch changes the code so that __ibm128 is now exported if either
long double uses the IBM extended double format, or IEEE 128-bit floating
point is available.
I changed the internal built-in types from float128 to ibm128, since the
only built-in functions that use this are __builtin_pack_ibm128 and
__builtin_unpack_ibm128, and the new name matches the function.
gcc/
2021-03-30 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/rs6000-builtin.def (BU_IBM128_2): Rename
RS6000_BTM_IBM128 from RS6000_BTM_FLOAT128.
* config/rs6000/rs6000-call.c (rs6000_invalid_builtin): Update
error message for __ibm128 built-in functions.
(rs6000_init_builtins): Create the __ibm128 keyword on older
systems where long double uses the IBM extended double format,
even if they don't support IEEE 128-bit floating point.
* config/rs6000/rs6000.c (rs6000_builtin_mask_calculate): Rename
RS6000_BTM_IBM128 from RS6000_BTM_FLOAT128.
(rs6000_builtin_mask_names): Rename RS6000_BTM_IBM128 from
RS6000_BTM_FLOAT128.
* config/rs6000/rs6000.h (TARGET_IBM128): New macro.
(RS6000_BTM_IBM128): Rename from RS6000_BTM_FLOAT128.
(RS6000_BTM_COMMON): Rename RS6000_BTM_IBM128 from
RS6000_BTM_FLOAT128.
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 06b3bc0df33..4950d02ac8f 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}. */
More information about the Gcc-cvs
mailing list