|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds the narrowing fused multiply-add functions from TS
18661-1 / TS 18661-3 / C2X to glibc's libm: ffma, ffmal, dfmal,
f32fmaf64, f32fmaf32x, f32xfmaf64 for all configurations; f32fmaf64x,
f32fmaf128, f64fmaf64x, f64fmaf128, f32xfmaf64x, f32xfmaf128,
f64xfmaf128 for configurations with _Float64x and _Float128;
__f32fmaieee128 and __f64fmaieee128 aliases in the powerpc64le case
(for calls to ffmal and dfmal when long double is IEEE binary128).
Corresponding tgmath.h macro support is also added.
The changes are mostly similar to those for the other narrowing
functions previously added, especially that for sqrt, so the
description of those generally applies to this patch as well. As with
sqrt, I reused the same test inputs in auto-libm-test-in as for
non-narrowing fma rather than adding extra or separate inputs for
narrowing fma. The tests in libm-test-narrow-fma.inc also follow
those for non-narrowing fma.
The non-narrowing fma has a known bug (bug 6801) that it does not set
errno on errors (overflow, underflow, Inf * 0, Inf - Inf). Rather
than fixing this or having narrowing fma check for errors when
non-narrowing does not (complicating the cases when narrowing fma can
otherwise be an alias for a non-narrowing function), this patch does
not attempt to check for errors from narrowing fma and set errno; the
CHECK_NARROW_FMA macro is still present, but as a placeholder that
does nothing, and this missing errno setting is considered to be
covered by the existing bug rather than needing a separate open bug.
missing-errno annotations are duly added to many of the
auto-libm-test-in test inputs for fma.
This completes adding all the new functions from TS 18661-1 to glibc,
so will be followed by corresponding stdc-predef.h changes to define
__STDC_IEC_60559_BFP__ and __STDC_IEC_60559_COMPLEX__, as the support
for TS 18661-1 will be at a similar level to that for C standard
floating-point facilities up to C11 (pragmas not implemented, but
library functions done). (There are still further changes to be done
to implement changes to the types of fromfp functions from N2548.)
Tested as followed: natively with the full glibc testsuite for x86_64
(GCC 11, 7, 6) and x86 (GCC 11); with build-many-glibcs.py with GCC
11, 7 and 6; cross testing of math/ tests for powerpc64le, powerpc32
hard float, mips64 (all three ABIs, both hard and soft float). The
different GCC versions are to cover the different cases in tgmath.h
and tgmath.h tests properly (GCC 6 has _Float* only as typedefs in
glibc headers, GCC 7 has proper _Float* support, GCC 8 adds
__builtin_tgmath).
|
|
math/auto-libm-test-out is, at over 30 MB, by far the largest file in
the glibc source tree. This patch splits it by function, so reducing
it to auto-libm-test-out-<func> files that are all under 5 MB in size.
This is preliminary to splitting up libm-test.inc as well so that each
function's tests can also be processed separately by
gen-libm-test.pl. As a preliminary patch it doesn't actually
implement that step; rather, all the separate files get concatenated
by the Makefile to produce the monolithic auto-libm-test-out file
again as an input to gen-libm-test.pl. (The concatentation is
identical to the file in the source tree before this patch.)
Even this preliminary step, however, is of use independent of
splitting up libm-test.inc: some tests for csin and csinh have not
been moved to auto-libm-test-in because they result in
auto-libm-test-out generation taking several minutes rather than a few
seconds (all released MPC versions are very slow for certain sin /
sinh inputs; there are some old improvements in MPC mainline which
should eventually become MPC 1.1, but the complex inverse trig and
hyperbolic functions are slow even in MPC mainline and have yet to be
moved to auto-libm-test-in at all), and it seems much more reasonable
to add such inputs to auto-libm-test-in when it will only slow down
regeneration for particular functions than when it will slow down
regeneration globally.
gen-auto-libm-tests still parses the whole input file, but only
generates output for the requested function. This ensures bad syntax
in the file is always detected, and parsing the whole file is quick;
it's output generation that is comparatively slow for some functions.
Tested for x86_64.
* math/gen-auto-libm-tests.c: Update comment about use of program.
(generate_output): Add argument FUNCTION.
(main): Require extra argument. Pass function name to
generate_output.
* math/Makefile (generated): Add auto-libm-test-out.
(libm-test-funcs-auto): New variable.
(auto-libm-test-out-files): New variable.
($(objpfx)libm-test.c): Depend on $(auto-libm-test-out-files).
Concatenate those files to form $(objpfx)auto-libm-test-out and
use it as input to gen-libm-test.pl.
* math/README.libm-test: Update.
* math/auto-libm-test-out: Remove.
* math/auto-libm-test-out-acos: New generated file.
* math/auto-libm-test-out-acosh: Likewise.
* math/auto-libm-test-out-asin: Likewise.
* math/auto-libm-test-out-asinh: Likewise.
* math/auto-libm-test-out-atan: Likewise.
* math/auto-libm-test-out-atan2: Likewise.
* math/auto-libm-test-out-atanh: Likewise.
* math/auto-libm-test-out-cabs: Likewise.
* math/auto-libm-test-out-carg: Likewise.
* math/auto-libm-test-out-cbrt: Likewise.
* math/auto-libm-test-out-ccos: Likewise.
* math/auto-libm-test-out-ccosh: Likewise.
* math/auto-libm-test-out-cexp: Likewise.
* math/auto-libm-test-out-clog: Likewise.
* math/auto-libm-test-out-clog10: Likewise.
* math/auto-libm-test-out-cos: Likewise.
* math/auto-libm-test-out-cosh: Likewise.
* math/auto-libm-test-out-cpow: Likewise.
* math/auto-libm-test-out-csin: Likewise.
* math/auto-libm-test-out-csinh: Likewise.
* math/auto-libm-test-out-csqrt: Likewise.
* math/auto-libm-test-out-ctan: Likewise.
* math/auto-libm-test-out-ctanh: Likewise.
* math/auto-libm-test-out-erf: Likewise.
* math/auto-libm-test-out-erfc: Likewise.
* math/auto-libm-test-out-exp: Likewise.
* math/auto-libm-test-out-exp10: Likewise.
* math/auto-libm-test-out-exp2: Likewise.
* math/auto-libm-test-out-expm1: Likewise.
* math/auto-libm-test-out-fma: Likewise.
* math/auto-libm-test-out-hypot: Likewise.
* math/auto-libm-test-out-j0: Likewise.
* math/auto-libm-test-out-j1: Likewise.
* math/auto-libm-test-out-jn: Likewise.
* math/auto-libm-test-out-lgamma: Likewise.
* math/auto-libm-test-out-log: Likewise.
* math/auto-libm-test-out-log10: Likewise.
* math/auto-libm-test-out-log1p: Likewise.
* math/auto-libm-test-out-log2: Likewise.
* math/auto-libm-test-out-pow: Likewise.
* math/auto-libm-test-out-sin: Likewise.
* math/auto-libm-test-out-sincos: Likewise.
* math/auto-libm-test-out-sinh: Likewise.
* math/auto-libm-test-out-sqrt: Likewise.
* math/auto-libm-test-out-tan: Likewise.
* math/auto-libm-test-out-tanh: Likewise.
* math/auto-libm-test-out-tgamma: Likewise.
* math/auto-libm-test-out-y0: Likewise.
* math/auto-libm-test-out-y1: Likewise.
* math/auto-libm-test-out-yn: Likewise.
|