This patch replaces the following two patches:
September 24th, 2020:
Message-ID: <
20200924203545.GD31597@ibm-toto.the-meissners.org>
October 22nd, 2020:
Message-ID: <
20201022220603.GA11658@ibm-toto.the-meissners.org>
This patch rewrites those patches. In order to run with older GLIBC's, this
patch uses weak references to the IEEE 128-bit conversions to/from string that
are found in GLIBC 2.32.
If the user uses GLIBC 2.32 or later, the Decimal <-> Float128 conversions will
call the functions in that library. This isn't ideal, as IEEE 128-bit has more
exponent range than IBM 128-bit.
If an older library is used, these patches will convert IEEE 128-bit to IBM
128-bit and do the conversion with IBM 128-bit. I have tested this with a
compiler configured to use an older library, and it worked for the conversion
if the number could be represented in the IBM 128-bit format.
While most of the Decimal <-> Long double tests now pass when long doubles are
IEEE 128-bit, there are two tests that fails:
* c-c++-common/dfp/convert-bfp-6.c
* c-c++-common/dfp/convert-bfp-11.c
I have patches for the bfp-11 test (which requires that long double be IBM
128-bit). I have not looked at the bfp-6 test but I will shortly.
I have tested this patch by doing builds, bootstraps, and make check with 3
builds on a power9 little endian server:
* Build one used the default long double being IBM 128-bit;
* Build two set the long double default to IEEE 128-bit; (and)
* Build three set the long double default to 64-bit.
The compilers built fine providing I recompiled gmp, mpc, and mpfr with the
appropriate long double options. There were a few differences in the test
suite runs that will be addressed in later patches, but over all it works
well. This patch is required to be able to build a toolchain where the default
long double is IEEE 128-bit. Can I check this patch into the master branch for
GCC 11?
libgcc/
2021-01-21 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/_dd_to_kf.c: New file.
* config/rs6000/_kf_to_dd.c: New file.
* config/rs6000/_kf_to_sd.c: New file.
* config/rs6000/_kf_to_td.c: New file.
* config/rs6000/_sd_to_kf.c: New file.
* config/rs6000/_sprintfkf.c: New file.
* config/rs6000/_sprintfkf.h: New file.
* config/rs6000/_strtokf.h: New file.
* config/rs6000/_strtokf.c: New file.
* config/rs6000/_td_to_kf.c: New file.
* config/rs6000/quad-float128.h: Add new declarations.
* config/rs6000/t-float128 (fp128_dec_funcs): New macro.
(fp128_decstr_funcs): New macro.
(ibm128_dec_funcs): New macro.
(fp128_ppc_funcs): Add the new conversions.
(fp128_dec_objs): Force Decimal <-> __float128 conversions to be
compiled with -mabi=ieeelongdouble.
(fp128_decstr_objs): Force __float128 <-> string conversions to be
compiled with -mabi=ibmlongdouble.
(ibm128_dec_objs): Force Decimal <-> __float128 conversions to be
compiled with -mabi=ieeelongdouble.
(FP128_CFLAGS_DECIMAL): New macro.
(IBM128_CFLAGS_DECIMAL): New macro.
* dfp-bit.c (DFP_TO_BFP): Add PowerPC _Float128 support.
(BFP_TO_DFP): Add PowerPC _Float128 support.
* dfp-bit.h (BFP_KIND): Add new binary floating point kind for
IEEE 128-bit floating point.
(DFP_TO_BFP): Add PowerPC _Float128 support.
(BFP_TO_DFP): Add PowerPC _Float128 support.
(BFP_SPRINTF): New macro.