Michael Meissner <meiss...@linux.ibm.com> writes: > This patch adds a simple check of whether the GLIBC should be capable of > switching the long double format on the PowerPC to IEEE 128-bit floating > point. > At the moment, library work is not yet finished, but I'm assuming that the > patches will be in place when GLIBC 2.28 is released. If it turns out that > the > finished support does not make it until 2.29, we can adjust the patch later. > > Right now, if you use standard GLIBC 2.27 or earlier (ignoring the bits that > actually use long double that will need to be handled), you will not be able > to > build libstdc++-v3 when long double is configured to be IEEE 128-bit due to > errors with overloaded functions like issignalling (where both __float128 and > long double versions are defined). The GLIBC team has a fix for this, and it > should appear in 2.28. > > This patch checks whether the GLIBC version is 2.28 before allowing you to > switch the long double type. Because the work to prepare GLIBC for the switch > is being done using an Advance Toolchain framework, the patch allows an > Advance > Toolchain 2.27 with the --with-advance-toolchain configuration option (the > official AT 11 release uses GLIBC 2.26 as a framework, and when completed the > AT 12 release should use GLIBC 2.28). > > I have checked it on a little endian power8 system, building both toolchains > using IBM long double and IEEE long double configurations. The tests that > depend on the library support for long double that failed before still fail. > > I also did IEEE long double builds using the host GLIBC and that AT 11, and > verified that once GCC is configured it generates an error. I built bootstrap > compilers on a big endian system, and verified if I selected IEEE long double, > it would fail, since I currently don't have a big endian GLIBC with the fixes > installed. > > Can I check this in the trunk at on the GCC 8 branch? > > 2018-07-05 Michael Meissner <meiss...@linux.ibm.com> > > * configure.ac (powerpc64*-*-linux*): Combine big and little > endian checks for the long double format. Add checks to make sure > the GLIBC can handle configuration of long double to be IEEE > 128-bit before building GCC. > * configure: Regenerate. > > -- > Michael Meissner, IBM > IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA > email: meiss...@linux.ibm.com, phone: +1 (978) 899-4797 > [ ieee128-patch129b: text/plain ] > Index: gcc/configure.ac > =================================================================== > --- gcc/configure.ac (revision 262443) > +++ gcc/configure.ac (working copy) > @@ -6031,23 +6031,48 @@ AC_ARG_WITH([long-double-format], > [AS_HELP_STRING([--with-long-double-format={ieee,ibm}] > [Specify whether PowerPC long double uses IEEE or IBM > format])],[ > case "$target:$with_long_double_format" in > - powerpc64le-*-linux*:ieee | powerpc64le-*-linux*:ibm) > - : > - ;; > - powerpc64-*-linux*:ieee | powerpc64-*-linux*:ibm) > - # IEEE 128-bit emulation is only built on 64-bit VSX Linux systems > - case "$with_cpu" in > - power7 | power8 | power9 | power1*) > + powerpc64le-*-linux*:ibm | powerpc64-*-linux*:ibm | \ > + powerpc64le-*-linux*:ieee | powerpc64-*-linux*:ieee) > + # IEEE 128-bit emulation is only built on 64-bit VSX Linux systems. > + # Little endian 64-bit systems are always VSX, but big endian systems > + # might default to power4. > + case "$target:$with_cpu" in > + powerpc64le-* | *:power7 | *:power8 | *:power9 | *:power1*) > : > ;; > *) > AC_MSG_ERROR([Configuration option --with-long-double-format is only \ > supported if the default cpu is power7 or newer]) > with_long_double_format="" > - ;; > - esac > - ;; > - xpowerpc64*-*-linux*:*) > + esac > + > + if test "x$with_long_double_format" = xieee; then > + # See if we have a new enough GLIBC to allow using IEEE 128-bit long > + # double. We assume the public 2.28 GLIBC and the development version > of > + # the Advance Toolchain (2.27) have all of the missing bits. > + ieee_minor="28" > + glibc_ieee="no" > + atoolchain="" > + if test "x$with_advance_toolchain" != x \ > + -a -d "/opt/$with_advance_toolchain/." \ > + -a -d "/opt/$with_advance_toolchain/bin/." \ > + -a -d "/opt/$with_advance_toolchain/include/."; then > + > + ieee_minor="27"
These minor versions are confusing and shouldn't differ between the Advance Toolchain and glibc. I suggest to test with the following program: #include <math.h> int main () { return !isinfl(__builtin_infl()); } Build it with: gcc -mabi=ieeelongdouble -fno-builtin -Wno-psabi -lm test-ldbl.c If the execution of the program returns 0, your math library supports IEEE long double. -- Tulio Magno