Split test-tgmath3 by function.
commit7c67e6e8b9815d18f548f9c54444adaef17c0a6e
authorJoseph Myers <joseph@codesourcery.com>
Fri, 18 May 2018 17:30:18 +0000 (18 17:30 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 18 May 2018 17:30:18 +0000 (18 17:30 +0000)
treef81a8d93bff75768df72b97e44893d75cf5dc664
parentebc129fd17e8110eb76fb5ebdbb2dc395507ceeb
Split test-tgmath3 by function.

It has been noted that test-tgmath3 is slow to compile, and to link on
some systems
<https://sourceware.org/ml/libc-alpha/2018-02/msg00477.html>, because
of the size of the test.

I'm working on tgmath.h support for the TS 18661-1 / 18661-3 functions
that round their results to a narrower type.  For the functions
already present in glibc, this wouldn't make test-tgmath3 much bigger,
because those functions only have two arguments.  For the narrowing
versions of fma (for which I've not yet added the functions to glibc),
however, it would result in many configurations building tests of the
type-generic macros f32fma, f64fma, f32xfma, f64xfma, each with 21
possible types for each of three arguments (float, double, long double
aren't valid argument types for these macros when they return a
_FloatN / _FloatNx type), so substantially increasing the size of the
testcase.

To avoid further increasing the size of a single test when adding the
type-generic narrowing fma macros, this patch arranges for the
test-tgmath3 tests to be run separately for each function tested.  The
fma tests are still by far the largest (next is pow, as that has two
arguments that can be real or complex; after that, the two-argument
real-only functions), but each type-generic fma macro for a different
return type would end up with its tests being run separately, rather
than increasing the size of a single test.

To avoid accidentally missing testing a macro because
gen-tgmath-tests.py supports testing it but the makefile fails to call
it for that function, a test is also added that verifies that the
lists of macros in the makefile and gen-tgmath-tests.py agree.

Tested for x86_64.

* math/gen-tgmath-tests.py: Import sys.
(Tests.__init__): Initialize macros_seen.
(Tests.add_tests): Add macro to macros_seen.  Only generate tests
if requested to do so for this macro.
(Tests.add_all_tests): Take argument for macro for which to
generate tests.
(Tests.check_macro_list): New function.
(main): Handle check-list argument and argument specifying macro
for which to generate tests.
* math/Makefile [PYTHON] (tgmath3-macros): New variable.
[PYTHON] (tgmath3-macro-tests): Likewise.
[PYTHON] (tests): Add $(tgmath3-macro-tests) not test-tgmath3.
[PYTHON] (generated): Add $(addsuffix .c,$(tgmath3-macro-tests))
not test-tgmath3.c.
[PYTHON] (CFLAGS-test-tgmath3.c): Remove.
[PYTHON] ($(tgmath3-macro-tests:%=$(objpfx)%.o): Add -fno-builtin
to CFLAGS.
[PYTHON] ($(objpfx)test-tgmath3.c): Replace rule by....
[PYTHON] ($(foreach
m,$(tgmath3-macros),$(objpfx)test-tgmath3-$(m).c): ... this.  New
rule.
[PYTHON] (tests-special): Add
$(objpfx)test-tgmath3-macro-list.out.
[PYTHON] ($(objpfx)test-tgmath3-macro-list.out): New rule.
ChangeLog
math/Makefile
math/gen-tgmath-tests.py