Skip to content

Commit

Permalink
Add _Float64, _Float32x function aliases.
Browse files Browse the repository at this point in the history
This patch continues filling out TS 18661-3 support by adding *f64 and
*f32x function aliases, supporting _Float64 and _Float32x, as aliases
for double functions.  These types are supported for all glibc
configurations.  The API corresponds exactly to that for _Float128 and
_Float64x.  _Float32 aliases to float functions remain to be added in
subsequent patches to complete this process (then there are a few
miscellaneous functions in TS 18661-3 to implement that aren't simply
versions of existing functions for new types).

The patch enables the feature in bits/floatn-common.h, adds symbol
versions and documentation with updates to ABI baselines, and arranges
for the libm functions for the new types to be tested.  As with the
_Float64x changes there are some x86 ulps updates because of header
inlines not used for the new types (and one other change to the
non-multiarch libm-test-ulps, which I suppose comes from using a
different compiler version / configuration from when it was last
regenerated).

Tested for x86_64 and x86, and with build-many-glibcs.py, with both
GCC 6 and GCC 7.

	* bits/floatn-common.h (__HAVE_FLOAT64): Define to 1.
	(__HAVE_FLOAT32X): Likewise.
	* manual/math.texi (Mathematics): Document support for _Float64
	and _Float32x.
	* math/Makefile (test-types): Add float64 and float32x.
	* math/Versions (GLIBC_2.27): Add _Float64 and _Float32x
	functions.
	* stdlib/Versions (GLIBC_2.27): Likewise.
	* wcsmbs/Versions (GLIBC_2.27): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Likewise.
	* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.
  • Loading branch information
jsm28 committed Dec 6, 2017
1 parent f778723 commit 0d93b7f
Show file tree
Hide file tree
Showing 64 changed files with 5,914 additions and 23 deletions.
81 changes: 81 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,84 @@
2017-12-06 Joseph Myers <[email protected]>

* bits/floatn-common.h (__HAVE_FLOAT64): Define to 1.
(__HAVE_FLOAT32X): Likewise.
* manual/math.texi (Mathematics): Document support for _Float64
and _Float32x.
* math/Makefile (test-types): Add float64 and float32x.
* math/Versions (GLIBC_2.27): Add _Float64 and _Float32x
functions.
* stdlib/Versions (GLIBC_2.27): Likewise.
* wcsmbs/Versions (GLIBC_2.27): Likewise.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Update.
* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
* sysdeps/i386/fpu/libm-test-ulps: Likewise.
* sysdeps/i386/i686/fpu/multiarch/libm-test-ulps: Likewise.

2017-12-05 Joseph Myers <[email protected]>

* bits/floatn-common.h: Include <bits/long-double.h>.
Expand Down
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Major new features:
18661-3:2015. These are corresponding interfaces to those supported for
_Float128.

* The math library now implements interfaces for the _Float64 and _Float32x
types, as defined by ISO/IEC TS 18661-3:2015. These are corresponding
interfaces to those supported for _Float128.

* glibc now implements the memfd_create and mlock2 functions on Linux.

* Support for memory protection keys was added. The <sys/mman.h> header now
Expand Down
4 changes: 2 additions & 2 deletions bits/floatn-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
glibc includes corresponding *fN or *fNx interfaces for it. */
#define __HAVE_FLOAT16 0
#define __HAVE_FLOAT32 0
#define __HAVE_FLOAT64 0
#define __HAVE_FLOAT32X 0
#define __HAVE_FLOAT64 1
#define __HAVE_FLOAT32X 1
#define __HAVE_FLOAT128X 0

/* Defined to 1 if the corresponding __HAVE_<type> macro is 1 and the
Expand Down
7 changes: 4 additions & 3 deletions manual/math.texi
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ usually wise to pick the narrowest type that can accommodate your data.
Not all machines have a distinct @code{long double} type; it may be the
same as @code{double}.

On some machines, @theglibc{} also provides @code{_Float@var{N}} and
@Theglibc{} also provides @code{_Float@var{N}} and
@code{_Float@var{N}x} types. These types are defined in @w{ISO/IEC TS
18661-3}, which extends @w{ISO C} and defines floating-point types that
are not machine-dependent. When such a type, such as @code{_Float128},
Expand All @@ -65,8 +65,9 @@ these functions are described along with the @code{double},
@code{float}, and @code{long double} variants and they come from
@w{ISO/IEC TS 18661-3}, unless explicitly stated otherwise.

Currently, support for @code{_Float@var{N}} or @code{_Float@var{N}x}
types is only provided for @code{_Float128} and @code{_Float64x} on
Support for @code{_Float@var{N}} or @code{_Float@var{N}x} types is
provided for @code{_Float64} and @code{_Float32x} on all platforms.
It is also provided for @code{_Float128} and @code{_Float64x} on
powerpc64le (PowerPC 64-bits little-endian), x86_64, x86, ia64,
aarch64, alpha, mips64, s390 and sparc.

Expand Down
4 changes: 2 additions & 2 deletions math/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ type-float64x-yes := float64x

types = $(types-basic) $(type-float128-$(float128-fcts))
test-types = $(test-types-basic) $(type-float128-$(float128-fcts)) \
$(type-float128-$(float128-alias-fcts)) \
$(type-float64x-$(float64x-alias-fcts))
float64 $(type-float128-$(float128-alias-fcts)) \
float32x $(type-float64x-$(float64x-alias-fcts))

# For each of the basic types (float, double, long double), replace the
# occurrences of 'F' in arg 1 with the appropriate suffix for the type.
Expand Down
106 changes: 106 additions & 0 deletions math/Versions
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ libm {
%endif
GLIBC_2.27 {
expf; exp2f; logf; log2f; powf;
# _Float64x functions, only present for some configurations.
acosf64x;
acoshf64x;
asinf64x;
Expand Down Expand Up @@ -444,5 +445,110 @@ libm {
y0f64x;
y1f64x;
ynf64x;
# _Float64 and _Float32x functions, for all configurations.
acosf64; acosf32x;
acoshf64; acoshf32x;
asinf64; asinf32x;
asinhf64; asinhf32x;
atan2f64; atan2f32x;
atanf64; atanf32x;
atanhf64; atanhf32x;
cabsf64; cabsf32x;
cacosf64; cacosf32x;
cacoshf64; cacoshf32x;
canonicalizef64; canonicalizef32x;
cargf64; cargf32x;
casinf64; casinf32x;
casinhf64; casinhf32x;
catanf64; catanf32x;
catanhf64; catanhf32x;
cbrtf64; cbrtf32x;
ccosf64; ccosf32x;
ccoshf64; ccoshf32x;
ceilf64; ceilf32x;
cexpf64; cexpf32x;
cimagf64; cimagf32x;
clog10f64; clog10f32x;
clogf64; clogf32x;
conjf64; conjf32x;
copysignf64; copysignf32x;
cosf64; cosf32x;
coshf64; coshf32x;
cpowf64; cpowf32x;
cprojf64; cprojf32x;
crealf64; crealf32x;
csinf64; csinf32x;
csinhf64; csinhf32x;
csqrtf64; csqrtf32x;
ctanf64; ctanf32x;
ctanhf64; ctanhf32x;
erfcf64; erfcf32x;
erff64; erff32x;
exp10f64; exp10f32x;
exp2f64; exp2f32x;
expf64; expf32x;
expm1f64; expm1f32x;
fabsf64; fabsf32x;
fdimf64; fdimf32x;
floorf64; floorf32x;
fmaf64; fmaf32x;
fmaxf64; fmaxf32x;
fmaxmagf64; fmaxmagf32x;
fminf64; fminf32x;
fminmagf64; fminmagf32x;
fmodf64; fmodf32x;
frexpf64; frexpf32x;
fromfpf64; fromfpf32x;
fromfpxf64; fromfpxf32x;
getpayloadf64; getpayloadf32x;
hypotf64; hypotf32x;
ilogbf64; ilogbf32x;
j0f64; j0f32x;
j1f64; j1f32x;
jnf64; jnf32x;
ldexpf64; ldexpf32x;
lgammaf64; lgammaf32x;
lgammaf64_r; lgammaf32x_r;
llogbf64; llogbf32x;
llrintf64; llrintf32x;
llroundf64; llroundf32x;
log10f64; log10f32x;
log1pf64; log1pf32x;
log2f64; log2f32x;
logbf64; logbf32x;
logf64; logf32x;
lrintf64; lrintf32x;
lroundf64; lroundf32x;
modff64; modff32x;
nanf64; nanf32x;
nearbyintf64; nearbyintf32x;
nextafterf64; nextafterf32x;
nextdownf64; nextdownf32x;
nextupf64; nextupf32x;
powf64; powf32x;
remainderf64; remainderf32x;
remquof64; remquof32x;
rintf64; rintf32x;
roundevenf64; roundevenf32x;
roundf64; roundf32x;
scalblnf64; scalblnf32x;
scalbnf64; scalbnf32x;
setpayloadf64; setpayloadf32x;
setpayloadsigf64; setpayloadsigf32x;
sincosf64; sincosf32x;
sinf64; sinf32x;
sinhf64; sinhf32x;
sqrtf64; sqrtf32x;
tanf64; tanf32x;
tanhf64; tanhf32x;
tgammaf64; tgammaf32x;
totalorderf64; totalorderf32x;
totalordermagf64; totalordermagf32x;
truncf64; truncf32x;
ufromfpf64; ufromfpf32x;
ufromfpxf64; ufromfpxf32x;
y0f64; y0f32x;
y1f64; y1f32x;
ynf64; ynf32x;
}
}
5 changes: 5 additions & 0 deletions stdlib/Versions
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,14 @@ libc {
}
%endif
GLIBC_2.27 {
# _Float64x functions, only present for some configurations.
strfromf64x;
strtof64x;
strtof64x_l;
# _Float64 and _Float32x functions, for all configurations.
strfromf64; strfromf32x;
strtof64; strtof32x;
strtof64_l; strtof32x_l;
}
GLIBC_PRIVATE {
# functions which have an additional interface since they are
Expand Down
21 changes: 11 additions & 10 deletions sysdeps/i386/fpu/libm-test-ulps
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ Function: "cosh_downward":
double: 2
float: 1
float128: 2
idouble: 1
idouble: 2
ifloat: 1
ifloat128: 1
ildouble: 2
Expand All @@ -1288,7 +1288,7 @@ Function: "cosh_towardzero":
double: 2
float: 1
float128: 2
idouble: 1
idouble: 2
ifloat: 1
ifloat128: 1
ildouble: 2
Expand All @@ -1298,7 +1298,7 @@ Function: "cosh_upward":
double: 4
float: 2
float128: 3
idouble: 1
idouble: 4
ifloat: 1
ifloat128: 1
ildouble: 2
Expand Down Expand Up @@ -1992,9 +1992,9 @@ ldouble: 4

Function: "gamma":
double: 3
float: 2
float: 3
idouble: 3
ifloat: 2
ifloat: 3
ildouble: 4
ldouble: 4

Expand Down Expand Up @@ -2176,10 +2176,10 @@ ldouble: 5

Function: "lgamma":
double: 3
float: 2
float: 3
float128: 5
idouble: 3
ifloat: 2
ifloat: 3
ifloat128: 5
ildouble: 4
ldouble: 4
Expand Down Expand Up @@ -2477,6 +2477,7 @@ ldouble: 3
Function: "sinh":
double: 1
float128: 2
idouble: 1
ifloat128: 2
ildouble: 2
ldouble: 2
Expand All @@ -2485,7 +2486,7 @@ Function: "sinh_downward":
double: 2
float: 1
float128: 3
idouble: 1
idouble: 2
ifloat: 1
ifloat128: 3
ildouble: 5
Expand All @@ -2495,7 +2496,7 @@ Function: "sinh_towardzero":
double: 2
float: 1
float128: 3
idouble: 1
idouble: 2
ifloat: 1
ifloat128: 3
ildouble: 4
Expand All @@ -2505,7 +2506,7 @@ Function: "sinh_upward":
double: 4
float: 2
float128: 4
idouble: 1
idouble: 4
ifloat: 1
ifloat128: 4
ildouble: 5
Expand Down
Loading

0 comments on commit 0d93b7f

Please sign in to comment.