Use system default for long double unless it is overridden. If the user did not specify a default long double format when configuring GCC, use the long double default from the host compiler.
I tested this on the following systems. There were no regressions: * Big endian Linux power8 using --with-cpu=power8 * Little endian Linux power9 using --with-cpu=power9 * Little endian Linux power10 using --with-cpu=power10 * Little endian Fedora rawhide power10 using --with-cpu=power10 that the default was changed to use IEEE 128-bit. I did not specify --with-long-double-format=ieee and it correctly defaulted to IEEE. * I also built a compiler on the above Fedora rawhide system, explicitly setting the type to IBM, and it did use the IBM format. Can I check this into the master branch? I also think this should be back ported to GCC 11. Can I do this also? 2022-02-04 Michael Meissner <meiss...@the-meissners.org> gcc/ * config/rs6000/rs6000.cc (TARGET_IEEEQUAD_DEFAULT): If the host compiler defaults to IEEE 128-bit long double, make that the default for this build unless it was overridden via the --with-long-double-format= configuration option. --- gcc/config/rs6000/rs6000.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 666dec694a8..0595855568c 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -91,10 +91,17 @@ explicitly redefine TARGET_IEEEQUAD and TARGET_IEEEQUAD_DEFAULT to 0, so those systems will not pick up this default. This needs to be after all of the include files, so that POWERPC_LINUX and POWERPC_FREEBSD are - properly defined. */ + properly defined. In addition, the --with-long-double-format + configuration option also sets TARGET_IEEEQUAD_DEFAULT. + + If the host compiler uses IEEE 128-bit long doubles, make the default to + also use IEEE 128-bit long doubles unless the --with-long-double-format + configuration switch was used. */ #ifndef TARGET_IEEEQUAD_DEFAULT #if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD) #define TARGET_IEEEQUAD_DEFAULT 1 +#elif defined (__LONG_DOUBLE_IEEE128__) +#define TARGET_IEEEQUAD_DEFAULT 1 #else #define TARGET_IEEEQUAD_DEFAULT 0 #endif -- 2.34.1 -- Michael Meissner, IBM PO Box 98, Ayer, Massachusetts, USA, 01432 email: meiss...@linux.ibm.com