glibc/math/README.libm-test

168 lines
7.8 KiB
Plaintext
Raw Normal View History

README for libm-test math test suite
====================================
The libm-test math test suite tests a number of function points of
math functions in the GNU C library. The following sections contain a
Replace gen-libm-test.pl with gen-libm-test.py. Following the recent discussion of using Python instead of Perl and Awk for glibc build / test, this patch replaces gen-libm-test.pl with a new gen-libm-test.py script. This script should work with all Python versions supported by glibc (tested by hand with Python 2.7, tested in the build system with Python 3.5; configure prefers Python 3 if available). This script is designed to give identical output to gen-libm-test.pl for ease of verification of the change, except for generated comments referring to .py instead of .pl. (That is, identical for actual inputs passed to the script, not necessarily for all possible input; for example, this version more precisely follows the C standard syntax for floating-point constants when deciding when to add LIT macro calls.) In one place a comment notes that the generation of NON_FINITE flags is replicating a bug in the Perl script to assist in such comparisons (with the expectation that this bug can then be separately fixed in the Python script later). Tested for x86_64, including comparison of generated files (and hand testing of the case of generating a sorted libm-test-ulps file, which isn't covered by normal "make check"). I'd expect to follow this up by extending the new script to produce the ulps tables for the manual as well (replacing manual/libm-err-tab.pl, so that then we just have one ulps file parser) - at which point the manual build would depend on both Perl and Python (eliminating the Perl dependency would require someone to rewrite summary.pl in Python, and that would only eliminate the *direct* Perl dependency; current makeinfo is written in Perl so there would still be an indirect dependency). I think install.texi is more or less equally out-of-date regarding Perl and Python uses before and after this patch, so I don't think this patch depends on my patch <https://sourceware.org/ml/libc-alpha/2018-08/msg00133.html> to update install.texi regarding such uses (pending review). * math/gen-libm-test.py: New file. * math/gen-libm-test.pl: Remove. * math/Makefile [$(PERL) != no]: Change condition to [PYTHON]. ($(objpfx)libm-test-ulps.h): Use gen-libm-test.py instead of gen-libm-test.pl. ($(libm-test-c-noauto-obj)): Likewise. ($(libm-test-c-auto-obj)): Likewise. ($(libm-test-c-narrow-obj)): Likewise. (regen-ulps): Likewise. * math/README.libm-test: Update references to gen-libm-test.pl. * math/libm-test-driver.c (struct test_fj_f_data): Update comment referencing gen-libm-test.pl. * math/libm-test-nexttoward.inc (nexttoward_test_data): Likewise. * math/libm-test-support.c: Likewise. * math/libm-test-support.h: Likewise. * sysdeps/generic/libm-test-ulps: Likewise.
2018-08-09 15:34:12 +00:00
brief overview. Please note that the test drivers and the Python
script "gen-libm-test.py" have some options. A full list of options
is available with --help (for the test drivers) and -h for
"gen-libm-test.py".
What is tested?
===============
The tests just evaluate the functions at specified points and compare
the results with precomputed values and the requirements of the ISO
C99 standard.
Besides testing the special values mandated by IEEE 754 (infinities,
NaNs and minus zero), some more or less random values are tested.
Files that are part of libm-test
================================
Split libm-test.inc by function. Continuing the process of splitting up libm tests into more reasonably sized units, this patch splits libm-test.inc into 121 separate libm-test-<function>.inc files, one per array of test data. (There are 126 libm *_test functions, but five of those are for functions that are aliases for test purposes and so share arrays of test data.) In the present patch, the 121 files get processed separately by gen-libm-test.pl, each using only the auto-libm-test-out-<function> file that is relevant (/dev/null for functions not using auto-libm-test-* at all). This effectively eliminates the serialization on running gen-libm-test.pl. However, the resulting .c files still all get #included together, so compiling the limited number of libm tests using libm-test.inc may still act as a serialization point (the compilations still all have 40 MB of code to process). libm-test.inc doesn't actually have anything in it any more that needs gen-libm-test.pl processing, but is left as a .inc file that gets processed to produce a .c file, rather than being renamed, since the intent of this patch is as an intermediate step before libm-test.inc gets removed and tests get compiled separately for each function being tested. Tested for x86_64. * math/libm-test.inc: Move all tests of individual functions to libm-test-*.inc and #include libm-test-*.c files. (acos_test_data): Remove. (acos_test): Likewise. (acosh_test_data): Likewise. (acosh_test): Likewise. (asin_test_data): Likewise. (asin_test): Likewise. (asinh_test_data): Likewise. (asinh_test): Likewise. (atan_test_data): Likewise. (atan_test): Likewise. (atanh_test_data): Likewise. (atanh_test): Likewise. (atan2_test_data): Likewise. (atan2_test): Likewise. (cabs_test_data): Likewise. (cabs_test): Likewise. (cacos_test_data): Likewise. (cacos_test): Likewise. (cacosh_test_data): Likewise. (cacosh_test): Likewise. (canonicalize_test_data): Likewise. (canonicalize_test): Likewise. (carg_test_data): Likewise. (carg_test): Likewise. (casin_test_data): Likewise. (casin_test): Likewise. (casinh_test_data): Likewise. (casinh_test): Likewise. (catan_test_data): Likewise. (catan_test): Likewise. (catanh_test_data): Likewise. (catanh_test): Likewise. (cbrt_test_data): Likewise. (cbrt_test): Likewise. (ccos_test_data): Likewise. (ccos_test): Likewise. (ccosh_test_data): Likewise. (ccosh_test): Likewise. (ceil_test_data): Likewise. (ceil_test): Likewise. (cexp_test_data): Likewise. (cexp_test): Likewise. (cimag_test_data): Likewise. (cimag_test): Likewise. (clog_test_data): Likewise. (clog_test): Likewise. (clog10_test_data): Likewise. (clog10_test): Likewise. (conj_test_data): Likewise. (conj_test): Likewise. (copysign_test_data): Likewise. (copysign_test): Likewise. (cos_test_data): Likewise. (cos_test): Likewise. (cosh_test_data): Likewise. (cosh_test): Likewise. (cpow_test_data): Likewise. (cpow_test): Likewise. (cproj_test_data): Likewise. (cproj_test): Likewise. (creal_test_data): Likewise. (creal_test): Likewise. (csin_test_data): Likewise. (csin_test): Likewise. (csinh_test_data): Likewise. (csinh_test): Likewise. (csqrt_test_data): Likewise. (csqrt_test): Likewise. (ctan_test_data): Likewise. (ctan_test): Likewise. (ctanh_test_data): Likewise. (ctanh_test): Likewise. (erf_test_data): Likewise. (erf_test): Likewise. (erfc_test_data): Likewise. (erfc_test): Likewise. (exp_test_data): Likewise. (exp_test): Likewise. (exp10_test_data): Likewise. (exp10_test): Likewise. (pow10_test): Likewise. (exp2_test_data): Likewise. (exp2_test): Likewise. (expm1_test_data): Likewise. (expm1_test): Likewise. (fabs_test_data): Likewise. (fabs_test): Likewise. (fdim_test_data): Likewise. (fdim_test): Likewise. (floor_test_data): Likewise. (floor_test): Likewise. (fma_test_data): Likewise. (fma_test): Likewise. (fmax_test_data): Likewise. (fmax_test): Likewise. (fmaxmag_test_data): Likewise. (fmaxmag_test): Likewise. (fmin_test_data): Likewise. (fmin_test): Likewise. (fminmag_test_data): Likewise. (fminmag_test): Likewise. (fmod_test_data): Likewise. (fmod_test): Likewise. (fpclassify_test_data): Likewise. (fpclassify_test): Likewise. (frexp_test_data): Likewise. (frexp_test): Likewise. (fromfp_test_data): Likewise. (fromfp_test): Likewise. (fromfpx_test_data): Likewise. (fromfpx_test): Likewise. (getpayload_test_data): Likewise. (getpayload_test): Likewise. (hypot_test_data): Likewise. (hypot_test): Likewise. (ilogb_test_data): Likewise. (ilogb_test): Likewise. (iscanonical_test_data): Likewise. (iscanonical_test): Likewise. (iseqsig_test_data): Likewise. (iseqsig_test): Likewise. (isfinite_test_data): Likewise. (isfinite_test): Likewise. (finite_test): Likewise. (isgreater_test_data): Likewise. (isgreater_test): Likewise. (isgreaterequal_test_data): Likewise. (isgreaterequal_test): Likewise. (isinf_test_data): Likewise. (isinf_test): Likewise. (isless_test_data): Likewise. (isless_test): Likewise. (islessequal_test_data): Likewise. (islessequal_test): Likewise. (islessgreater_test_data): Likewise. (islessgreater_test): Likewise. (isnan_test_data): Likewise. (isnan_test): Likewise. (isnormal_test_data): Likewise. (isnormal_test): Likewise. (issignaling_test_data): Likewise. (issignaling_test): Likewise. (issubnormal_test_data): Likewise. (issubnormal_test): Likewise. (isunordered_test_data): Likewise. (isunordered_test): Likewise. (iszero_test_data): Likewise. (iszero_test): Likewise. (j0_test_data): Likewise. (j0_test): Likewise. (j1_test_data): Likewise. (j1_test): Likewise. (jn_test_data): Likewise. (jn_test): Likewise. (lgamma_test_data): Likewise. (lgamma_test): Likewise. (gamma_test): Likewise. (llogb_test_data): Likewise. (llogb_test): Likewise. (lrint_test_data): Likewise. (lrint_test): Likewise. (llrint_test_data): Likewise. (llrint_test): Likewise. (log_test_data): Likewise. (log_test): Likewise. (log10_test_data): Likewise. (log10_test): Likewise. (log1p_test_data): Likewise. (log1p_test): Likewise. (log2_test_data): Likewise. (log2_test): Likewise. (logb_test_data): Likewise. (logb_test): Likewise. (lround_test_data): Likewise. (lround_test): Likewise. (llround_test_data): Likewise. (llround_test): Likewise. (modf_test_data): Likewise. (modf_test): Likewise. (nearbyint_test_data): Likewise. (nearbyint_test): Likewise. (nextafter_test_data): Likewise. (nextafter_test): Likewise. (nextup_test_data): Likewise. (nextup_test): Likewise. (nextdown_test_data): Likewise. (nextdown_test): Likewise. (nexttoward_test_data): Likewise. (nexttoward_test): Likewise. (pow_test_data): Likewise. (pow_test): Likewise. (remainder_test_data): Likewise. (remainder_test): Likewise. (drem_test): Likewise. (remquo_test_data): Likewise. (remquo_test): Likewise. (rint_test_data): Likewise. (rint_test): Likewise. (round_test_data): Likewise. (round_test): Likewise. (roundeven_test_data): Likewise. (roundeven_test): Likewise. (scalb_test_data): Likewise. (scalb_test): Likewise. (scalbn_test_data): Likewise. (scalbn_test): Likewise. (ldexp_test): Likewise. (scalbln_test_data): Likewise. (scalbln_test): Likewise. (setpayload_test_data): Likewise. (setpayload_test): Likewise. (setpayloadsig_test_data): Likewise. (setpayloadsig_test): Likewise. (signbit_test_data): Likewise. (signbit_test): Likewise. (sin_test_data): Likewise. (sin_test): Likewise. (sincos_test_data): Likewise. (sincos_test): Likewise. (sinh_test_data): Likewise. (sinh_test): Likewise. (sqrt_test_data): Likewise. (sqrt_test): Likewise. (tan_test_data): Likewise. (tan_test): Likewise. (tanh_test_data): Likewise. (tanh_test): Likewise. (tgamma_test_data): Likewise. (tgamma_test): Likewise. (totalorder_test_data): Likewise. (totalorder_test): Likewise. (totalordermag_test_data): Likewise. (totalordermag_test): Likewise. (trunc_test_data): Likewise. (trunc_test): Likewise. (ufromfp_test_data): Likewise. (ufromfp_test): Likewise. (ufromfpx_test_data): Likewise. (ufromfpx_test): Likewise. (y0_test_data): Likewise. (y0_test): Likewise. (y1_test_data): Likewise. (y1_test): Likewise. (yn_test_data): Likewise. (yn_test): Likewise. (significand_test_data): Likewise. (significand_test): Likewise. * math/Makefile (auto-libm-test-out-files): Remove variable. (libm-test-funcs-noauto): New variable. (libm-test-funcs-all): Likewise. (libm-test-c-auto): Likewise. (libm-test-c-noauto): Likewise. (libm-tests-generated): Add $(libm-test-c-auto) and $(libm-test-c-noauto). (generated): Do not add auto-libm-test-out. (libm-test-c-auto-obj): New variable. (libm-test-c-noauto-obj): Likewise. ($(objpfx)libm-test.c): Do not generate or use auto-libm-test-out. ($(libm-test-c-noauto-obj)): New static pattern rule. ($(libm-test-c-auto-obj)): Likewise. (libm-test-incs): New variable. ($(objpfx)libm-have-vector-test.h): Depend on $(libm-test-incs) and pass it to gen-libm-have-vector-test.sh. * math/gen-libm-have-vector-test.sh: Expect list of .inc files to be passed on command line. * math/libm-test-acos.inc: New file. Content from math/libm-test.inc. * math/libm-test-acosh.inc: Likewise. * math/libm-test-asin.inc: Likewise. * math/libm-test-asinh.inc: Likewise. * math/libm-test-atan.inc: Likewise. * math/libm-test-atan2.inc: Likewise. * math/libm-test-atanh.inc: Likewise. * math/libm-test-cabs.inc: Likewise. * math/libm-test-cacos.inc: Likewise. * math/libm-test-cacosh.inc: Likewise. * math/libm-test-canonicalize.inc: Likewise. * math/libm-test-carg.inc: Likewise. * math/libm-test-casin.inc: Likewise. * math/libm-test-casinh.inc: Likewise. * math/libm-test-catan.inc: Likewise. * math/libm-test-catanh.inc: Likewise. * math/libm-test-cbrt.inc: Likewise. * math/libm-test-ccos.inc: Likewise. * math/libm-test-ccosh.inc: Likewise. * math/libm-test-ceil.inc: Likewise. * math/libm-test-cexp.inc: Likewise. * math/libm-test-cimag.inc: Likewise. * math/libm-test-clog.inc: Likewise. * math/libm-test-clog10.inc: Likewise. * math/libm-test-conj.inc: Likewise. * math/libm-test-copysign.inc: Likewise. * math/libm-test-cos.inc: Likewise. * math/libm-test-cosh.inc: Likewise. * math/libm-test-cpow.inc: Likewise. * math/libm-test-cproj.inc: Likewise. * math/libm-test-creal.inc: Likewise. * math/libm-test-csin.inc: Likewise. * math/libm-test-csinh.inc: Likewise. * math/libm-test-csqrt.inc: Likewise. * math/libm-test-ctan.inc: Likewise. * math/libm-test-ctanh.inc: Likewise. * math/libm-test-erf.inc: Likewise. * math/libm-test-erfc.inc: Likewise. * math/libm-test-exp.inc: Likewise. * math/libm-test-exp10.inc: Likewise. * math/libm-test-exp2.inc: Likewise. * math/libm-test-expm1.inc: Likewise. * math/libm-test-fabs.inc: Likewise. * math/libm-test-fdim.inc: Likewise. * math/libm-test-floor.inc: Likewise. * math/libm-test-fma.inc: Likewise. * math/libm-test-fmax.inc: Likewise. * math/libm-test-fmaxmag.inc: Likewise. * math/libm-test-fmin.inc: Likewise. * math/libm-test-fminmag.inc: Likewise. * math/libm-test-fmod.inc: Likewise. * math/libm-test-fpclassify.inc: Likewise. * math/libm-test-frexp.inc: Likewise. * math/libm-test-fromfp.inc: Likewise. * math/libm-test-fromfpx.inc: Likewise. * math/libm-test-getpayload.inc: Likewise. * math/libm-test-hypot.inc: Likewise. * math/libm-test-ilogb.inc: Likewise. * math/libm-test-iscanonical.inc: Likewise. * math/libm-test-iseqsig.inc: Likewise. * math/libm-test-isfinite.inc: Likewise. * math/libm-test-isgreater.inc: Likewise. * math/libm-test-isgreaterequal.inc: Likewise. * math/libm-test-isinf.inc: Likewise. * math/libm-test-isless.inc: Likewise. * math/libm-test-islessequal.inc: Likewise. * math/libm-test-islessgreater.inc: Likewise. * math/libm-test-isnan.inc: Likewise. * math/libm-test-isnormal.inc: Likewise. * math/libm-test-issignaling.inc: Likewise. * math/libm-test-issubnormal.inc: Likewise. * math/libm-test-isunordered.inc: Likewise. * math/libm-test-iszero.inc: Likewise. * math/libm-test-j0.inc: Likewise. * math/libm-test-j1.inc: Likewise. * math/libm-test-jn.inc: Likewise. * math/libm-test-lgamma.inc: Likewise. * math/libm-test-llogb.inc: Likewise. * math/libm-test-llrint.inc: Likewise. * math/libm-test-llround.inc: Likewise. * math/libm-test-log.inc: Likewise. * math/libm-test-log10.inc: Likewise. * math/libm-test-log1p.inc: Likewise. * math/libm-test-log2.inc: Likewise. * math/libm-test-logb.inc: Likewise. * math/libm-test-lrint.inc: Likewise. * math/libm-test-lround.inc: Likewise. * math/libm-test-modf.inc: Likewise. * math/libm-test-nearbyint.inc: Likewise. * math/libm-test-nextafter.inc: Likewise. * math/libm-test-nextdown.inc: Likewise. * math/libm-test-nexttoward.inc: Likewise. * math/libm-test-nextup.inc: Likewise. * math/libm-test-pow.inc: Likewise. * math/libm-test-remainder.inc: Likewise. * math/libm-test-remquo.inc: Likewise. * math/libm-test-rint.inc: Likewise. * math/libm-test-round.inc: Likewise. * math/libm-test-roundeven.inc: Likewise. * math/libm-test-scalb.inc: Likewise. * math/libm-test-scalbln.inc: Likewise. * math/libm-test-scalbn.inc: Likewise. * math/libm-test-setpayload.inc: Likewise. * math/libm-test-setpayloadsig.inc: Likewise. * math/libm-test-signbit.inc: Likewise. * math/libm-test-significand.inc: Likewise. * math/libm-test-sin.inc: Likewise. * math/libm-test-sincos.inc: Likewise. * math/libm-test-sinh.inc: Likewise. * math/libm-test-sqrt.inc: Likewise. * math/libm-test-tan.inc: Likewise. * math/libm-test-tanh.inc: Likewise. * math/libm-test-tgamma.inc: Likewise. * math/libm-test-totalorder.inc: Likewise. * math/libm-test-totalordermag.inc: Likewise. * math/libm-test-trunc.inc: Likewise. * math/libm-test-ufromfp.inc: Likewise. * math/libm-test-ufromfpx.inc: Likewise. * math/libm-test-y0.inc: Likewise. * math/libm-test-y1.inc: Likewise. * math/libm-test-yn.inc: Likewise. * math/README.libm-test: Update.
2017-02-06 18:57:25 +00:00
The main files are "libm-test-<func>.inc". They are independent of
the target platform and the specific real floating type and format and
contain placeholder test "templates" for math functions defined in
libm. These files, along with generated files named
Replace gen-libm-test.pl with gen-libm-test.py. Following the recent discussion of using Python instead of Perl and Awk for glibc build / test, this patch replaces gen-libm-test.pl with a new gen-libm-test.py script. This script should work with all Python versions supported by glibc (tested by hand with Python 2.7, tested in the build system with Python 3.5; configure prefers Python 3 if available). This script is designed to give identical output to gen-libm-test.pl for ease of verification of the change, except for generated comments referring to .py instead of .pl. (That is, identical for actual inputs passed to the script, not necessarily for all possible input; for example, this version more precisely follows the C standard syntax for floating-point constants when deciding when to add LIT macro calls.) In one place a comment notes that the generation of NON_FINITE flags is replicating a bug in the Perl script to assist in such comparisons (with the expectation that this bug can then be separately fixed in the Python script later). Tested for x86_64, including comparison of generated files (and hand testing of the case of generating a sorted libm-test-ulps file, which isn't covered by normal "make check"). I'd expect to follow this up by extending the new script to produce the ulps tables for the manual as well (replacing manual/libm-err-tab.pl, so that then we just have one ulps file parser) - at which point the manual build would depend on both Perl and Python (eliminating the Perl dependency would require someone to rewrite summary.pl in Python, and that would only eliminate the *direct* Perl dependency; current makeinfo is written in Perl so there would still be an indirect dependency). I think install.texi is more or less equally out-of-date regarding Perl and Python uses before and after this patch, so I don't think this patch depends on my patch <https://sourceware.org/ml/libc-alpha/2018-08/msg00133.html> to update install.texi regarding such uses (pending review). * math/gen-libm-test.py: New file. * math/gen-libm-test.pl: Remove. * math/Makefile [$(PERL) != no]: Change condition to [PYTHON]. ($(objpfx)libm-test-ulps.h): Use gen-libm-test.py instead of gen-libm-test.pl. ($(libm-test-c-noauto-obj)): Likewise. ($(libm-test-c-auto-obj)): Likewise. ($(libm-test-c-narrow-obj)): Likewise. (regen-ulps): Likewise. * math/README.libm-test: Update references to gen-libm-test.pl. * math/libm-test-driver.c (struct test_fj_f_data): Update comment referencing gen-libm-test.pl. * math/libm-test-nexttoward.inc (nexttoward_test_data): Likewise. * math/libm-test-support.c: Likewise. * math/libm-test-support.h: Likewise. * sysdeps/generic/libm-test-ulps: Likewise.
2018-08-09 15:34:12 +00:00
"auto-libm-test-out-<func>", are preprocessed by the Python script
"gen-libm-test.py" to expand the templates and produce a set of test
Split libm-test.inc by function. Continuing the process of splitting up libm tests into more reasonably sized units, this patch splits libm-test.inc into 121 separate libm-test-<function>.inc files, one per array of test data. (There are 126 libm *_test functions, but five of those are for functions that are aliases for test purposes and so share arrays of test data.) In the present patch, the 121 files get processed separately by gen-libm-test.pl, each using only the auto-libm-test-out-<function> file that is relevant (/dev/null for functions not using auto-libm-test-* at all). This effectively eliminates the serialization on running gen-libm-test.pl. However, the resulting .c files still all get #included together, so compiling the limited number of libm tests using libm-test.inc may still act as a serialization point (the compilations still all have 40 MB of code to process). libm-test.inc doesn't actually have anything in it any more that needs gen-libm-test.pl processing, but is left as a .inc file that gets processed to produce a .c file, rather than being renamed, since the intent of this patch is as an intermediate step before libm-test.inc gets removed and tests get compiled separately for each function being tested. Tested for x86_64. * math/libm-test.inc: Move all tests of individual functions to libm-test-*.inc and #include libm-test-*.c files. (acos_test_data): Remove. (acos_test): Likewise. (acosh_test_data): Likewise. (acosh_test): Likewise. (asin_test_data): Likewise. (asin_test): Likewise. (asinh_test_data): Likewise. (asinh_test): Likewise. (atan_test_data): Likewise. (atan_test): Likewise. (atanh_test_data): Likewise. (atanh_test): Likewise. (atan2_test_data): Likewise. (atan2_test): Likewise. (cabs_test_data): Likewise. (cabs_test): Likewise. (cacos_test_data): Likewise. (cacos_test): Likewise. (cacosh_test_data): Likewise. (cacosh_test): Likewise. (canonicalize_test_data): Likewise. (canonicalize_test): Likewise. (carg_test_data): Likewise. (carg_test): Likewise. (casin_test_data): Likewise. (casin_test): Likewise. (casinh_test_data): Likewise. (casinh_test): Likewise. (catan_test_data): Likewise. (catan_test): Likewise. (catanh_test_data): Likewise. (catanh_test): Likewise. (cbrt_test_data): Likewise. (cbrt_test): Likewise. (ccos_test_data): Likewise. (ccos_test): Likewise. (ccosh_test_data): Likewise. (ccosh_test): Likewise. (ceil_test_data): Likewise. (ceil_test): Likewise. (cexp_test_data): Likewise. (cexp_test): Likewise. (cimag_test_data): Likewise. (cimag_test): Likewise. (clog_test_data): Likewise. (clog_test): Likewise. (clog10_test_data): Likewise. (clog10_test): Likewise. (conj_test_data): Likewise. (conj_test): Likewise. (copysign_test_data): Likewise. (copysign_test): Likewise. (cos_test_data): Likewise. (cos_test): Likewise. (cosh_test_data): Likewise. (cosh_test): Likewise. (cpow_test_data): Likewise. (cpow_test): Likewise. (cproj_test_data): Likewise. (cproj_test): Likewise. (creal_test_data): Likewise. (creal_test): Likewise. (csin_test_data): Likewise. (csin_test): Likewise. (csinh_test_data): Likewise. (csinh_test): Likewise. (csqrt_test_data): Likewise. (csqrt_test): Likewise. (ctan_test_data): Likewise. (ctan_test): Likewise. (ctanh_test_data): Likewise. (ctanh_test): Likewise. (erf_test_data): Likewise. (erf_test): Likewise. (erfc_test_data): Likewise. (erfc_test): Likewise. (exp_test_data): Likewise. (exp_test): Likewise. (exp10_test_data): Likewise. (exp10_test): Likewise. (pow10_test): Likewise. (exp2_test_data): Likewise. (exp2_test): Likewise. (expm1_test_data): Likewise. (expm1_test): Likewise. (fabs_test_data): Likewise. (fabs_test): Likewise. (fdim_test_data): Likewise. (fdim_test): Likewise. (floor_test_data): Likewise. (floor_test): Likewise. (fma_test_data): Likewise. (fma_test): Likewise. (fmax_test_data): Likewise. (fmax_test): Likewise. (fmaxmag_test_data): Likewise. (fmaxmag_test): Likewise. (fmin_test_data): Likewise. (fmin_test): Likewise. (fminmag_test_data): Likewise. (fminmag_test): Likewise. (fmod_test_data): Likewise. (fmod_test): Likewise. (fpclassify_test_data): Likewise. (fpclassify_test): Likewise. (frexp_test_data): Likewise. (frexp_test): Likewise. (fromfp_test_data): Likewise. (fromfp_test): Likewise. (fromfpx_test_data): Likewise. (fromfpx_test): Likewise. (getpayload_test_data): Likewise. (getpayload_test): Likewise. (hypot_test_data): Likewise. (hypot_test): Likewise. (ilogb_test_data): Likewise. (ilogb_test): Likewise. (iscanonical_test_data): Likewise. (iscanonical_test): Likewise. (iseqsig_test_data): Likewise. (iseqsig_test): Likewise. (isfinite_test_data): Likewise. (isfinite_test): Likewise. (finite_test): Likewise. (isgreater_test_data): Likewise. (isgreater_test): Likewise. (isgreaterequal_test_data): Likewise. (isgreaterequal_test): Likewise. (isinf_test_data): Likewise. (isinf_test): Likewise. (isless_test_data): Likewise. (isless_test): Likewise. (islessequal_test_data): Likewise. (islessequal_test): Likewise. (islessgreater_test_data): Likewise. (islessgreater_test): Likewise. (isnan_test_data): Likewise. (isnan_test): Likewise. (isnormal_test_data): Likewise. (isnormal_test): Likewise. (issignaling_test_data): Likewise. (issignaling_test): Likewise. (issubnormal_test_data): Likewise. (issubnormal_test): Likewise. (isunordered_test_data): Likewise. (isunordered_test): Likewise. (iszero_test_data): Likewise. (iszero_test): Likewise. (j0_test_data): Likewise. (j0_test): Likewise. (j1_test_data): Likewise. (j1_test): Likewise. (jn_test_data): Likewise. (jn_test): Likewise. (lgamma_test_data): Likewise. (lgamma_test): Likewise. (gamma_test): Likewise. (llogb_test_data): Likewise. (llogb_test): Likewise. (lrint_test_data): Likewise. (lrint_test): Likewise. (llrint_test_data): Likewise. (llrint_test): Likewise. (log_test_data): Likewise. (log_test): Likewise. (log10_test_data): Likewise. (log10_test): Likewise. (log1p_test_data): Likewise. (log1p_test): Likewise. (log2_test_data): Likewise. (log2_test): Likewise. (logb_test_data): Likewise. (logb_test): Likewise. (lround_test_data): Likewise. (lround_test): Likewise. (llround_test_data): Likewise. (llround_test): Likewise. (modf_test_data): Likewise. (modf_test): Likewise. (nearbyint_test_data): Likewise. (nearbyint_test): Likewise. (nextafter_test_data): Likewise. (nextafter_test): Likewise. (nextup_test_data): Likewise. (nextup_test): Likewise. (nextdown_test_data): Likewise. (nextdown_test): Likewise. (nexttoward_test_data): Likewise. (nexttoward_test): Likewise. (pow_test_data): Likewise. (pow_test): Likewise. (remainder_test_data): Likewise. (remainder_test): Likewise. (drem_test): Likewise. (remquo_test_data): Likewise. (remquo_test): Likewise. (rint_test_data): Likewise. (rint_test): Likewise. (round_test_data): Likewise. (round_test): Likewise. (roundeven_test_data): Likewise. (roundeven_test): Likewise. (scalb_test_data): Likewise. (scalb_test): Likewise. (scalbn_test_data): Likewise. (scalbn_test): Likewise. (ldexp_test): Likewise. (scalbln_test_data): Likewise. (scalbln_test): Likewise. (setpayload_test_data): Likewise. (setpayload_test): Likewise. (setpayloadsig_test_data): Likewise. (setpayloadsig_test): Likewise. (signbit_test_data): Likewise. (signbit_test): Likewise. (sin_test_data): Likewise. (sin_test): Likewise. (sincos_test_data): Likewise. (sincos_test): Likewise. (sinh_test_data): Likewise. (sinh_test): Likewise. (sqrt_test_data): Likewise. (sqrt_test): Likewise. (tan_test_data): Likewise. (tan_test): Likewise. (tanh_test_data): Likewise. (tanh_test): Likewise. (tgamma_test_data): Likewise. (tgamma_test): Likewise. (totalorder_test_data): Likewise. (totalorder_test): Likewise. (totalordermag_test_data): Likewise. (totalordermag_test): Likewise. (trunc_test_data): Likewise. (trunc_test): Likewise. (ufromfp_test_data): Likewise. (ufromfp_test): Likewise. (ufromfpx_test_data): Likewise. (ufromfpx_test): Likewise. (y0_test_data): Likewise. (y0_test): Likewise. (y1_test_data): Likewise. (y1_test): Likewise. (yn_test_data): Likewise. (yn_test): Likewise. (significand_test_data): Likewise. (significand_test): Likewise. * math/Makefile (auto-libm-test-out-files): Remove variable. (libm-test-funcs-noauto): New variable. (libm-test-funcs-all): Likewise. (libm-test-c-auto): Likewise. (libm-test-c-noauto): Likewise. (libm-tests-generated): Add $(libm-test-c-auto) and $(libm-test-c-noauto). (generated): Do not add auto-libm-test-out. (libm-test-c-auto-obj): New variable. (libm-test-c-noauto-obj): Likewise. ($(objpfx)libm-test.c): Do not generate or use auto-libm-test-out. ($(libm-test-c-noauto-obj)): New static pattern rule. ($(libm-test-c-auto-obj)): Likewise. (libm-test-incs): New variable. ($(objpfx)libm-have-vector-test.h): Depend on $(libm-test-incs) and pass it to gen-libm-have-vector-test.sh. * math/gen-libm-have-vector-test.sh: Expect list of .inc files to be passed on command line. * math/libm-test-acos.inc: New file. Content from math/libm-test.inc. * math/libm-test-acosh.inc: Likewise. * math/libm-test-asin.inc: Likewise. * math/libm-test-asinh.inc: Likewise. * math/libm-test-atan.inc: Likewise. * math/libm-test-atan2.inc: Likewise. * math/libm-test-atanh.inc: Likewise. * math/libm-test-cabs.inc: Likewise. * math/libm-test-cacos.inc: Likewise. * math/libm-test-cacosh.inc: Likewise. * math/libm-test-canonicalize.inc: Likewise. * math/libm-test-carg.inc: Likewise. * math/libm-test-casin.inc: Likewise. * math/libm-test-casinh.inc: Likewise. * math/libm-test-catan.inc: Likewise. * math/libm-test-catanh.inc: Likewise. * math/libm-test-cbrt.inc: Likewise. * math/libm-test-ccos.inc: Likewise. * math/libm-test-ccosh.inc: Likewise. * math/libm-test-ceil.inc: Likewise. * math/libm-test-cexp.inc: Likewise. * math/libm-test-cimag.inc: Likewise. * math/libm-test-clog.inc: Likewise. * math/libm-test-clog10.inc: Likewise. * math/libm-test-conj.inc: Likewise. * math/libm-test-copysign.inc: Likewise. * math/libm-test-cos.inc: Likewise. * math/libm-test-cosh.inc: Likewise. * math/libm-test-cpow.inc: Likewise. * math/libm-test-cproj.inc: Likewise. * math/libm-test-creal.inc: Likewise. * math/libm-test-csin.inc: Likewise. * math/libm-test-csinh.inc: Likewise. * math/libm-test-csqrt.inc: Likewise. * math/libm-test-ctan.inc: Likewise. * math/libm-test-ctanh.inc: Likewise. * math/libm-test-erf.inc: Likewise. * math/libm-test-erfc.inc: Likewise. * math/libm-test-exp.inc: Likewise. * math/libm-test-exp10.inc: Likewise. * math/libm-test-exp2.inc: Likewise. * math/libm-test-expm1.inc: Likewise. * math/libm-test-fabs.inc: Likewise. * math/libm-test-fdim.inc: Likewise. * math/libm-test-floor.inc: Likewise. * math/libm-test-fma.inc: Likewise. * math/libm-test-fmax.inc: Likewise. * math/libm-test-fmaxmag.inc: Likewise. * math/libm-test-fmin.inc: Likewise. * math/libm-test-fminmag.inc: Likewise. * math/libm-test-fmod.inc: Likewise. * math/libm-test-fpclassify.inc: Likewise. * math/libm-test-frexp.inc: Likewise. * math/libm-test-fromfp.inc: Likewise. * math/libm-test-fromfpx.inc: Likewise. * math/libm-test-getpayload.inc: Likewise. * math/libm-test-hypot.inc: Likewise. * math/libm-test-ilogb.inc: Likewise. * math/libm-test-iscanonical.inc: Likewise. * math/libm-test-iseqsig.inc: Likewise. * math/libm-test-isfinite.inc: Likewise. * math/libm-test-isgreater.inc: Likewise. * math/libm-test-isgreaterequal.inc: Likewise. * math/libm-test-isinf.inc: Likewise. * math/libm-test-isless.inc: Likewise. * math/libm-test-islessequal.inc: Likewise. * math/libm-test-islessgreater.inc: Likewise. * math/libm-test-isnan.inc: Likewise. * math/libm-test-isnormal.inc: Likewise. * math/libm-test-issignaling.inc: Likewise. * math/libm-test-issubnormal.inc: Likewise. * math/libm-test-isunordered.inc: Likewise. * math/libm-test-iszero.inc: Likewise. * math/libm-test-j0.inc: Likewise. * math/libm-test-j1.inc: Likewise. * math/libm-test-jn.inc: Likewise. * math/libm-test-lgamma.inc: Likewise. * math/libm-test-llogb.inc: Likewise. * math/libm-test-llrint.inc: Likewise. * math/libm-test-llround.inc: Likewise. * math/libm-test-log.inc: Likewise. * math/libm-test-log10.inc: Likewise. * math/libm-test-log1p.inc: Likewise. * math/libm-test-log2.inc: Likewise. * math/libm-test-logb.inc: Likewise. * math/libm-test-lrint.inc: Likewise. * math/libm-test-lround.inc: Likewise. * math/libm-test-modf.inc: Likewise. * math/libm-test-nearbyint.inc: Likewise. * math/libm-test-nextafter.inc: Likewise. * math/libm-test-nextdown.inc: Likewise. * math/libm-test-nexttoward.inc: Likewise. * math/libm-test-nextup.inc: Likewise. * math/libm-test-pow.inc: Likewise. * math/libm-test-remainder.inc: Likewise. * math/libm-test-remquo.inc: Likewise. * math/libm-test-rint.inc: Likewise. * math/libm-test-round.inc: Likewise. * math/libm-test-roundeven.inc: Likewise. * math/libm-test-scalb.inc: Likewise. * math/libm-test-scalbln.inc: Likewise. * math/libm-test-scalbn.inc: Likewise. * math/libm-test-setpayload.inc: Likewise. * math/libm-test-setpayloadsig.inc: Likewise. * math/libm-test-signbit.inc: Likewise. * math/libm-test-significand.inc: Likewise. * math/libm-test-sin.inc: Likewise. * math/libm-test-sincos.inc: Likewise. * math/libm-test-sinh.inc: Likewise. * math/libm-test-sqrt.inc: Likewise. * math/libm-test-tan.inc: Likewise. * math/libm-test-tanh.inc: Likewise. * math/libm-test-tgamma.inc: Likewise. * math/libm-test-totalorder.inc: Likewise. * math/libm-test-totalordermag.inc: Likewise. * math/libm-test-trunc.inc: Likewise. * math/libm-test-ufromfp.inc: Likewise. * math/libm-test-ufromfpx.inc: Likewise. * math/libm-test-y0.inc: Likewise. * math/libm-test-y1.inc: Likewise. * math/libm-test-yn.inc: Likewise. * math/README.libm-test: Update.
2017-02-06 18:57:25 +00:00
cases for each math function that are specific to the target platform
but still independent of the real floating type. The results of the
processing are "libm-test-<func>.c" and a file "libm-test-ulps.h" with
platform specific deltas by which the actual math function results may
deviate from the expected results and still be considered correct.
Run libm tests separately for each function. At present, libm tests for each function get built into a single executable (for each floating point type, for each of normal / inline / finite-math-only functions, plus vector variants) and run together, resulting in a single PASS or FAIL (for each of those nine variants plus vector variants). Building this executable involves reading over 50 MB of libm-test-*.c sources. This patch arranges for tests of each function to be run separately from the makefiles instead. There are 121 functions being tested for each (type, variant pair) (actually 126, but run as 121 from the Makefile because each of the pairs (exp10, pow10), (isfinite, finite), (lgamma, gamma), (remainder, drem), (scalbn, ldexp), shares a table of test results and so is run together), so 1089 separate tests run from the Makefile, plus 48 vector tests on x86_64 (six functions for eight vector variants). Each test only involves a libm-test-<func>.c file of no more than about 4 MB, rather than all such files taking about 50 MB. With tests run separately, test summaries will indicate which functions actually have problems (of course, those problems may just be out-of-date libm-test-ulps files if the file hasn't been updated for the architecture in question recently). All the .c files for the 1089+48 tests are generated automatically from the Makefiles. Various checked-in boilerplate .c files are removed as no longer needed. CFLAGS definitions for the different kinds of tests are generated using makefile iterators to apply target-specific variable settings. libm-have-vector-test.h is no longer needed; the list of functions to test for each vector type is now in the sysdeps Makefile. This should reduce the amount of boilerplate needed for float128 testing support; test-float128.h will still be needed, but not various .c files or Makefile CFLAGS definitions. The logic for creating dependencies on libm-test-support-*.o files should also render <https://sourceware.org/ml/libc-alpha/2017-02/msg00279.html> unnecessary. Tested for x86_64 and x86. * math/Makefile (libm-tests-generated): Remove variable. (libm-tests-base-normal): New variable. (libm-tests-base-finite): Likewise. (libm-tests-base-inline): Likewise. (libm-tests-base): Likewise. (libm-tests-normal): Likewise. (libm-tests-finite): Likewise. (libm-tests-inline): Likewise. (libm-tests-vector): Likewise. (libm-tests): Define in terms of these new variables. (libm-tests-for-type): New variable. (libm-tests.o): Move definition. (tests): Move addition of $(libm-tests). (generated): Update for new and removed libm test files. ($(objpfx)libm-test.c): Remove target. ($(objpfx)libm-have-vector-test.h): Likewise. (CFLAGS-test-double-vlen2.c): Remove variable. (CFLAGS-test-double-vlen4.c): Likewise. (CFLAGS-test-double-vlen8.c): Likewise. (CFLAGS-test-float-vlen4.c): Likewise. (CFLAGS-test-float-vlen8.c): Likewise. (CFLAGS-test-float-vlen16.c): Likewise. (CFLAGS-test-float.c): Likewise. (CFLAGS-test-float-finite.c): Likewise. (CFLAGS-libm-test-support-float.c): Likewise. (CFLAGS-test-double.c): Likewise. (CFLAGS-test-double-finite.c): Likewise. (CFLAGS-libm-test-support-double.c): Likewise. (CFLAGS-test-ldouble.c): Likewise. (CFLAGS-test-ldouble-finite.c): Likewise. (CFLAGS-libm-test-support-ldouble.c): Likewise. (libm-test-inline-cflags): New variable. (CFLAGS-test-ifloat.c): Remove variable. (CFLAGS-test-idouble.c): Likewise. (CFLAGS-test-ildouble.c): Likewise. ($(addprefix $(objpfx), $(libm-tests.o))): Move target and update dependencies. ($(foreach t,$(libm-tests-normal),$(objpfx)$(t).c)): New rule. ($(foreach t,$(libm-tests-finite),$(objpfx)$(t).c)): Likewise. ($(foreach t,$(libm-tests-inline),$(objpfx)$(t).c)): Likewise. ($(foreach t,$(libm-tests-vector),$(objpfx)$(t).c)): Likewise. ($(foreach t,$(types),$(objpfx)libm-test-support-$(t).c)): Likewise. (dependencies on libm-test-support-*.o): Remove. ($(foreach f,$(libm-test-funcs-all),$(objpfx)$(o)-$(f).o)): New rules using iterators. ($(addprefix $(objpfx),$(call libm-tests-for-type,$(o)))): Likewise. ($(objpfx)libm-test-support-$(o).o): Likewise. ($(addprefix $(objpfx),$(filter-out $(tests-static) $(libm-vec-tests),$(tests)))): Filter out $(libm-tests-vector) instead. ($(addprefix $(objpfx), $(libm-vec-tests))): Use iterator to define rule instead. * math/README.libm-test: Update. * math/libm-test-acos.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-acosh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-asin.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-asinh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-atan.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-atan2.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-atanh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-cabs.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-cacos.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-cacosh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-canonicalize.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-carg.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-casin.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-casinh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-catan.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-catanh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-cbrt.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-ccos.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-ccosh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-ceil.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-cexp.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-cimag.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-clog.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-clog10.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-conj.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-copysign.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-cos.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-cosh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-cpow.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-cproj.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-creal.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-csin.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-csinh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-csqrt.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-ctan.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-ctanh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-erf.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-erfc.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-exp.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-exp10.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-exp2.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-expm1.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-fabs.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-fdim.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-floor.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-fma.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-fmax.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-fmaxmag.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-fmin.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-fminmag.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-fmod.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-fpclassify.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-frexp.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-fromfp.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-fromfpx.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-getpayload.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-hypot.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-ilogb.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-iscanonical.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-iseqsig.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-isfinite.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-isgreater.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-isgreaterequal.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-isinf.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-isless.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-islessequal.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-islessgreater.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-isnan.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-isnormal.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-issignaling.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-issubnormal.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-isunordered.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-iszero.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-j0.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-j1.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-jn.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-lgamma.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-llogb.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-llrint.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-llround.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-log.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-log10.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-log1p.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-log2.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-logb.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-lrint.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-lround.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-modf.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-nearbyint.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-nextafter.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-nextdown.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-nexttoward.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-nextup.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-pow.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-remainder.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-remquo.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-rint.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-round.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-roundeven.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-scalb.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-scalbln.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-scalbn.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-setpayload.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-setpayloadsig.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-signbit.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-significand.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-sin.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-sincos.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-sinh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-sqrt.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-tan.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-tanh.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-tgamma.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-totalorder.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-totalordermag.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-trunc.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-ufromfp.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-ufromfpx.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-y0.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-y1.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-yn.inc: Include libm-test-driver.c. (do_test): New function. * math/libm-test-driver.c: Do not include libm-have-vector-test.h. (HAVE_VECTOR): Remove macro. (START): Do not call HAVE_VECTOR. * math/test-double-vlen2.h (FUNC_TEST): Remove macro. * math/test-double-vlen4.h (FUNC_TEST): Remove macro. * math/test-double-vlen8.h (FUNC_TEST): Remove macro. * math/test-float-vlen16.h (FUNC_TEST): Remove macro. * math/test-float-vlen4.h (FUNC_TEST): Remove macro. * math/test-float-vlen8.h (FUNC_TEST): Remove macro. * math/test-math-vector.h (FUNC_TEST): New macro. (WRAPPER_DECL): Rename to WRAPPER_DECL_f. * sysdeps/x86_64/fpu/Makefile (double-vlen2-funcs): New variable. (double-vlen4-funcs): Likewise. (double-vlen4-avx2-funcs): Likewise. (double-vlen8-funcs): Likewise. (float-vlen4-funcs): Likewise. (float-vlen8-funcs): Likewise. (float-vlen8-avx2-funcs): Likewise. (float-vlen16-funcs): Likewise. (CFLAGS-test-double-vlen4-avx2.c): Remove variable. (CFLAGS-test-float-vlen8-avx2.c): Likewise. * sysdeps/x86_64/fpu/test-double-vlen4.h (TEST_VECTOR_cos): Remove macro. (TEST_VECTOR_sin): Likewise. (TEST_VECTOR_sincos): Likewise. (TEST_VECTOR_log): Likewise. (TEST_VECTOR_exp): Likewise. (TEST_VECTOR_pow): Likewise. * sysdeps/x86_64/fpu/test-double-vlen8.h (TEST_VECTOR_cos): Likewise. (TEST_VECTOR_sin): Likewise. (TEST_VECTOR_sincos): Likewise. (TEST_VECTOR_log): Likewise. (TEST_VECTOR_exp): Likewise. (TEST_VECTOR_pow): Likewise. * sysdeps/x86_64/fpu/test-float-vlen16.h (TEST_VECTOR_cosf): Likewise. (TEST_VECTOR_sinf): Likewise. (TEST_VECTOR_sincosf): Likewise. (TEST_VECTOR_logf): Likewise. (TEST_VECTOR_expf): Likewise. (TEST_VECTOR_powf): Likewise. * sysdeps/x86_64/fpu/test-float-vlen8.h (TEST_VECTOR_cosf): Likewise. (TEST_VECTOR_sinf): Likewise. (TEST_VECTOR_sincosf): Likewise. (TEST_VECTOR_logf): Likewise. (TEST_VECTOR_expf): Likewise. (TEST_VECTOR_powf): Likewise. * math/gen-libm-have-vector-test.sh: Remove file. * math/libm-test.inc: Likewise. * math/libm-test-support-double.c: Likewise. * math/libm-test-support-float.c: Likewise. * math/libm-test-support-ldouble.c: Likewise. * math/test-double-finite.c: Likewise.: Likewise. * math/test-double.c: Likewise. * math/test-float-finite.c: Likewise. * math/test-float.c: Likewise. * math/test-idouble.c: Likewise. * math/test-ifloat.c: Likewise. * math/test-ildouble.c: Likewise. * math/test-ldouble-finite.c: Likewise. * math/test-ldouble.c: Likewise. * sysdeps/x86_64/fpu/test-double-vlen2.c: Likewise. * sysdeps/x86_64/fpu/test-double-vlen2.h: Likewise. * sysdeps/x86_64/fpu/test-double-vlen4-avx2.c: Likewise. * sysdeps/x86_64/fpu/test-double-vlen4.c: Likewise. * sysdeps/x86_64/fpu/test-double-vlen8.c: Likewise. * sysdeps/x86_64/fpu/test-float-vlen16.c: Likewise. * sysdeps/x86_64/fpu/test-float-vlen4.c: Likewise. * sysdeps/x86_64/fpu/test-float-vlen4.h: Likewise. * sysdeps/x86_64/fpu/test-float-vlen8-avx2.c: Likewise. * sysdeps/x86_64/fpu/test-float-vlen8.c: Likewise.
2017-02-24 00:51:45 +00:00
The test drivers "test-double-<func>.c", "test-float-<func>.c", and
"test-ldouble-<func>.c", generated by the Makefile, test the normal
double, float and long double implementation of libm. The test
drivers with an 'i' in their name ("test-idouble-<func>.c",
"test-ifloat-<func>.c", and "test-ildoubl-<func>.c") test the
corresponding inline functions (where available - otherwise they also
test the real functions in libm). Each driver selects the desired
real floating type to exercise the math functions to test with (float,
double, or long double) by defining a small set of macros just before
including the generic "libm-test.c" file. Each driver also either
defines or undefines the __NO_MATH_INLINES macro just before including
"libm-test-<func>.c" to select either the real or inline functions,
respectively. Each driver is compiled into a single executable test
program with the corresponding name.
Replace gen-libm-test.pl with gen-libm-test.py. Following the recent discussion of using Python instead of Perl and Awk for glibc build / test, this patch replaces gen-libm-test.pl with a new gen-libm-test.py script. This script should work with all Python versions supported by glibc (tested by hand with Python 2.7, tested in the build system with Python 3.5; configure prefers Python 3 if available). This script is designed to give identical output to gen-libm-test.pl for ease of verification of the change, except for generated comments referring to .py instead of .pl. (That is, identical for actual inputs passed to the script, not necessarily for all possible input; for example, this version more precisely follows the C standard syntax for floating-point constants when deciding when to add LIT macro calls.) In one place a comment notes that the generation of NON_FINITE flags is replicating a bug in the Perl script to assist in such comparisons (with the expectation that this bug can then be separately fixed in the Python script later). Tested for x86_64, including comparison of generated files (and hand testing of the case of generating a sorted libm-test-ulps file, which isn't covered by normal "make check"). I'd expect to follow this up by extending the new script to produce the ulps tables for the manual as well (replacing manual/libm-err-tab.pl, so that then we just have one ulps file parser) - at which point the manual build would depend on both Perl and Python (eliminating the Perl dependency would require someone to rewrite summary.pl in Python, and that would only eliminate the *direct* Perl dependency; current makeinfo is written in Perl so there would still be an indirect dependency). I think install.texi is more or less equally out-of-date regarding Perl and Python uses before and after this patch, so I don't think this patch depends on my patch <https://sourceware.org/ml/libc-alpha/2018-08/msg00133.html> to update install.texi regarding such uses (pending review). * math/gen-libm-test.py: New file. * math/gen-libm-test.pl: Remove. * math/Makefile [$(PERL) != no]: Change condition to [PYTHON]. ($(objpfx)libm-test-ulps.h): Use gen-libm-test.py instead of gen-libm-test.pl. ($(libm-test-c-noauto-obj)): Likewise. ($(libm-test-c-auto-obj)): Likewise. ($(libm-test-c-narrow-obj)): Likewise. (regen-ulps): Likewise. * math/README.libm-test: Update references to gen-libm-test.pl. * math/libm-test-driver.c (struct test_fj_f_data): Update comment referencing gen-libm-test.pl. * math/libm-test-nexttoward.inc (nexttoward_test_data): Likewise. * math/libm-test-support.c: Likewise. * math/libm-test-support.h: Likewise. * sysdeps/generic/libm-test-ulps: Likewise.
2018-08-09 15:34:12 +00:00
As mentioned above, the "gen-libm-test.py" script looks for a file
named "libm-test-ulps" in the platform specific sysdep directory (or
its fpu or nofpu subdirectory) and for each variant (real floating
type and rounding mode) of every tested function reads from it the
maximum difference expressed as Units of Least Precision (ULP) the
actual result of the function may deviate from the expected result
before it's considered incorrect.
Split auto-libm-test-out by function. 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.
2017-02-06 18:41:20 +00:00
The "auto-libm-test-out-<func>" files contain sets of test cases to
exercise, the conditions under which to exercise each, and the
expected results. The files are generated by the
"gen-auto-libm-tests" program from the "auto-libm-test-in" file. See
the comments in gen-auto-libm-tests.c for details about the content
and format of the -in and -out files.
How can I generate "libm-test-ulps"?
====================================
New Makefile target `regen-ulps'. The wiki "Regeneration" page has this to say about update ULPs. "The libm-test-ulps files are semiautomatically updated. To update an ulps baseline, run each of the failing tests (test-float, test-double, etc.) with -u; this will generate a file called ULPs; concatenate each of those files with the existing libm-test-ulps file, after removing any entries for particularly huge numbers of ulps that you do not want to mark as expected. Then run gen-libm-test.pl -n -u FILE where FILE is the concatenated file produced in the previous step. This generates a file called NewUlps which is the new sorted version of libm-test-ulps." The same information is listed in math/README.libm-test, and is a lot of manual work that you often want to run over-and-over again while working on a particular test. The `regen-ulps' convenience target does this automatically for developers. We strictly assume the source tree is readonly and add a new --output-dir option to libm-test.inc to allow for writing out ULPs to $(objpfx). When run the new target does the following: * Starts with the baseline ULPs file. * Runs each of the libm math tests with -u. * Adds new changes seen with -u to the baseline. * Sorts and prepares the test output with gen-libm-test.pl. * Leaves math/NewUlps in your build tree to copy to your source tree, cleanup, and checkin. The math test documentation in math/README.libm-test is updated document the new Makefile target. --- 2013-04-06 Carlos O'Donell <carlos@redhat.com> * Makefile.in (regen-ulps): New target. * math/Makefile [ifneq (no,$(PERL)]: Declare regen-ulps with .PHONY. [ifneq (no,$(PERL)] (run-regen-ulps): New variable. [ifneq (no,$(PERL)] (regen-ulps): New target. [ifeq (no,$(PERL)] (regen-ulps): New target. * math/libm-test.inc (ulps_file_name): Define. (output_dir): New variable. (options): Add "output-dir" option. (parse_opt): Handle 'o' case. (main): If output_dir is non-NULL use it as a prefix otherwise use "". * math/README.libm-test: Update `How can I generate "libm-test-ulps"?'
2013-04-06 20:22:47 +00:00
To automatically generate a new "libm-test-ulps" run "make regen-ulps".
This generates the file "math/NewUlps" in the build directory. The file
contains the sorted results of all the tests. You can use the "NewUlps"
file as the machine's updated "libm-test-ulps" file. Copy "NewUlps" to
"libm-test-ulps" in the appropriate machine sysdep directory. Verify
the changes, post your patch, and check it in after review.
To manually generate a new "libm-test-ulps" file, first remove "ULPs"
file in the current directory, then you can execute for example:
./testrun.sh math/test-double -u --ignore-max-ulp=yes
This generates a file "ULPs" with all double ULPs in it, ignoring any
New Makefile target `regen-ulps'. The wiki "Regeneration" page has this to say about update ULPs. "The libm-test-ulps files are semiautomatically updated. To update an ulps baseline, run each of the failing tests (test-float, test-double, etc.) with -u; this will generate a file called ULPs; concatenate each of those files with the existing libm-test-ulps file, after removing any entries for particularly huge numbers of ulps that you do not want to mark as expected. Then run gen-libm-test.pl -n -u FILE where FILE is the concatenated file produced in the previous step. This generates a file called NewUlps which is the new sorted version of libm-test-ulps." The same information is listed in math/README.libm-test, and is a lot of manual work that you often want to run over-and-over again while working on a particular test. The `regen-ulps' convenience target does this automatically for developers. We strictly assume the source tree is readonly and add a new --output-dir option to libm-test.inc to allow for writing out ULPs to $(objpfx). When run the new target does the following: * Starts with the baseline ULPs file. * Runs each of the libm math tests with -u. * Adds new changes seen with -u to the baseline. * Sorts and prepares the test output with gen-libm-test.pl. * Leaves math/NewUlps in your build tree to copy to your source tree, cleanup, and checkin. The math test documentation in math/README.libm-test is updated document the new Makefile target. --- 2013-04-06 Carlos O'Donell <carlos@redhat.com> * Makefile.in (regen-ulps): New target. * math/Makefile [ifneq (no,$(PERL)]: Declare regen-ulps with .PHONY. [ifneq (no,$(PERL)] (run-regen-ulps): New variable. [ifneq (no,$(PERL)] (regen-ulps): New target. [ifeq (no,$(PERL)] (regen-ulps): New target. * math/libm-test.inc (ulps_file_name): Define. (output_dir): New variable. (options): Add "output-dir" option. (parse_opt): Handle 'o' case. (main): If output_dir is non-NULL use it as a prefix otherwise use "". * math/README.libm-test: Update `How can I generate "libm-test-ulps"?'
2013-04-06 20:22:47 +00:00
previously calculated ULPs, and running with the newly built dynamic
loader and math library (assumes you didn't install your build). Now
generate the ULPs for all other formats, the tests will be appending the
Replace gen-libm-test.pl with gen-libm-test.py. Following the recent discussion of using Python instead of Perl and Awk for glibc build / test, this patch replaces gen-libm-test.pl with a new gen-libm-test.py script. This script should work with all Python versions supported by glibc (tested by hand with Python 2.7, tested in the build system with Python 3.5; configure prefers Python 3 if available). This script is designed to give identical output to gen-libm-test.pl for ease of verification of the change, except for generated comments referring to .py instead of .pl. (That is, identical for actual inputs passed to the script, not necessarily for all possible input; for example, this version more precisely follows the C standard syntax for floating-point constants when deciding when to add LIT macro calls.) In one place a comment notes that the generation of NON_FINITE flags is replicating a bug in the Perl script to assist in such comparisons (with the expectation that this bug can then be separately fixed in the Python script later). Tested for x86_64, including comparison of generated files (and hand testing of the case of generating a sorted libm-test-ulps file, which isn't covered by normal "make check"). I'd expect to follow this up by extending the new script to produce the ulps tables for the manual as well (replacing manual/libm-err-tab.pl, so that then we just have one ulps file parser) - at which point the manual build would depend on both Perl and Python (eliminating the Perl dependency would require someone to rewrite summary.pl in Python, and that would only eliminate the *direct* Perl dependency; current makeinfo is written in Perl so there would still be an indirect dependency). I think install.texi is more or less equally out-of-date regarding Perl and Python uses before and after this patch, so I don't think this patch depends on my patch <https://sourceware.org/ml/libc-alpha/2018-08/msg00133.html> to update install.texi regarding such uses (pending review). * math/gen-libm-test.py: New file. * math/gen-libm-test.pl: Remove. * math/Makefile [$(PERL) != no]: Change condition to [PYTHON]. ($(objpfx)libm-test-ulps.h): Use gen-libm-test.py instead of gen-libm-test.pl. ($(libm-test-c-noauto-obj)): Likewise. ($(libm-test-c-auto-obj)): Likewise. ($(libm-test-c-narrow-obj)): Likewise. (regen-ulps): Likewise. * math/README.libm-test: Update references to gen-libm-test.pl. * math/libm-test-driver.c (struct test_fj_f_data): Update comment referencing gen-libm-test.pl. * math/libm-test-nexttoward.inc (nexttoward_test_data): Likewise. * math/libm-test-support.c: Likewise. * math/libm-test-support.h: Likewise. * sysdeps/generic/libm-test-ulps: Likewise.
2018-08-09 15:34:12 +00:00
data to the "ULPs" file. As final step run "gen-libm-test.py" with the
New Makefile target `regen-ulps'. The wiki "Regeneration" page has this to say about update ULPs. "The libm-test-ulps files are semiautomatically updated. To update an ulps baseline, run each of the failing tests (test-float, test-double, etc.) with -u; this will generate a file called ULPs; concatenate each of those files with the existing libm-test-ulps file, after removing any entries for particularly huge numbers of ulps that you do not want to mark as expected. Then run gen-libm-test.pl -n -u FILE where FILE is the concatenated file produced in the previous step. This generates a file called NewUlps which is the new sorted version of libm-test-ulps." The same information is listed in math/README.libm-test, and is a lot of manual work that you often want to run over-and-over again while working on a particular test. The `regen-ulps' convenience target does this automatically for developers. We strictly assume the source tree is readonly and add a new --output-dir option to libm-test.inc to allow for writing out ULPs to $(objpfx). When run the new target does the following: * Starts with the baseline ULPs file. * Runs each of the libm math tests with -u. * Adds new changes seen with -u to the baseline. * Sorts and prepares the test output with gen-libm-test.pl. * Leaves math/NewUlps in your build tree to copy to your source tree, cleanup, and checkin. The math test documentation in math/README.libm-test is updated document the new Makefile target. --- 2013-04-06 Carlos O'Donell <carlos@redhat.com> * Makefile.in (regen-ulps): New target. * math/Makefile [ifneq (no,$(PERL)]: Declare regen-ulps with .PHONY. [ifneq (no,$(PERL)] (run-regen-ulps): New variable. [ifneq (no,$(PERL)] (regen-ulps): New target. [ifeq (no,$(PERL)] (regen-ulps): New target. * math/libm-test.inc (ulps_file_name): Define. (output_dir): New variable. (options): Add "output-dir" option. (parse_opt): Handle 'o' case. (main): If output_dir is non-NULL use it as a prefix otherwise use "". * math/README.libm-test: Update `How can I generate "libm-test-ulps"?'
2013-04-06 20:22:47 +00:00
file as input and ask to generate a pretty printed output in the file
"NewUlps":
Replace gen-libm-test.pl with gen-libm-test.py. Following the recent discussion of using Python instead of Perl and Awk for glibc build / test, this patch replaces gen-libm-test.pl with a new gen-libm-test.py script. This script should work with all Python versions supported by glibc (tested by hand with Python 2.7, tested in the build system with Python 3.5; configure prefers Python 3 if available). This script is designed to give identical output to gen-libm-test.pl for ease of verification of the change, except for generated comments referring to .py instead of .pl. (That is, identical for actual inputs passed to the script, not necessarily for all possible input; for example, this version more precisely follows the C standard syntax for floating-point constants when deciding when to add LIT macro calls.) In one place a comment notes that the generation of NON_FINITE flags is replicating a bug in the Perl script to assist in such comparisons (with the expectation that this bug can then be separately fixed in the Python script later). Tested for x86_64, including comparison of generated files (and hand testing of the case of generating a sorted libm-test-ulps file, which isn't covered by normal "make check"). I'd expect to follow this up by extending the new script to produce the ulps tables for the manual as well (replacing manual/libm-err-tab.pl, so that then we just have one ulps file parser) - at which point the manual build would depend on both Perl and Python (eliminating the Perl dependency would require someone to rewrite summary.pl in Python, and that would only eliminate the *direct* Perl dependency; current makeinfo is written in Perl so there would still be an indirect dependency). I think install.texi is more or less equally out-of-date regarding Perl and Python uses before and after this patch, so I don't think this patch depends on my patch <https://sourceware.org/ml/libc-alpha/2018-08/msg00133.html> to update install.texi regarding such uses (pending review). * math/gen-libm-test.py: New file. * math/gen-libm-test.pl: Remove. * math/Makefile [$(PERL) != no]: Change condition to [PYTHON]. ($(objpfx)libm-test-ulps.h): Use gen-libm-test.py instead of gen-libm-test.pl. ($(libm-test-c-noauto-obj)): Likewise. ($(libm-test-c-auto-obj)): Likewise. ($(libm-test-c-narrow-obj)): Likewise. (regen-ulps): Likewise. * math/README.libm-test: Update references to gen-libm-test.pl. * math/libm-test-driver.c (struct test_fj_f_data): Update comment referencing gen-libm-test.pl. * math/libm-test-nexttoward.inc (nexttoward_test_data): Likewise. * math/libm-test-support.c: Likewise. * math/libm-test-support.h: Likewise. * sysdeps/generic/libm-test-ulps: Likewise.
2018-08-09 15:34:12 +00:00
gen-libm-test.py -u ULPs -n NewUlps
New Makefile target `regen-ulps'. The wiki "Regeneration" page has this to say about update ULPs. "The libm-test-ulps files are semiautomatically updated. To update an ulps baseline, run each of the failing tests (test-float, test-double, etc.) with -u; this will generate a file called ULPs; concatenate each of those files with the existing libm-test-ulps file, after removing any entries for particularly huge numbers of ulps that you do not want to mark as expected. Then run gen-libm-test.pl -n -u FILE where FILE is the concatenated file produced in the previous step. This generates a file called NewUlps which is the new sorted version of libm-test-ulps." The same information is listed in math/README.libm-test, and is a lot of manual work that you often want to run over-and-over again while working on a particular test. The `regen-ulps' convenience target does this automatically for developers. We strictly assume the source tree is readonly and add a new --output-dir option to libm-test.inc to allow for writing out ULPs to $(objpfx). When run the new target does the following: * Starts with the baseline ULPs file. * Runs each of the libm math tests with -u. * Adds new changes seen with -u to the baseline. * Sorts and prepares the test output with gen-libm-test.pl. * Leaves math/NewUlps in your build tree to copy to your source tree, cleanup, and checkin. The math test documentation in math/README.libm-test is updated document the new Makefile target. --- 2013-04-06 Carlos O'Donell <carlos@redhat.com> * Makefile.in (regen-ulps): New target. * math/Makefile [ifneq (no,$(PERL)]: Declare regen-ulps with .PHONY. [ifneq (no,$(PERL)] (run-regen-ulps): New variable. [ifneq (no,$(PERL)] (regen-ulps): New target. [ifeq (no,$(PERL)] (regen-ulps): New target. * math/libm-test.inc (ulps_file_name): Define. (output_dir): New variable. (options): Add "output-dir" option. (parse_opt): Handle 'o' case. (main): If output_dir is non-NULL use it as a prefix otherwise use "". * math/README.libm-test: Update `How can I generate "libm-test-ulps"?'
2013-04-06 20:22:47 +00:00
Copy "NewUlps" to "libm-test-ulps" in the appropriate machine sysdep
directory.
Note that the test drivers have an option "-u" to output an unsorted
list of all epsilons that the functions have. The output can be read
in directly but it's better to pretty print it first.
Replace gen-libm-test.pl with gen-libm-test.py. Following the recent discussion of using Python instead of Perl and Awk for glibc build / test, this patch replaces gen-libm-test.pl with a new gen-libm-test.py script. This script should work with all Python versions supported by glibc (tested by hand with Python 2.7, tested in the build system with Python 3.5; configure prefers Python 3 if available). This script is designed to give identical output to gen-libm-test.pl for ease of verification of the change, except for generated comments referring to .py instead of .pl. (That is, identical for actual inputs passed to the script, not necessarily for all possible input; for example, this version more precisely follows the C standard syntax for floating-point constants when deciding when to add LIT macro calls.) In one place a comment notes that the generation of NON_FINITE flags is replicating a bug in the Perl script to assist in such comparisons (with the expectation that this bug can then be separately fixed in the Python script later). Tested for x86_64, including comparison of generated files (and hand testing of the case of generating a sorted libm-test-ulps file, which isn't covered by normal "make check"). I'd expect to follow this up by extending the new script to produce the ulps tables for the manual as well (replacing manual/libm-err-tab.pl, so that then we just have one ulps file parser) - at which point the manual build would depend on both Perl and Python (eliminating the Perl dependency would require someone to rewrite summary.pl in Python, and that would only eliminate the *direct* Perl dependency; current makeinfo is written in Perl so there would still be an indirect dependency). I think install.texi is more or less equally out-of-date regarding Perl and Python uses before and after this patch, so I don't think this patch depends on my patch <https://sourceware.org/ml/libc-alpha/2018-08/msg00133.html> to update install.texi regarding such uses (pending review). * math/gen-libm-test.py: New file. * math/gen-libm-test.pl: Remove. * math/Makefile [$(PERL) != no]: Change condition to [PYTHON]. ($(objpfx)libm-test-ulps.h): Use gen-libm-test.py instead of gen-libm-test.pl. ($(libm-test-c-noauto-obj)): Likewise. ($(libm-test-c-auto-obj)): Likewise. ($(libm-test-c-narrow-obj)): Likewise. (regen-ulps): Likewise. * math/README.libm-test: Update references to gen-libm-test.pl. * math/libm-test-driver.c (struct test_fj_f_data): Update comment referencing gen-libm-test.pl. * math/libm-test-nexttoward.inc (nexttoward_test_data): Likewise. * math/libm-test-support.c: Likewise. * math/libm-test-support.h: Likewise. * sysdeps/generic/libm-test-ulps: Likewise.
2018-08-09 15:34:12 +00:00
"gen-libm-test.py" has an option to generate a pretty-printed and
New Makefile target `regen-ulps'. The wiki "Regeneration" page has this to say about update ULPs. "The libm-test-ulps files are semiautomatically updated. To update an ulps baseline, run each of the failing tests (test-float, test-double, etc.) with -u; this will generate a file called ULPs; concatenate each of those files with the existing libm-test-ulps file, after removing any entries for particularly huge numbers of ulps that you do not want to mark as expected. Then run gen-libm-test.pl -n -u FILE where FILE is the concatenated file produced in the previous step. This generates a file called NewUlps which is the new sorted version of libm-test-ulps." The same information is listed in math/README.libm-test, and is a lot of manual work that you often want to run over-and-over again while working on a particular test. The `regen-ulps' convenience target does this automatically for developers. We strictly assume the source tree is readonly and add a new --output-dir option to libm-test.inc to allow for writing out ULPs to $(objpfx). When run the new target does the following: * Starts with the baseline ULPs file. * Runs each of the libm math tests with -u. * Adds new changes seen with -u to the baseline. * Sorts and prepares the test output with gen-libm-test.pl. * Leaves math/NewUlps in your build tree to copy to your source tree, cleanup, and checkin. The math test documentation in math/README.libm-test is updated document the new Makefile target. --- 2013-04-06 Carlos O'Donell <carlos@redhat.com> * Makefile.in (regen-ulps): New target. * math/Makefile [ifneq (no,$(PERL)]: Declare regen-ulps with .PHONY. [ifneq (no,$(PERL)] (run-regen-ulps): New variable. [ifneq (no,$(PERL)] (regen-ulps): New target. [ifeq (no,$(PERL)] (regen-ulps): New target. * math/libm-test.inc (ulps_file_name): Define. (output_dir): New variable. (options): Add "output-dir" option. (parse_opt): Handle 'o' case. (main): If output_dir is non-NULL use it as a prefix otherwise use "". * math/README.libm-test: Update `How can I generate "libm-test-ulps"?'
2013-04-06 20:22:47 +00:00
sorted new ULPs file from the output of the test drivers.
Contents of libm-test-ulps
==========================
Don't include individual test ulps in libm-test-ulps. As recently discussed <https://sourceware.org/ml/libc-alpha/2014-02/msg00670.html>, it doesn't seem particularly useful for libm-test-ulps files to contain huge amounts of data on ulps for individual tests; just the global maximum observed ulps for each function, together with the verification of exceptions, errno and special results such as infinities and NaNs for each test, suffices to verify that a function's behavior on the given test inputs is within the expected accuracy. Removing this data reduces source tree churn caused by updates to these files when libm tests are added, and reduces the frequency with which testsuite additions actually need libm-test-ulps changes at all. Accordingly, this patch removes that data, so that individual tests get checked against the global bounds for the given function and only generate an error if those are exceeded. Tested x86_64 (including verifying that if an ulps value is artificially reduced, the tests do indeed fail as they should and "make regen-ulps" generates the expected changes). * math/libm-test.inc (struct ulp_data): Don't refer to ulps for individual tests in comment. (libm-test-ulps.h): Don't refer to test_ulps in #include comment. (prev_max_error): New variable. (prev_real_max_error): Likewise. (prev_imag_max_error): Likewise. (compare_ulp_data): Don't refer to test names in comment. (find_test_ulps): Remove function. (find_function_ulps): Likewise. (find_complex_function_ulps): Likewise. (init_max_error): Take function name as argument. Look up ulps for that function. (print_ulps): Remove function. (print_max_error): Use prev_max_error instead of calling find_function_ulps. (print_complex_max_error): Use prev_real_max_error and prev_imag_max_error instead of calling find_complex_function_ulps. (check_float_internal): Take max_ulp parameter instead of calling find_test_ulps. Don't call print_ulps. (check_float): Update call to check_float_internal. (check_complex): Update calls to check_float_internal. (START): Pass argument to init_max_error. * math/gen-libm-test.pl (%results): Don't include "kind" information. (parse_ulps): Don't handle ulps of individual tests. (print_ulps_file): Likewise. (output_ulps): Likewise. * math/README.libm-test: Update. * manual/libm-err-tab.pl (parse_ulps): Don't handle ulps of individual tests. * sysdeps/aarch64/libm-test-ulps: Remove individual test ulps. * sysdeps/alpha/fpu/libm-test-ulps: Likewise. * sysdeps/arm/libm-test-ulps: Likewise. * sysdeps/i386/fpu/libm-test-ulps: Likewise. * sysdeps/ia64/fpu/libm-test-ulps: Likewise. * sysdeps/m68k/coldfire/fpu/libm-test-ulps: Likewise. * sysdeps/m68k/m680x0/fpu/libm-test-ulps: Likewise. * sysdeps/microblaze/libm-test-ulps: Likewise. * sysdeps/mips/mips32/libm-test-ulps: Likewise. * sysdeps/mips/mips64/libm-test-ulps: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Likewise. * sysdeps/powerpc/nofpu/libm-test-ulps: Likewise. * sysdeps/s390/fpu/libm-test-ulps: Likewise. * sysdeps/sh/libm-test-ulps: Likewise. * sysdeps/sparc/fpu/libm-test-ulps: Likewise. * sysdeps/tile/libm-test-ulps: Likewise. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. * sysdeps/hppa/fpu/libm-test-ulps: Remove individual test ulps.
2014-03-05 15:02:38 +00:00
Since libm-test-ulps can be generated automatically, just a few notes.
The file contains lines for maximal errors of single functions, like:
Function "yn":
Don't include individual test ulps in libm-test-ulps. As recently discussed <https://sourceware.org/ml/libc-alpha/2014-02/msg00670.html>, it doesn't seem particularly useful for libm-test-ulps files to contain huge amounts of data on ulps for individual tests; just the global maximum observed ulps for each function, together with the verification of exceptions, errno and special results such as infinities and NaNs for each test, suffices to verify that a function's behavior on the given test inputs is within the expected accuracy. Removing this data reduces source tree churn caused by updates to these files when libm tests are added, and reduces the frequency with which testsuite additions actually need libm-test-ulps changes at all. Accordingly, this patch removes that data, so that individual tests get checked against the global bounds for the given function and only generate an error if those are exceeded. Tested x86_64 (including verifying that if an ulps value is artificially reduced, the tests do indeed fail as they should and "make regen-ulps" generates the expected changes). * math/libm-test.inc (struct ulp_data): Don't refer to ulps for individual tests in comment. (libm-test-ulps.h): Don't refer to test_ulps in #include comment. (prev_max_error): New variable. (prev_real_max_error): Likewise. (prev_imag_max_error): Likewise. (compare_ulp_data): Don't refer to test names in comment. (find_test_ulps): Remove function. (find_function_ulps): Likewise. (find_complex_function_ulps): Likewise. (init_max_error): Take function name as argument. Look up ulps for that function. (print_ulps): Remove function. (print_max_error): Use prev_max_error instead of calling find_function_ulps. (print_complex_max_error): Use prev_real_max_error and prev_imag_max_error instead of calling find_complex_function_ulps. (check_float_internal): Take max_ulp parameter instead of calling find_test_ulps. Don't call print_ulps. (check_float): Update call to check_float_internal. (check_complex): Update calls to check_float_internal. (START): Pass argument to init_max_error. * math/gen-libm-test.pl (%results): Don't include "kind" information. (parse_ulps): Don't handle ulps of individual tests. (print_ulps_file): Likewise. (output_ulps): Likewise. * math/README.libm-test: Update. * manual/libm-err-tab.pl (parse_ulps): Don't handle ulps of individual tests. * sysdeps/aarch64/libm-test-ulps: Remove individual test ulps. * sysdeps/alpha/fpu/libm-test-ulps: Likewise. * sysdeps/arm/libm-test-ulps: Likewise. * sysdeps/i386/fpu/libm-test-ulps: Likewise. * sysdeps/ia64/fpu/libm-test-ulps: Likewise. * sysdeps/m68k/coldfire/fpu/libm-test-ulps: Likewise. * sysdeps/m68k/m680x0/fpu/libm-test-ulps: Likewise. * sysdeps/microblaze/libm-test-ulps: Likewise. * sysdeps/mips/mips32/libm-test-ulps: Likewise. * sysdeps/mips/mips64/libm-test-ulps: Likewise. * sysdeps/powerpc/fpu/libm-test-ulps: Likewise. * sysdeps/powerpc/nofpu/libm-test-ulps: Likewise. * sysdeps/s390/fpu/libm-test-ulps: Likewise. * sysdeps/sh/libm-test-ulps: Likewise. * sysdeps/sparc/fpu/libm-test-ulps: Likewise. * sysdeps/tile/libm-test-ulps: Likewise. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise. * sysdeps/hppa/fpu/libm-test-ulps: Remove individual test ulps.
2014-03-05 15:02:38 +00:00
idouble: 6
The keywords are float, ifloat, double, idouble, ldouble and ildouble
(the prefix i stands for inline).
Split libm-test.inc by function. Continuing the process of splitting up libm tests into more reasonably sized units, this patch splits libm-test.inc into 121 separate libm-test-<function>.inc files, one per array of test data. (There are 126 libm *_test functions, but five of those are for functions that are aliases for test purposes and so share arrays of test data.) In the present patch, the 121 files get processed separately by gen-libm-test.pl, each using only the auto-libm-test-out-<function> file that is relevant (/dev/null for functions not using auto-libm-test-* at all). This effectively eliminates the serialization on running gen-libm-test.pl. However, the resulting .c files still all get #included together, so compiling the limited number of libm tests using libm-test.inc may still act as a serialization point (the compilations still all have 40 MB of code to process). libm-test.inc doesn't actually have anything in it any more that needs gen-libm-test.pl processing, but is left as a .inc file that gets processed to produce a .c file, rather than being renamed, since the intent of this patch is as an intermediate step before libm-test.inc gets removed and tests get compiled separately for each function being tested. Tested for x86_64. * math/libm-test.inc: Move all tests of individual functions to libm-test-*.inc and #include libm-test-*.c files. (acos_test_data): Remove. (acos_test): Likewise. (acosh_test_data): Likewise. (acosh_test): Likewise. (asin_test_data): Likewise. (asin_test): Likewise. (asinh_test_data): Likewise. (asinh_test): Likewise. (atan_test_data): Likewise. (atan_test): Likewise. (atanh_test_data): Likewise. (atanh_test): Likewise. (atan2_test_data): Likewise. (atan2_test): Likewise. (cabs_test_data): Likewise. (cabs_test): Likewise. (cacos_test_data): Likewise. (cacos_test): Likewise. (cacosh_test_data): Likewise. (cacosh_test): Likewise. (canonicalize_test_data): Likewise. (canonicalize_test): Likewise. (carg_test_data): Likewise. (carg_test): Likewise. (casin_test_data): Likewise. (casin_test): Likewise. (casinh_test_data): Likewise. (casinh_test): Likewise. (catan_test_data): Likewise. (catan_test): Likewise. (catanh_test_data): Likewise. (catanh_test): Likewise. (cbrt_test_data): Likewise. (cbrt_test): Likewise. (ccos_test_data): Likewise. (ccos_test): Likewise. (ccosh_test_data): Likewise. (ccosh_test): Likewise. (ceil_test_data): Likewise. (ceil_test): Likewise. (cexp_test_data): Likewise. (cexp_test): Likewise. (cimag_test_data): Likewise. (cimag_test): Likewise. (clog_test_data): Likewise. (clog_test): Likewise. (clog10_test_data): Likewise. (clog10_test): Likewise. (conj_test_data): Likewise. (conj_test): Likewise. (copysign_test_data): Likewise. (copysign_test): Likewise. (cos_test_data): Likewise. (cos_test): Likewise. (cosh_test_data): Likewise. (cosh_test): Likewise. (cpow_test_data): Likewise. (cpow_test): Likewise. (cproj_test_data): Likewise. (cproj_test): Likewise. (creal_test_data): Likewise. (creal_test): Likewise. (csin_test_data): Likewise. (csin_test): Likewise. (csinh_test_data): Likewise. (csinh_test): Likewise. (csqrt_test_data): Likewise. (csqrt_test): Likewise. (ctan_test_data): Likewise. (ctan_test): Likewise. (ctanh_test_data): Likewise. (ctanh_test): Likewise. (erf_test_data): Likewise. (erf_test): Likewise. (erfc_test_data): Likewise. (erfc_test): Likewise. (exp_test_data): Likewise. (exp_test): Likewise. (exp10_test_data): Likewise. (exp10_test): Likewise. (pow10_test): Likewise. (exp2_test_data): Likewise. (exp2_test): Likewise. (expm1_test_data): Likewise. (expm1_test): Likewise. (fabs_test_data): Likewise. (fabs_test): Likewise. (fdim_test_data): Likewise. (fdim_test): Likewise. (floor_test_data): Likewise. (floor_test): Likewise. (fma_test_data): Likewise. (fma_test): Likewise. (fmax_test_data): Likewise. (fmax_test): Likewise. (fmaxmag_test_data): Likewise. (fmaxmag_test): Likewise. (fmin_test_data): Likewise. (fmin_test): Likewise. (fminmag_test_data): Likewise. (fminmag_test): Likewise. (fmod_test_data): Likewise. (fmod_test): Likewise. (fpclassify_test_data): Likewise. (fpclassify_test): Likewise. (frexp_test_data): Likewise. (frexp_test): Likewise. (fromfp_test_data): Likewise. (fromfp_test): Likewise. (fromfpx_test_data): Likewise. (fromfpx_test): Likewise. (getpayload_test_data): Likewise. (getpayload_test): Likewise. (hypot_test_data): Likewise. (hypot_test): Likewise. (ilogb_test_data): Likewise. (ilogb_test): Likewise. (iscanonical_test_data): Likewise. (iscanonical_test): Likewise. (iseqsig_test_data): Likewise. (iseqsig_test): Likewise. (isfinite_test_data): Likewise. (isfinite_test): Likewise. (finite_test): Likewise. (isgreater_test_data): Likewise. (isgreater_test): Likewise. (isgreaterequal_test_data): Likewise. (isgreaterequal_test): Likewise. (isinf_test_data): Likewise. (isinf_test): Likewise. (isless_test_data): Likewise. (isless_test): Likewise. (islessequal_test_data): Likewise. (islessequal_test): Likewise. (islessgreater_test_data): Likewise. (islessgreater_test): Likewise. (isnan_test_data): Likewise. (isnan_test): Likewise. (isnormal_test_data): Likewise. (isnormal_test): Likewise. (issignaling_test_data): Likewise. (issignaling_test): Likewise. (issubnormal_test_data): Likewise. (issubnormal_test): Likewise. (isunordered_test_data): Likewise. (isunordered_test): Likewise. (iszero_test_data): Likewise. (iszero_test): Likewise. (j0_test_data): Likewise. (j0_test): Likewise. (j1_test_data): Likewise. (j1_test): Likewise. (jn_test_data): Likewise. (jn_test): Likewise. (lgamma_test_data): Likewise. (lgamma_test): Likewise. (gamma_test): Likewise. (llogb_test_data): Likewise. (llogb_test): Likewise. (lrint_test_data): Likewise. (lrint_test): Likewise. (llrint_test_data): Likewise. (llrint_test): Likewise. (log_test_data): Likewise. (log_test): Likewise. (log10_test_data): Likewise. (log10_test): Likewise. (log1p_test_data): Likewise. (log1p_test): Likewise. (log2_test_data): Likewise. (log2_test): Likewise. (logb_test_data): Likewise. (logb_test): Likewise. (lround_test_data): Likewise. (lround_test): Likewise. (llround_test_data): Likewise. (llround_test): Likewise. (modf_test_data): Likewise. (modf_test): Likewise. (nearbyint_test_data): Likewise. (nearbyint_test): Likewise. (nextafter_test_data): Likewise. (nextafter_test): Likewise. (nextup_test_data): Likewise. (nextup_test): Likewise. (nextdown_test_data): Likewise. (nextdown_test): Likewise. (nexttoward_test_data): Likewise. (nexttoward_test): Likewise. (pow_test_data): Likewise. (pow_test): Likewise. (remainder_test_data): Likewise. (remainder_test): Likewise. (drem_test): Likewise. (remquo_test_data): Likewise. (remquo_test): Likewise. (rint_test_data): Likewise. (rint_test): Likewise. (round_test_data): Likewise. (round_test): Likewise. (roundeven_test_data): Likewise. (roundeven_test): Likewise. (scalb_test_data): Likewise. (scalb_test): Likewise. (scalbn_test_data): Likewise. (scalbn_test): Likewise. (ldexp_test): Likewise. (scalbln_test_data): Likewise. (scalbln_test): Likewise. (setpayload_test_data): Likewise. (setpayload_test): Likewise. (setpayloadsig_test_data): Likewise. (setpayloadsig_test): Likewise. (signbit_test_data): Likewise. (signbit_test): Likewise. (sin_test_data): Likewise. (sin_test): Likewise. (sincos_test_data): Likewise. (sincos_test): Likewise. (sinh_test_data): Likewise. (sinh_test): Likewise. (sqrt_test_data): Likewise. (sqrt_test): Likewise. (tan_test_data): Likewise. (tan_test): Likewise. (tanh_test_data): Likewise. (tanh_test): Likewise. (tgamma_test_data): Likewise. (tgamma_test): Likewise. (totalorder_test_data): Likewise. (totalorder_test): Likewise. (totalordermag_test_data): Likewise. (totalordermag_test): Likewise. (trunc_test_data): Likewise. (trunc_test): Likewise. (ufromfp_test_data): Likewise. (ufromfp_test): Likewise. (ufromfpx_test_data): Likewise. (ufromfpx_test): Likewise. (y0_test_data): Likewise. (y0_test): Likewise. (y1_test_data): Likewise. (y1_test): Likewise. (yn_test_data): Likewise. (yn_test): Likewise. (significand_test_data): Likewise. (significand_test): Likewise. * math/Makefile (auto-libm-test-out-files): Remove variable. (libm-test-funcs-noauto): New variable. (libm-test-funcs-all): Likewise. (libm-test-c-auto): Likewise. (libm-test-c-noauto): Likewise. (libm-tests-generated): Add $(libm-test-c-auto) and $(libm-test-c-noauto). (generated): Do not add auto-libm-test-out. (libm-test-c-auto-obj): New variable. (libm-test-c-noauto-obj): Likewise. ($(objpfx)libm-test.c): Do not generate or use auto-libm-test-out. ($(libm-test-c-noauto-obj)): New static pattern rule. ($(libm-test-c-auto-obj)): Likewise. (libm-test-incs): New variable. ($(objpfx)libm-have-vector-test.h): Depend on $(libm-test-incs) and pass it to gen-libm-have-vector-test.sh. * math/gen-libm-have-vector-test.sh: Expect list of .inc files to be passed on command line. * math/libm-test-acos.inc: New file. Content from math/libm-test.inc. * math/libm-test-acosh.inc: Likewise. * math/libm-test-asin.inc: Likewise. * math/libm-test-asinh.inc: Likewise. * math/libm-test-atan.inc: Likewise. * math/libm-test-atan2.inc: Likewise. * math/libm-test-atanh.inc: Likewise. * math/libm-test-cabs.inc: Likewise. * math/libm-test-cacos.inc: Likewise. * math/libm-test-cacosh.inc: Likewise. * math/libm-test-canonicalize.inc: Likewise. * math/libm-test-carg.inc: Likewise. * math/libm-test-casin.inc: Likewise. * math/libm-test-casinh.inc: Likewise. * math/libm-test-catan.inc: Likewise. * math/libm-test-catanh.inc: Likewise. * math/libm-test-cbrt.inc: Likewise. * math/libm-test-ccos.inc: Likewise. * math/libm-test-ccosh.inc: Likewise. * math/libm-test-ceil.inc: Likewise. * math/libm-test-cexp.inc: Likewise. * math/libm-test-cimag.inc: Likewise. * math/libm-test-clog.inc: Likewise. * math/libm-test-clog10.inc: Likewise. * math/libm-test-conj.inc: Likewise. * math/libm-test-copysign.inc: Likewise. * math/libm-test-cos.inc: Likewise. * math/libm-test-cosh.inc: Likewise. * math/libm-test-cpow.inc: Likewise. * math/libm-test-cproj.inc: Likewise. * math/libm-test-creal.inc: Likewise. * math/libm-test-csin.inc: Likewise. * math/libm-test-csinh.inc: Likewise. * math/libm-test-csqrt.inc: Likewise. * math/libm-test-ctan.inc: Likewise. * math/libm-test-ctanh.inc: Likewise. * math/libm-test-erf.inc: Likewise. * math/libm-test-erfc.inc: Likewise. * math/libm-test-exp.inc: Likewise. * math/libm-test-exp10.inc: Likewise. * math/libm-test-exp2.inc: Likewise. * math/libm-test-expm1.inc: Likewise. * math/libm-test-fabs.inc: Likewise. * math/libm-test-fdim.inc: Likewise. * math/libm-test-floor.inc: Likewise. * math/libm-test-fma.inc: Likewise. * math/libm-test-fmax.inc: Likewise. * math/libm-test-fmaxmag.inc: Likewise. * math/libm-test-fmin.inc: Likewise. * math/libm-test-fminmag.inc: Likewise. * math/libm-test-fmod.inc: Likewise. * math/libm-test-fpclassify.inc: Likewise. * math/libm-test-frexp.inc: Likewise. * math/libm-test-fromfp.inc: Likewise. * math/libm-test-fromfpx.inc: Likewise. * math/libm-test-getpayload.inc: Likewise. * math/libm-test-hypot.inc: Likewise. * math/libm-test-ilogb.inc: Likewise. * math/libm-test-iscanonical.inc: Likewise. * math/libm-test-iseqsig.inc: Likewise. * math/libm-test-isfinite.inc: Likewise. * math/libm-test-isgreater.inc: Likewise. * math/libm-test-isgreaterequal.inc: Likewise. * math/libm-test-isinf.inc: Likewise. * math/libm-test-isless.inc: Likewise. * math/libm-test-islessequal.inc: Likewise. * math/libm-test-islessgreater.inc: Likewise. * math/libm-test-isnan.inc: Likewise. * math/libm-test-isnormal.inc: Likewise. * math/libm-test-issignaling.inc: Likewise. * math/libm-test-issubnormal.inc: Likewise. * math/libm-test-isunordered.inc: Likewise. * math/libm-test-iszero.inc: Likewise. * math/libm-test-j0.inc: Likewise. * math/libm-test-j1.inc: Likewise. * math/libm-test-jn.inc: Likewise. * math/libm-test-lgamma.inc: Likewise. * math/libm-test-llogb.inc: Likewise. * math/libm-test-llrint.inc: Likewise. * math/libm-test-llround.inc: Likewise. * math/libm-test-log.inc: Likewise. * math/libm-test-log10.inc: Likewise. * math/libm-test-log1p.inc: Likewise. * math/libm-test-log2.inc: Likewise. * math/libm-test-logb.inc: Likewise. * math/libm-test-lrint.inc: Likewise. * math/libm-test-lround.inc: Likewise. * math/libm-test-modf.inc: Likewise. * math/libm-test-nearbyint.inc: Likewise. * math/libm-test-nextafter.inc: Likewise. * math/libm-test-nextdown.inc: Likewise. * math/libm-test-nexttoward.inc: Likewise. * math/libm-test-nextup.inc: Likewise. * math/libm-test-pow.inc: Likewise. * math/libm-test-remainder.inc: Likewise. * math/libm-test-remquo.inc: Likewise. * math/libm-test-rint.inc: Likewise. * math/libm-test-round.inc: Likewise. * math/libm-test-roundeven.inc: Likewise. * math/libm-test-scalb.inc: Likewise. * math/libm-test-scalbln.inc: Likewise. * math/libm-test-scalbn.inc: Likewise. * math/libm-test-setpayload.inc: Likewise. * math/libm-test-setpayloadsig.inc: Likewise. * math/libm-test-signbit.inc: Likewise. * math/libm-test-significand.inc: Likewise. * math/libm-test-sin.inc: Likewise. * math/libm-test-sincos.inc: Likewise. * math/libm-test-sinh.inc: Likewise. * math/libm-test-sqrt.inc: Likewise. * math/libm-test-tan.inc: Likewise. * math/libm-test-tanh.inc: Likewise. * math/libm-test-tgamma.inc: Likewise. * math/libm-test-totalorder.inc: Likewise. * math/libm-test-totalordermag.inc: Likewise. * math/libm-test-trunc.inc: Likewise. * math/libm-test-ufromfp.inc: Likewise. * math/libm-test-ufromfpx.inc: Likewise. * math/libm-test-y0.inc: Likewise. * math/libm-test-y1.inc: Likewise. * math/libm-test-yn.inc: Likewise. * math/README.libm-test: Update.
2017-02-06 18:57:25 +00:00
Adding tests to libm-test-<func>.inc
====================================
The tests are evaluated by a set of special test macros. The macros
start with "TEST_" followed by a specification the input values, an
underscore and a specification of the output values. As an example,
the test macro for a function with input of type FLOAT (FLOAT is
either float, double, long double) and output of type FLOAT is
"TEST_f_f". The macro's parameter are the name of the function, the
input parameter, output parameter and optionally one exception
parameter.
The accepted parameter types are:
- "f" for FLOAT
- "j" for long double.
Add test infrastructure for narrowing libm functions. This patch continues preparations for adding TS 18661-1 narrowing libm functions by adding the required testsuite infrastructure to test such functions through the libm-test infrastructure. That infrastructure is based around testing for a single type, FLOAT. For the narrowing functions, FLOAT, the "main" type for testing, is the function return type; the argument type is ARG_FLOAT. This is consistent with how the code built once for each type, libm-test-support.c, depends on FLOAT for such things as calculating ulps errors in results but can already handle different argument types (pointers, integers, long double for nexttoward). Makefile machinery is added to handle building tests for all pairs of types for which there are narrowing functions (as with non-narrowing functions, aliases are tested just the same as the functions they alias). gen-auto-libm-tests gains a --narrow option for building outputs for narrowing functions (so narrowing sqrt and fma will share the same inputs as non-narrowing, but gen-auto-libm-tests will be run with and without that option to generate different output files). In the narrowing case, the auto-libm-test-out-narrow-* files include annotations for each test about what properties ARG_FLOAT must have to be able to represent all the inputs for that test; those annotations result in calls to the TEST_COND_arg_fmt macro. gen-libm-test.pl has some minor updates to handle narrowing tests (for example, arguments in such tests must be surrounded by ARG_LIT calls instead of LIT calls). Various new macros are added to the C test support code (for example, sNaN initializers need to be properly typed, so arg_snan_value is added; other such arg_* macros are added as it seems cleanest to do so, though some are not strictly required). Special-casing of the ibm128 format to allow for its limitations is adjusted to handle it as the argument format as well as as the result format; thus, the tests of the new functions allow nonzero ulps only in the case where ibm128 is the argument format, as otherwise the functions correspond to fully-defined IEEE operations. The ulps in question appear as e.g. 'Function: "add_ldouble"' in libm-test-ulps (with 1ulp errors then listed for double and float for that function in powerpc); no support is added to generate corresponding faddl / daddl ulps listings in the ulps table in the manual. For the previous patch, I noted the need to avoid spurious macro expansions of identifiers such as "add". A test test-narrow-macros.c is added to verify such macro expansions are successfully avoided, and there is also a -mlong-double-64 version of that test for ldbl-opt. This test is set up to cover the full set of relevant identifiers from the start rather than adding functions one at a time as each function group is added. Tested for x86_64 (this patch in isolation, as well as testing for various configurations in conjunction with the actual addition of "add" functions). * math/Makefile (test-type-pairs): New variable. (test-type-pairs-f64xf128-yes): Likewise. (tests): Add test-narrow-macros. (libm-test-funcs-narrow): New variable. (libm-test-c-narrow): Likewise. (generated): Add $(libm-test-c-narrow). (libm-tests-base-narrow): New variable. (libm-tests-narrow): Likewise. (libm-tests): Add $(libm-tests-narrow). (libm-tests-for-type): Handle $(libm-tests-narrow). (libm-test-c-narrow-obj): New variable. ($(libm-test-c-narrow-obj)): New rule. ($(foreach t,$(libm-tests-narrow),$(objpfx)$(t).c)): Likewise. ($(foreach f,$(libm-test-funcs-narrow),$(objpfx)$(o)-$(f).o)): Use $(o-iterator) to set dependencies and CFLAGS. * math/gen-auto-libm-tests.c: Document use for narrowing functions. (output_for_one_input_case): Take argument NARROW. (generate_output): Likewise. Update call to output_for_one_input_case. (main): Take --narrow option. Update call to generate_output. * math/gen-libm-test.pl (_apply_lit): Take macro name as argument. (apply_lit): Update call to _apply_lit. (apply_arglit): New function. (parse_args): Handle "a" arguments. (parse_auto_input): Handle format names using ":". * math/README.libm-test: Document "a" parameter type. * math/libm-test-support.h (ARG_TYPE_MIN): New macro. (ARG_TYPE_TRUE_MIN): Likewise. (ARG_TYPE_MAX): Likwise. (ARG_MIN_EXP): Likewise. (ARG_MAX_EXP): Likewise. (ARG_MANT_DIG): Likewise. (TEST_COND_arg_ibm128): Likewise. (TEST_COND_ibm128_libgcc): Define conditional on [ARG_FLOAT]. (TEST_COND_arg_fmt): New macro. (init_max_error): Update prototype. * math/libm-test-support.c (test_ibm128): New variable. (init_max_error): Take argument testing_ibm128 and set test_ibm128 instead of using [TEST_COND_ibm128] conditional. (test_exceptions): Use test_ibm128 instead of TEST_COND_ibm128. * math/libm-test-driver.c (STR_ARG_FLOAT): New macro. [TEST_NARROW] (TEST_MSG): New definition. (arg_plus_zero): New macro. (arg_minus_zero): Likewise. (arg_plus_infty): Likewise. (arg_minus_infty): Likewise. (arg_qnan_value_pl): Likewise. (arg_qnan_value): Likewise. (arg_snan_value_pl): Likewise. (arg_snan_value): Likewise. (arg_max_value): Likewise. (arg_min_value): Likewise. (arg_min_subnorm_value): Likewise. [ARG_FLOAT] (struct test_aa_f_data): New struct type. (RUN_TEST_LOOP_aa_f): New macro. (TEST_SUFF): New macro. (TEST_SUFF_STR): Likewise. [!TEST_MATHVEC] (VEC_SUFF): Don't define. (TEST_COND_any_ibm128): New macro. (START): Use TEST_SUFF and TEST_SUFF_STR in initializer for this_func. Update call to init_max_error. * math/test-double.h (FUNC_NARROW_PREFIX): New macro. * math/test-float.h (FUNC_NARROW_PREFIX): Likewise. * math/test-float128.h (FUNC_NARROW_PREFIX): Likewise. * math/test-float32.h (FUNC_NARROW_PREFIX): Likewise. * math/test-float32x.h (FUNC_NARROW_PREFIX): Likewise. * math/test-float64.h (FUNC_NARROW_PREFIX): Likewise. * math/test-float64x.h (FUNC_NARROW_PREFIX): Likewise. * math/test-math-scalar.h (TEST_NARROW): Likewise. * math/test-math-vector.h (TEST_NARROW): Likewise. * math/test-arg-double.h: New file. * math/test-arg-float128.h: Likewise. * math/test-arg-float32x.h: Likewise. * math/test-arg-float64.h: Likewise. * math/test-arg-float64x.h: Likewise. * math/test-arg-ldouble.h: Likewise. * math/test-math-narrow.h: Likewise. * math/test-narrow-macros.c: Likewise. * sysdeps/ieee754/ldbl-opt/test-narrow-macros-ldbl-64.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (tests): Add test-narrow-macros-ldbl-64. (CFLAGS-test-narrow-macros-ldbl-64.c): New variable.
2018-02-09 21:55:48 +00:00
- "a" for ARG_FLOAT, the argument type for narrowing functions.
- "b" for boolean - just tests if the output parameter evaluates to 0
or 1 (only for output).
- "c" for complex. This parameter needs two values, first the real,
then the imaginary part.
- "i" for int.
- "l" for long int.
- "L" for long long int.
- "u" for unsigned int.
- "M" for intmax_t.
- "U" for uintmax_t.
- "p" for an argument (described in the previous character) passed
through a pointer rather than directly.
- "F" for the address of a FLOAT (only as input parameter)
- "I" for the address of an int (only as input parameter)
- "1" for an additional output (either output through a pointer passed
as an argument, or to a global variable such as signgam).
How to read the test output
===========================
Running each test on its own at the default level of verbosity will
print on stdout a line describing the implementation of math functions
exercised by the test (float, double, or long double), along with
whether the inline set has been selected, regardless of whether or
not any inline functions actually exist. This is then followed by
the details of test failures (if any). The output concludes by
a summary listing the number of test cases exercised and the number
of test failures uncovered.
For each test failure (and for each test case at higher levels of
verbosity), the output contains the name of the function under test
and its arguments or conditions that triggered the failure. Note
that the name of the function in the output need not correspond
exactly to the name of the math function actually invoked. For example,
the output will refer to the "acos" function even if the actual function
under test is acosf (for the float version) or acosl (for the long
double version). Also note that the function arguments may be shown
in either the decimal or the hexadecimal floating point format which
may or may not correspond to the format used in the auto-libm-test-in
file. Besides the name of the function, for each test failure the
output contains the actual and expected results and the difference
between the two, printed in both the decimal and hexadecimal
floating point format, and the ULP and maximum ULP for the test
case.