[PATCH v3] Fix for powerpc64 long double complex divide failure

Michael Meissner meissner@linux.ibm.com
Fri Aug 27 02:10:58 GMT 2021

On Fri, Aug 13, 2021 at 05:22:47PM +0000, Joseph Myers wrote:
> On Fri, 13 Aug 2021, Andreas Schwab wrote:
> > On Aug 12 2021, Patrick McGehearty via Gcc-patches wrote:
> > How can it happen that __LONG_DOUBLE_IEEE128__ is not defined?  This
> > file is always compiled with -mfloat128 and this looks like dead code.
> I think the answer there is that -mfloat128 serves to enable __float128, 
> it doesn't change the long double ABI, which is what 
> __LONG_DOUBLE_IEEE128__ refers to (that's what -mabi=ieeelongdouble does).

Yes this is correct.  The -mfloat128 enables the __float128 keyword.  It does
not change the default long double format.  Particularly before glibc 2.32 came
out we had some software packages that saw that we had had __float128, and
added functions to their library that took __float128 arguments.  Unfortunately
until the library had the support, it meant they would have references to
things not yet implemented.

We only enable -mfloat128 by default on 64-bit Linux systems.

The macro __LONG_DOUBLE_IEEE128__ is defined when long double uses the IEEE
128-bit format.

The macro __LONG_DOUBLE_IBM128__ is defined when long double uses the IBM
128-bit format.

The macro __LONG_DOUBLE_128__ is defined when one of the 128-bit long double
types (IBM or IEEE) is used for long double.

You can change the long double format with the -mabi=ieeelongdouble option or
by configuring the compiler with the --with-long-double-format=ieee
configuration option.

At present, only the C and C++ languages will work if you use the
-mabi=ieeelongdouble option and your GLIBC is at least 2.32.  This is because
the library support has been done to allow building both ibm128 and IEEE
128-bit functions in the library, and the compiler will use the appropriate
names based on the options.

Other languages such as fortran cannot be configured during compilation and you
must configure the compiler with the --with-long-double-format=ieee option.
This is because those libraries and compilers have not been modified to have
support for both 16-byte long double formats.  You will need to use at least
GLIBC 2.32.

Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797

More information about the Gcc-patches mailing list