This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Add _Float128 function aliases [committed]
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: Joseph Myers <joseph at codesourcery dot com>, libc-alpha at sourceware dot org
- Cc: nd at arm dot com
- Date: Tue, 09 Jan 2018 15:38:57 +0000
- Subject: Re: Add _Float128 function aliases [committed]
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs dot Nagy at arm dot com;
- Nodisclaimer: True
- References: <alpine.DEB.2.20.1710181737470.28577@digraph.polyomino.org.uk>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 18/10/17 18:38, Joseph Myers wrote:
> This patch adds support for *f128 function aliases on platforms where
> long double has the binary128 format (and thus GCC 7 provides the
> _Float128 type with the same ABI as long double but as a distinct type
> in terms of C type compatibility). This is the same API as provided
> in glibc 2.26 for powerpc64le / x86_64 / x86 / ia64 where _Float128
> has a different format from long double, with the bulk of the API
> coming from TS 18661-3. All the functions alias the corresponding
> long double functions, and __* function names are not provided since
> those are only needed once for each floating-point format, not more
> than once for different types with the same format (so for example,
> -ffinite-math-only maps foof128 to __fool_finite, while type-generic
> macros end up calling e.g. __issignalingl for _Float128 arguments on
> such platforms).
>
> The preparation for this feature was done in previous patches, so this
> one just needs to add the relevant makefile and header definitions,
> and update macro definitions of libm_alias_ldouble_other_r, to turn on
> the feature, and update documentation and ABI baselines.
>
> Tested (a) for x86_64, (b) for aarch64, (c) with build-many-glibcs.py
> with both GCC 6 and GCC 7. Committed.
>
...
> +++ b/sysdeps/ieee754/ldbl-128/bits/floatn.h
...
> +/* The remaining of this file provides support for older compilers. */
> +#if __HAVE_FLOAT128
> +
> +/* The type _Float128 exists only since GCC 7.0. */
> +# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
> +typedef long double _Float128;
> +# endif
note that this typedef in a public header does not work
on compilers that support _Float128 but not >=gcc-7
https://reviews.llvm.org/D40673
(it seems clang added code to define _Float128 because
glibc headers started depending on it, but this is now
broken on targets where long double is ieee binary128
and thus both glibc and clang has a definition.)