At present, libm-test.inc tests are run in multiple rounding modes by
having a separate array for each rounding mode (which might or might
not have the same test inputs as the other such arrays), a separate
function calling a RUN_TEST_LOOP_* macro over that array, and a
separate call to that function in main. The number of functions
tested in multiple rounding modes has gradually increased as
rounding-mode-specific bugs have been found and fixed in different
functions.
It would be better to be able to use a single macro call, in a single
function, to run tests for a function over all rounding modes, with
this being done for all libm functions except in cases where it's
deferred until some bugs can be fixed because XFAILing all affected
tests would be painful (that's why the full set of pow tests isn't
currently run in all rounding modes). This patch helps prepare for
that by making the structures storing expected results for tests store
results for all four rounding modes. After this patch, the results
for all modes are just duplicates, but tests access the appropriate
field in the structure, so helping to pave the way for when the fields
stop being duplicates and multiple rounding modes can be tested from a
single array. Tests might in future specify a single set of results,
to be used in all rounding modes; separate results for each rounding
mode, specified manually; or use of auto-libm-tests-* to generate
results for each rounding mode.
Tested x86_64.
* math/libm-test.inc (struct test_f_f_data): Move expected results
into structure for each rounding mode.
(struct test_ff_f_data): Likewise.
(struct test_ff_f_data_nexttoward): Likewise.
(struct test_fi_f_data): Likewise.
(struct test_fl_f_data): Likewise.
(struct test_if_f_data): Likewise.
(struct test_fff_f_data): Likewise.
(struct test_c_f_data): Likewise.
(struct test_f_f1_data): Likewise.
(struct test_fF_f1_data): Likewise.
(struct test_ffI_f1_data): Likewise.
(struct test_c_c_data): Likewise.
(struct test_cc_c_data): Likewise.
(struct test_f_i_data): Likewise.
(struct test_ff_i_data): Likewise.
(struct test_f_l_data): Likewise.
(struct test_f_L_data): Likewise.
(struct test_fFF_11_data): Likewise.
(RM_): New macro.
(RM_FE_DOWNWARD): Likewise.
(RM_FE_TONEAREST): Likewise.
(RM_FE_TOWARDZERO): Likewise.
(RM_FE_UPWARD): Likewise.
(RUN_TEST_LOOP_f_f): Update references to expected results.
(RUN_TEST_LOOP_2_f): Likewise.
(RUN_TEST_LOOP_fff_f): Likewise.
(RUN_TEST_LOOP_c_f): Likewise.
(RUN_TEST_LOOP_f_f1): Likewise.
(RUN_TEST_LOOP_fF_f1): Likewise.
(RUN_TEST_LOOP_fI_f1): Likewise.
(RUN_TEST_LOOP_ffI_f1): Likewise.
(RUN_TEST_LOOP_c_c): Likewise.
(RUN_TEST_LOOP_cc_c): Likewise.
(RUN_TEST_LOOP_f_i): Likewise.
(RUN_TEST_LOOP_f_i_tg): Likewise.
(RUN_TEST_LOOP_ff_i_tg): Likewise.
(RUN_TEST_LOOP_f_b): Likewise.
(RUN_TEST_LOOP_f_b_tg): Likewise.
(RUN_TEST_LOOP_f_l): Likewise.
(RUN_TEST_LOOP_f_L): Likewise.
(RUN_TEST_LOOP_fFF_11): Likewise.
* math/gen-libm-test.pl (parse_args): Output four copies of
expected results for each test.
This patch changes gen-auto-libm-tests so that, when generating test
results that depend on whether the architecture has before-rounding or
after-rounding tininess detection, the :before-rounding or
:after-rounding conditions go on the exception / errno flags
generated, rather than generating two separate lines in
auto-libm-test-out for e.g. flt-32:before-rounding and
flt-32:after-rounding.
The rationale for this is as follows. It would be desirable for
testing a libm function in all rounding modes to require just one
function and array in libm-test.inc, not four (or five), with the
array of test data including expected results for all rounding modes
rather than separate arrays for each rounding mode that also need to
repeat all the test inputs. For gen-libm-test.pl to generate data for
such an array from auto-libm-test-out, it would be helpful if each
(format, test input) pair has exactly four lines in
auto-libm-test-out, one for each rounding mode, rather than some
rounding modes having just one line and some having two because the
exceptions depend on tininess detection.
Tested x86_64 and x86.
* math/gen-auto-libm-tests.c: Update comment on output format.
(output_for_one_input_case): Generate before-rounding and
after-rounding information as conditions on output flags not
floating-point format.
* math/auto-libm-test-out: Regenerated.
* math/gen-libm-test.pl (cond_value): New function.
(or_cond_value): Use cond_value.
(generate_testfile): Handle conditional exceptions.
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.
math/gen-libm-test.pl has code to beautify names of various constants,
transforming the source form in libm-test.inc into the version
appearing in test names in libm-test-ulps files.
This has become decreasingly relevant over time for the M_* constants,
first as I changed the test names so only the arguments and not the
expected results appeared in them, then as tests have moved to
auto-libm-test-* so that automatically generated hex float constants
get used instead of M_* in test inputs.
This patch removes the beautification for all M_* constants. Tested
x86_64 and x86 and ulps updated accordingly. Even the one case where
this affected the name in the ulps files will disappear once complex
function tests are moved to auto-libm-test-*.
* math/gen-libm-test.pl (%beautify): Remove M_* constants.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2006-06-08 Joseph Myers <jsm28@gcc.gnu.org>
[BZ #2832]
* math/gen-libm-test.pl (clean_up_number): Do not remove trailing
0s from integers.
2006-08-13 Ulrich Drepper <drepper@redhat.com>
[BZ #2987]
* sysdeps/unix/sysv/linux/clock_settime.c: Add code to use syscall
for CPU clocks.
* sysdeps/unix/clock_settime.c: Add support for platform-specific
setting of CPU clocks.
* math/gen-libm-test.pl (parse_args): Take function name for pretty
output as an argument.
(generate_testfile): Pass it the name given in the START macro.
[BZ #2466]
* math/libm-test.inc (llrint_test, llround_test): Fix last change to
protect large-precision cases with [LDBL_MANT_DIG > 100].
(llrint_test_tonearest, llrint_test_towardzero): Likewise.
(llrint_test_downward, llrint_test_upward): Likewise.
2006-03-15 Steven Munroe <sjmunroe@us.ibm.com>
Alan Modra <amodra@bigpond.net.au>
[BZ #2466]
* math/libm-test.inc (llrint_test, llround_test) [TEST_LDOUBLE]:
Add new test values.
(llrint_test_tonearest, llrint_test_towardzero, llrint_test_downward,
llrint_test_upward): New functions.
(main): Call them.
* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c (__llrintl): Handle
rounding that spans doubles in IBM long double format.
* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c (__llroundl): Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_llrintl.S: Removed.
* sysdeps/powerpc/powerpc64/fpu/s_llroundl.S: Removed.
* sysdeps/powerpc/powerpc64/fpu/s_lrintl.S: Removed.
* sysdeps/powerpc/powerpc64/fpu/s_lroundl.S: Removed.
2006-03-16 Roland McGrath <roland@redhat.com>
2001-07-06 Paul Eggert <eggert@twinsun.com>
* manual/argp.texi: Remove ignored LGPL copyright notice; it's
not appropriate for documentation anyway.
* manual/libc-texinfo.sh: "Library General Public License" ->
"Lesser General Public License".
2001-07-06 Andreas Jaeger <aj@suse.de>
* All files under GPL/LGPL version 2: Place under LGPL version
2.1.
1999-10-25 Thorsten Kukuk <kukuk@suse.de>
* md5-crypt/md5.h: Remove prototypes for public interface. md5 is
used only internal.
* md5-crypt/md5-crypt.c: Use internal names for md5 functions,
remove weak alias for public names.
* md5-crypt/md5.c: Remove weak aliase.
1999-10-25 Andreas Jaeger <aj@suse.de>
* math/README.libm-test: New file, documents libm-test.inc.
1999-10-25 Andreas Jaeger <aj@suse.de>
* math/gen-libm-test.pl: Only generate a new ulps file when -n is
given.
(print_ulps_file): Fix loops to not read @tests and @functions
since those are not initialized with -n now.
(parse_ulps): Set $results{..}{"kind"}.
1999-10-20 Andreas Jaeger <aj@suse.de>
* math/libm-test.inc: Rewrite to allow different deltas for real
and imaginary part of complex functions.
* math/gen-libm-test.pl: Likewise.
1999-10-19 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/i386/fpu/s_nextafterl.c: Add __nextafterl and nextafterl
aliases.
* sysdeps/ieee754/flt-32/e_lgammaf_r.c: Don't handle -Inf special.
* sysdeps/ieee754/flt-32/e_gammaf_r.c (__ieee754_gammaf_r): Check
for -Inf and return NaN.
* math/gen-libm-test.pl: Fix program name in help message.
* math/libm-test.inc (check_complex): It's Imaginary, not Complex.
* math/libm-test.inc (gamma_test): Result of gamma(-inf) is +inf.
* sysdeps/i386/Implies: Correct order of libm directories.
1999-10-18 Andreas Jaeger <aj@suse.de>
Added improved math testsuite:
* math/libm-test.inc: New file, contains all tests from
libm-test.c but in a different form.
* math/libm-test.c: Removed.
* sysdeps/generic/libm-test-ulps: New file: Fallback ulps file.
* math/gen-libm-test.pl: New file: Preprocessor.
* math/test-double.c: Adopted to new testsuite.
* math/test-idouble.c: Likewise.
* math/test-float.c: Likewise.
* math/test-ifloat.c: Likewise.
* math/test-ldouble.c: Likewise.
* math/test-ildoubl.c: Likewise.
* math/Makefile: Added rules to generate new suite.