From 8f2973cbf7ee6dd5313343c32e7abe6c51f678d4 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Tue, 5 May 2020 13:33:34 -0400 Subject: [PATCH] Patch ieee128-lib-patch005b --- gcc/ChangeLog.meissner | 9 ++++++++- gcc/config/rs6000/rs6000-c.c | 30 +++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner index 342a439dafd..4de6d61d555 100644 --- a/gcc/ChangeLog.meissner +++ b/gcc/ChangeLog.meissner @@ -1,3 +1,11 @@ +2020-05-05 Michael Meissner + + (ieee128-lib-patch005b) + * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): If long + double is IEEE 128-bit, map the old 'q' built-in functions to + 'f128' versions. Also map the silent NaN f128 function to the + long double version. + 2020-05-05 Michael Meissner (ieee128-lib-patch004b) @@ -24,4 +32,3 @@ 2020-05-05 Michael Meissner Clone branch - diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c index e59eff95cf4..206230a290d 100644 --- a/gcc/config/rs6000/rs6000-c.c +++ b/gcc/config/rs6000/rs6000-c.c @@ -675,15 +675,31 @@ 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. However, + if long double is IEEE 128-bit, map the built-in functions to the normal + long double version. In addition, if the default long double type is + IEEE, the nans builtins seem to generate the normal nan builtin value. */ 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 (TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128) + { + 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"); + builtin_define ("__builtin_nansf128=__builtin_nansl"); + } + 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}. */ -- 2.30.2