glibc/math/gen-libm-test.pl

739 lines
21 KiB
Perl
Raw Normal View History

#!/usr/bin/perl -w
# Copyright (C) 1999-2016 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Andreas Jaeger <aj@suse.de>, 1999.
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, see
# <http://www.gnu.org/licenses/>.
# This file needs to be tidied up
# Note that functions and tests share the same namespace.
# Information about tests are stored in: %results
# $results{$test}{"type"} is the result type, e.g. normal or complex.
# $results{$test}{"has_ulps"} is set if deltas exist.
# In the following description $type and $float are:
# - $type is either "normal", "real" (for the real part of a complex number)
# or "imag" (for the imaginary part # of a complex number).
# - $float is either of float, ifloat, double, idouble, ldouble, ildouble;
# It represents the underlying floating point type (float, double or long
# double) and if inline functions (the leading i stands for inline)
# are used.
# $results{$test}{$type}{"ulp"}{$float} is defined and has a delta as value
use Getopt::Std;
use strict;
use vars qw ($input $output $auto_input);
use vars qw (%results);
use vars qw (%beautify @all_floats);
use vars qw ($output_dir $ulps_file $srcdir);
use vars qw (%auto_tests);
# all_floats is sorted and contains all recognised float types
@all_floats = ('double', 'float', 'idouble',
'ifloat', 'ildouble', 'ldouble');
%beautify =
( "minus_zero" => "-0",
"plus_zero" => "+0",
"-0x0p+0f" => "-0",
"-0x0p+0" => "-0",
"-0x0p+0L" => "-0",
"0x0p+0f" => "+0",
"0x0p+0" => "+0",
"0x0p+0L" => "+0",
"minus_infty" => "-inf",
"plus_infty" => "inf",
"qnan_value" => "qNaN",
);
# get Options
# Options:
# u: ulps-file
# h: help
# o: output-directory
# n: generate new ulps file
use vars qw($opt_u $opt_h $opt_o $opt_n);
getopts('u:o:nh');
$ulps_file = 'libm-test-ulps';
$output_dir = '';
($srcdir = $0) =~ s{[^/]*$}{};
if ($opt_h) {
print "Usage: gen-libm-test.pl [OPTIONS]\n";
print " -h print this help, then exit\n";
print " -o DIR directory where generated files will be placed\n";
print " -n only generate sorted file NewUlps from libm-test-ulps\n";
print " -u FILE input file with ulps\n";
exit 0;
}
$ulps_file = $opt_u if ($opt_u);
$output_dir = $opt_o if ($opt_o);
$input = "libm-test.inc";
$auto_input = "${srcdir}auto-libm-test-out";
$output = "${output_dir}libm-test.c";
&parse_ulps ($ulps_file);
&parse_auto_input ($auto_input);
&generate_testfile ($input, $output) unless ($opt_n);
&output_ulps ("${output_dir}libm-test-ulps.h", $ulps_file) unless ($opt_n);
&print_ulps_file ("${output_dir}NewUlps") if ($opt_n);
# Return a nicer representation
sub beautify {
my ($arg) = @_;
my ($tmp);
if (exists $beautify{$arg}) {
return $beautify{$arg};
}
if ($arg =~ /^-/) {
$tmp = $arg;
$tmp =~ s/^-//;
if (exists $beautify{$tmp}) {
return '-' . $beautify{$tmp};
}
}
if ($arg =~ /^-?0x[0-9a-f.]*p[-+][0-9]+f$/) {
$arg =~ s/f$//;
}
if ($arg =~ /[0-9]L$/) {
$arg =~ s/L$//;
}
return $arg;
}
# Return a nicer representation of a complex number
sub build_complex_beautify {
my ($r, $i) = @_;
my ($str1, $str2);
$str1 = &beautify ($r);
$str2 = &beautify ($i);
if ($str2 =~ /^-/) {
$str2 =~ s/^-//;
$str1 .= ' - ' . $str2;
} else {
$str1 .= ' + ' . $str2;
}
$str1 .= ' i';
return $str1;
}
# Return the text to put in an initializer for a test's exception
# information.
sub show_exceptions {
Run libm-test tests for finite-math-only functions. This patch arranges for the libm-test tests to be run for the finite-math-only function variants, in addition to the existing runs for out-of-line and bits/mathinline.h inline variants. gen-libm-test.pl is made to add a flag to all tests with non-finite inputs or outputs so that they can be skipped at runtime when the finite-math-only variants are being tested (skipping is for all rounding modes; that is, -ffinite-math-only is being treated as excluding overflow cases even when the rounding mode is such that the overflowed result is finite). errno setting is not tested for these variants (in general they don't set it, and it's implementation-defined in ISO C whether it's set on underflow, with the glibc definition being that it may not be for -ffinite-math-only; other cases where errno would normally be expected to be set are mostly excluded as having non-finite or overflowing arguments or results). As with the inline function tests, these ones are built with -D__FINITE_MATH_ONLY=1 to select the function variants, rather than -ffinite-math-only. Use of -ffinite-math-only would not be suitable for these tests because it would also affect libm-test.inc code that e.g. tests whether results are infinities or NaNs - if these function variants have bugs that incorrectly produce such results, we want them to show up in the tests, which means the compiler should not be optimizing the tests on the basis of results being finite. The finite-math-only functions share the same ulps settings as the main out-of-line functions. These interfaces were one significant group of untested ABIs listed at <https://sourceware.org/ml/libc-alpha/2013-07/msg00386.html>. I haven't rerun the script to list untested interfaces, but I expect that the vast bulk of interfaces there are still untested and could do with testcases being added (or, if applicable, being made compat symbols; in general, most symbols not starting '_' are safe bets to add tests for, while _* need more investigation of what the actual public API is, if any). I'd like to encourage people to help reduce the accumulation of untested interfaces by adding more tests. Tested for x86_64 and x86. Given my recent lgamma/gamma and log* fixes, the new tests pass (before those fixes, the new tests showed up those bugs, so illustrating the practical utility of having tests for these function variants). * math/libm-test.inc (NON_FINITE): New macro. (enable_test): Do not run tests flagged NON_FINITE if TEST_FINITE. * math/gen-libm-test.pl (show_exceptions): Add argument $non_finite. (parse_args): Update call to show_exceptions. * math/test-math-finite.h: New file. * math/test-math-no-finite.h: Likewise. * math/test-double-finite.c: Likewise. * math/test-float-finite.c: Likewise. * math/test-ldouble-finite.c: Likewise. * math/test-double.c: Include "test-math-no-finite.h". * math/test-float.c: Include "test-math-no-finite.h". * math/test-ldouble.c: Include "test-math-no-finite.h". * math/test-math-inline.h (TEST_FINITE): New macro. * math/test-math-vector.h (TEST_FINITE): Likewise. * math/Makefile (test-longdouble-yes): Add test-ldouble-finite. (libm-tests): Add test-float-finite and test-double-finite. ($(objpfx)test-float-finite.o): New dependency on $(objpfx)libm-test.stmp. ($(objpfx)test-double-finite.o): Likewise. ($(objpfx)test-ldouble-finite.o): Likewise. (libm-test-no-inline-cflags): New variable. (libm-test-finite-cflags): Likewise. (CFLAGS-test-float-finite.c): Likewise. (CFLAGS-test-double-finite.c): Likewise. (CFLAGS-test-ldouble-finite.c): Likewise. (CFLAGS-test-float.c): Use $(libm-test-no-inline-cflags). (CFLAGS-test-double.c): Likewise. (CFLAGS-test-ldouble.c): Likewise.
2015-11-05 23:28:16 +00:00
my ($ignore_result, $non_finite, $exception) = @_;
$ignore_result = ($ignore_result ? "IGNORE_RESULT|" : "");
Run libm-test tests for finite-math-only functions. This patch arranges for the libm-test tests to be run for the finite-math-only function variants, in addition to the existing runs for out-of-line and bits/mathinline.h inline variants. gen-libm-test.pl is made to add a flag to all tests with non-finite inputs or outputs so that they can be skipped at runtime when the finite-math-only variants are being tested (skipping is for all rounding modes; that is, -ffinite-math-only is being treated as excluding overflow cases even when the rounding mode is such that the overflowed result is finite). errno setting is not tested for these variants (in general they don't set it, and it's implementation-defined in ISO C whether it's set on underflow, with the glibc definition being that it may not be for -ffinite-math-only; other cases where errno would normally be expected to be set are mostly excluded as having non-finite or overflowing arguments or results). As with the inline function tests, these ones are built with -D__FINITE_MATH_ONLY=1 to select the function variants, rather than -ffinite-math-only. Use of -ffinite-math-only would not be suitable for these tests because it would also affect libm-test.inc code that e.g. tests whether results are infinities or NaNs - if these function variants have bugs that incorrectly produce such results, we want them to show up in the tests, which means the compiler should not be optimizing the tests on the basis of results being finite. The finite-math-only functions share the same ulps settings as the main out-of-line functions. These interfaces were one significant group of untested ABIs listed at <https://sourceware.org/ml/libc-alpha/2013-07/msg00386.html>. I haven't rerun the script to list untested interfaces, but I expect that the vast bulk of interfaces there are still untested and could do with testcases being added (or, if applicable, being made compat symbols; in general, most symbols not starting '_' are safe bets to add tests for, while _* need more investigation of what the actual public API is, if any). I'd like to encourage people to help reduce the accumulation of untested interfaces by adding more tests. Tested for x86_64 and x86. Given my recent lgamma/gamma and log* fixes, the new tests pass (before those fixes, the new tests showed up those bugs, so illustrating the practical utility of having tests for these function variants). * math/libm-test.inc (NON_FINITE): New macro. (enable_test): Do not run tests flagged NON_FINITE if TEST_FINITE. * math/gen-libm-test.pl (show_exceptions): Add argument $non_finite. (parse_args): Update call to show_exceptions. * math/test-math-finite.h: New file. * math/test-math-no-finite.h: Likewise. * math/test-double-finite.c: Likewise. * math/test-float-finite.c: Likewise. * math/test-ldouble-finite.c: Likewise. * math/test-double.c: Include "test-math-no-finite.h". * math/test-float.c: Include "test-math-no-finite.h". * math/test-ldouble.c: Include "test-math-no-finite.h". * math/test-math-inline.h (TEST_FINITE): New macro. * math/test-math-vector.h (TEST_FINITE): Likewise. * math/Makefile (test-longdouble-yes): Add test-ldouble-finite. (libm-tests): Add test-float-finite and test-double-finite. ($(objpfx)test-float-finite.o): New dependency on $(objpfx)libm-test.stmp. ($(objpfx)test-double-finite.o): Likewise. ($(objpfx)test-ldouble-finite.o): Likewise. (libm-test-no-inline-cflags): New variable. (libm-test-finite-cflags): Likewise. (CFLAGS-test-float-finite.c): Likewise. (CFLAGS-test-double-finite.c): Likewise. (CFLAGS-test-ldouble-finite.c): Likewise. (CFLAGS-test-float.c): Use $(libm-test-no-inline-cflags). (CFLAGS-test-double.c): Likewise. (CFLAGS-test-ldouble.c): Likewise.
2015-11-05 23:28:16 +00:00
$non_finite = ($non_finite ? "NON_FINITE|" : "");
if (defined $exception) {
Run libm-test tests for finite-math-only functions. This patch arranges for the libm-test tests to be run for the finite-math-only function variants, in addition to the existing runs for out-of-line and bits/mathinline.h inline variants. gen-libm-test.pl is made to add a flag to all tests with non-finite inputs or outputs so that they can be skipped at runtime when the finite-math-only variants are being tested (skipping is for all rounding modes; that is, -ffinite-math-only is being treated as excluding overflow cases even when the rounding mode is such that the overflowed result is finite). errno setting is not tested for these variants (in general they don't set it, and it's implementation-defined in ISO C whether it's set on underflow, with the glibc definition being that it may not be for -ffinite-math-only; other cases where errno would normally be expected to be set are mostly excluded as having non-finite or overflowing arguments or results). As with the inline function tests, these ones are built with -D__FINITE_MATH_ONLY=1 to select the function variants, rather than -ffinite-math-only. Use of -ffinite-math-only would not be suitable for these tests because it would also affect libm-test.inc code that e.g. tests whether results are infinities or NaNs - if these function variants have bugs that incorrectly produce such results, we want them to show up in the tests, which means the compiler should not be optimizing the tests on the basis of results being finite. The finite-math-only functions share the same ulps settings as the main out-of-line functions. These interfaces were one significant group of untested ABIs listed at <https://sourceware.org/ml/libc-alpha/2013-07/msg00386.html>. I haven't rerun the script to list untested interfaces, but I expect that the vast bulk of interfaces there are still untested and could do with testcases being added (or, if applicable, being made compat symbols; in general, most symbols not starting '_' are safe bets to add tests for, while _* need more investigation of what the actual public API is, if any). I'd like to encourage people to help reduce the accumulation of untested interfaces by adding more tests. Tested for x86_64 and x86. Given my recent lgamma/gamma and log* fixes, the new tests pass (before those fixes, the new tests showed up those bugs, so illustrating the practical utility of having tests for these function variants). * math/libm-test.inc (NON_FINITE): New macro. (enable_test): Do not run tests flagged NON_FINITE if TEST_FINITE. * math/gen-libm-test.pl (show_exceptions): Add argument $non_finite. (parse_args): Update call to show_exceptions. * math/test-math-finite.h: New file. * math/test-math-no-finite.h: Likewise. * math/test-double-finite.c: Likewise. * math/test-float-finite.c: Likewise. * math/test-ldouble-finite.c: Likewise. * math/test-double.c: Include "test-math-no-finite.h". * math/test-float.c: Include "test-math-no-finite.h". * math/test-ldouble.c: Include "test-math-no-finite.h". * math/test-math-inline.h (TEST_FINITE): New macro. * math/test-math-vector.h (TEST_FINITE): Likewise. * math/Makefile (test-longdouble-yes): Add test-ldouble-finite. (libm-tests): Add test-float-finite and test-double-finite. ($(objpfx)test-float-finite.o): New dependency on $(objpfx)libm-test.stmp. ($(objpfx)test-double-finite.o): Likewise. ($(objpfx)test-ldouble-finite.o): Likewise. (libm-test-no-inline-cflags): New variable. (libm-test-finite-cflags): Likewise. (CFLAGS-test-float-finite.c): Likewise. (CFLAGS-test-double-finite.c): Likewise. (CFLAGS-test-ldouble-finite.c): Likewise. (CFLAGS-test-float.c): Use $(libm-test-no-inline-cflags). (CFLAGS-test-double.c): Likewise. (CFLAGS-test-ldouble.c): Likewise.
2015-11-05 23:28:16 +00:00
return ", ${ignore_result}${non_finite}$exception";
} else {
Run libm-test tests for finite-math-only functions. This patch arranges for the libm-test tests to be run for the finite-math-only function variants, in addition to the existing runs for out-of-line and bits/mathinline.h inline variants. gen-libm-test.pl is made to add a flag to all tests with non-finite inputs or outputs so that they can be skipped at runtime when the finite-math-only variants are being tested (skipping is for all rounding modes; that is, -ffinite-math-only is being treated as excluding overflow cases even when the rounding mode is such that the overflowed result is finite). errno setting is not tested for these variants (in general they don't set it, and it's implementation-defined in ISO C whether it's set on underflow, with the glibc definition being that it may not be for -ffinite-math-only; other cases where errno would normally be expected to be set are mostly excluded as having non-finite or overflowing arguments or results). As with the inline function tests, these ones are built with -D__FINITE_MATH_ONLY=1 to select the function variants, rather than -ffinite-math-only. Use of -ffinite-math-only would not be suitable for these tests because it would also affect libm-test.inc code that e.g. tests whether results are infinities or NaNs - if these function variants have bugs that incorrectly produce such results, we want them to show up in the tests, which means the compiler should not be optimizing the tests on the basis of results being finite. The finite-math-only functions share the same ulps settings as the main out-of-line functions. These interfaces were one significant group of untested ABIs listed at <https://sourceware.org/ml/libc-alpha/2013-07/msg00386.html>. I haven't rerun the script to list untested interfaces, but I expect that the vast bulk of interfaces there are still untested and could do with testcases being added (or, if applicable, being made compat symbols; in general, most symbols not starting '_' are safe bets to add tests for, while _* need more investigation of what the actual public API is, if any). I'd like to encourage people to help reduce the accumulation of untested interfaces by adding more tests. Tested for x86_64 and x86. Given my recent lgamma/gamma and log* fixes, the new tests pass (before those fixes, the new tests showed up those bugs, so illustrating the practical utility of having tests for these function variants). * math/libm-test.inc (NON_FINITE): New macro. (enable_test): Do not run tests flagged NON_FINITE if TEST_FINITE. * math/gen-libm-test.pl (show_exceptions): Add argument $non_finite. (parse_args): Update call to show_exceptions. * math/test-math-finite.h: New file. * math/test-math-no-finite.h: Likewise. * math/test-double-finite.c: Likewise. * math/test-float-finite.c: Likewise. * math/test-ldouble-finite.c: Likewise. * math/test-double.c: Include "test-math-no-finite.h". * math/test-float.c: Include "test-math-no-finite.h". * math/test-ldouble.c: Include "test-math-no-finite.h". * math/test-math-inline.h (TEST_FINITE): New macro. * math/test-math-vector.h (TEST_FINITE): Likewise. * math/Makefile (test-longdouble-yes): Add test-ldouble-finite. (libm-tests): Add test-float-finite and test-double-finite. ($(objpfx)test-float-finite.o): New dependency on $(objpfx)libm-test.stmp. ($(objpfx)test-double-finite.o): Likewise. ($(objpfx)test-ldouble-finite.o): Likewise. (libm-test-no-inline-cflags): New variable. (libm-test-finite-cflags): Likewise. (CFLAGS-test-float-finite.c): Likewise. (CFLAGS-test-double-finite.c): Likewise. (CFLAGS-test-ldouble-finite.c): Likewise. (CFLAGS-test-float.c): Use $(libm-test-no-inline-cflags). (CFLAGS-test-double.c): Likewise. (CFLAGS-test-ldouble.c): Likewise.
2015-11-05 23:28:16 +00:00
return ", ${ignore_result}${non_finite}0";
}
}
# Parse the arguments to TEST_x_y
sub parse_args {
my ($file, $descr, $args) = @_;
my (@args, $descr_args, $descr_res, @descr);
Prepare libm-test.inc structures for multi-rounding-mode testing. 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.
2014-03-06 14:15:00 +00:00
my ($current_arg, $cline, $cline_res, $i);
my (@special);
my ($call_args);
my ($ignore_result_any, $ignore_result_all);
my ($num_res, @args_res, @start_rm, $rm);
my (@plus_oflow, @minus_oflow, @plus_uflow, @minus_uflow);
my (@errno_plus_oflow, @errno_minus_oflow);
my (@errno_plus_uflow, @errno_minus_uflow);
Run libm-test tests for finite-math-only functions. This patch arranges for the libm-test tests to be run for the finite-math-only function variants, in addition to the existing runs for out-of-line and bits/mathinline.h inline variants. gen-libm-test.pl is made to add a flag to all tests with non-finite inputs or outputs so that they can be skipped at runtime when the finite-math-only variants are being tested (skipping is for all rounding modes; that is, -ffinite-math-only is being treated as excluding overflow cases even when the rounding mode is such that the overflowed result is finite). errno setting is not tested for these variants (in general they don't set it, and it's implementation-defined in ISO C whether it's set on underflow, with the glibc definition being that it may not be for -ffinite-math-only; other cases where errno would normally be expected to be set are mostly excluded as having non-finite or overflowing arguments or results). As with the inline function tests, these ones are built with -D__FINITE_MATH_ONLY=1 to select the function variants, rather than -ffinite-math-only. Use of -ffinite-math-only would not be suitable for these tests because it would also affect libm-test.inc code that e.g. tests whether results are infinities or NaNs - if these function variants have bugs that incorrectly produce such results, we want them to show up in the tests, which means the compiler should not be optimizing the tests on the basis of results being finite. The finite-math-only functions share the same ulps settings as the main out-of-line functions. These interfaces were one significant group of untested ABIs listed at <https://sourceware.org/ml/libc-alpha/2013-07/msg00386.html>. I haven't rerun the script to list untested interfaces, but I expect that the vast bulk of interfaces there are still untested and could do with testcases being added (or, if applicable, being made compat symbols; in general, most symbols not starting '_' are safe bets to add tests for, while _* need more investigation of what the actual public API is, if any). I'd like to encourage people to help reduce the accumulation of untested interfaces by adding more tests. Tested for x86_64 and x86. Given my recent lgamma/gamma and log* fixes, the new tests pass (before those fixes, the new tests showed up those bugs, so illustrating the practical utility of having tests for these function variants). * math/libm-test.inc (NON_FINITE): New macro. (enable_test): Do not run tests flagged NON_FINITE if TEST_FINITE. * math/gen-libm-test.pl (show_exceptions): Add argument $non_finite. (parse_args): Update call to show_exceptions. * math/test-math-finite.h: New file. * math/test-math-no-finite.h: Likewise. * math/test-double-finite.c: Likewise. * math/test-float-finite.c: Likewise. * math/test-ldouble-finite.c: Likewise. * math/test-double.c: Include "test-math-no-finite.h". * math/test-float.c: Include "test-math-no-finite.h". * math/test-ldouble.c: Include "test-math-no-finite.h". * math/test-math-inline.h (TEST_FINITE): New macro. * math/test-math-vector.h (TEST_FINITE): Likewise. * math/Makefile (test-longdouble-yes): Add test-ldouble-finite. (libm-tests): Add test-float-finite and test-double-finite. ($(objpfx)test-float-finite.o): New dependency on $(objpfx)libm-test.stmp. ($(objpfx)test-double-finite.o): Likewise. ($(objpfx)test-ldouble-finite.o): Likewise. (libm-test-no-inline-cflags): New variable. (libm-test-finite-cflags): Likewise. (CFLAGS-test-float-finite.c): Likewise. (CFLAGS-test-double-finite.c): Likewise. (CFLAGS-test-ldouble-finite.c): Likewise. (CFLAGS-test-float.c): Use $(libm-test-no-inline-cflags). (CFLAGS-test-double.c): Likewise. (CFLAGS-test-ldouble.c): Likewise.
2015-11-05 23:28:16 +00:00
my ($non_finite);
($descr_args, $descr_res) = split /_/,$descr, 2;
@args = split /,\s*/, $args;
$call_args = "";
# Generate first the string that's shown to the user
$current_arg = 1;
@descr = split //,$descr_args;
for ($i = 0; $i <= $#descr; $i++) {
my $comma = "";
if ($current_arg > 1) {
$comma = ', ';
}
# FLOAT, int, long int, long long int
if ($descr[$i] =~ /f|i|l|L/) {
$call_args .= $comma . &beautify ($args[$current_arg]);
++$current_arg;
next;
}
# &FLOAT, &int - simplify call by not showing argument.
if ($descr[$i] =~ /F|I/) {
next;
}
# complex
if ($descr[$i] eq 'c') {
$call_args .= $comma . &build_complex_beautify ($args[$current_arg], $args[$current_arg+1]);
$current_arg += 2;
next;
}
die ("$descr[$i] is unknown");
}
# Result
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
@args_res = @args[$current_arg .. $#args];
$num_res = 0;
@descr = split //,$descr_res;
foreach (@descr) {
if ($_ =~ /f|i|l|L/) {
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
++$num_res;
} elsif ($_ eq 'c') {
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
$num_res += 2;
} elsif ($_ eq 'b') {
# boolean
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
++$num_res;
} elsif ($_ eq '1') {
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
++$num_res;
} else {
die ("$_ is unknown");
}
}
# consistency check
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
if ($#args_res == $num_res - 1) {
# One set of results for all rounding modes, no flags.
@start_rm = ( 0, 0, 0, 0 );
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
} elsif ($#args_res == $num_res) {
# One set of results for all rounding modes, with flags.
die ("wrong number of arguments")
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
unless ($args_res[$#args_res] =~ /EXCEPTION|ERRNO|IGNORE_ZERO_INF_SIGN|TEST_NAN_SIGN|NO_TEST_INLINE|XFAIL_TEST/);
@start_rm = ( 0, 0, 0, 0 );
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
} elsif ($#args_res == 4 * $num_res + 3) {
# One set of results per rounding mode, with flags.
@start_rm = ( 0, $num_res + 1, 2 * $num_res + 2, 3 * $num_res + 3 );
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
} else {
die ("wrong number of arguments");
}
# Put the C program line together
# Reset some variables to start again
$current_arg = 1;
$cline = "{ \"$call_args\"";
@descr = split //,$descr_args;
for ($i=0; $i <= $#descr; $i++) {
# FLOAT, int, long int, long long int
if ($descr[$i] =~ /f|i|l|L/) {
$cline .= ", $args[$current_arg]";
$current_arg++;
next;
}
# &FLOAT, &int
if ($descr[$i] =~ /F|I/) {
next;
}
# complex
if ($descr[$i] eq 'c') {
$cline .= ", $args[$current_arg], $args[$current_arg+1]";
$current_arg += 2;
next;
}
}
@descr = split //,$descr_res;
@plus_oflow = qw(max_value plus_infty max_value plus_infty);
@minus_oflow = qw(minus_infty minus_infty -max_value -max_value);
@plus_uflow = qw(plus_zero plus_zero plus_zero min_subnorm_value);
@minus_uflow = qw(-min_subnorm_value minus_zero minus_zero minus_zero);
@errno_plus_oflow = qw(0 ERRNO_ERANGE 0 ERRNO_ERANGE);
@errno_minus_oflow = qw(ERRNO_ERANGE ERRNO_ERANGE 0 0);
@errno_plus_uflow = qw(ERRNO_ERANGE ERRNO_ERANGE ERRNO_ERANGE 0);
@errno_minus_uflow = qw(0 ERRNO_ERANGE ERRNO_ERANGE ERRNO_ERANGE);
for ($rm = 0; $rm <= 3; $rm++) {
$current_arg = $start_rm[$rm];
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
$ignore_result_any = 0;
$ignore_result_all = 1;
$cline_res = "";
@special = ();
foreach (@descr) {
if ($_ =~ /b|f|i|l|L/ ) {
my ($result) = $args_res[$current_arg];
if ($result eq "IGNORE") {
$ignore_result_any = 1;
$result = "0";
} else {
$ignore_result_all = 0;
}
$cline_res .= ", $result";
$current_arg++;
} elsif ($_ eq 'c') {
my ($result1) = $args_res[$current_arg];
if ($result1 eq "IGNORE") {
$ignore_result_any = 1;
$result1 = "0";
} else {
$ignore_result_all = 0;
}
my ($result2) = $args_res[$current_arg + 1];
if ($result2 eq "IGNORE") {
$ignore_result_any = 1;
$result2 = "0";
} else {
$ignore_result_all = 0;
}
$cline_res .= ", $result1, $result2";
$current_arg += 2;
} elsif ($_ eq '1') {
push @special, $args_res[$current_arg];
++$current_arg;
}
}
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
if ($ignore_result_any && !$ignore_result_all) {
die ("some but not all function results ignored\n");
}
Run libm-test tests for finite-math-only functions. This patch arranges for the libm-test tests to be run for the finite-math-only function variants, in addition to the existing runs for out-of-line and bits/mathinline.h inline variants. gen-libm-test.pl is made to add a flag to all tests with non-finite inputs or outputs so that they can be skipped at runtime when the finite-math-only variants are being tested (skipping is for all rounding modes; that is, -ffinite-math-only is being treated as excluding overflow cases even when the rounding mode is such that the overflowed result is finite). errno setting is not tested for these variants (in general they don't set it, and it's implementation-defined in ISO C whether it's set on underflow, with the glibc definition being that it may not be for -ffinite-math-only; other cases where errno would normally be expected to be set are mostly excluded as having non-finite or overflowing arguments or results). As with the inline function tests, these ones are built with -D__FINITE_MATH_ONLY=1 to select the function variants, rather than -ffinite-math-only. Use of -ffinite-math-only would not be suitable for these tests because it would also affect libm-test.inc code that e.g. tests whether results are infinities or NaNs - if these function variants have bugs that incorrectly produce such results, we want them to show up in the tests, which means the compiler should not be optimizing the tests on the basis of results being finite. The finite-math-only functions share the same ulps settings as the main out-of-line functions. These interfaces were one significant group of untested ABIs listed at <https://sourceware.org/ml/libc-alpha/2013-07/msg00386.html>. I haven't rerun the script to list untested interfaces, but I expect that the vast bulk of interfaces there are still untested and could do with testcases being added (or, if applicable, being made compat symbols; in general, most symbols not starting '_' are safe bets to add tests for, while _* need more investigation of what the actual public API is, if any). I'd like to encourage people to help reduce the accumulation of untested interfaces by adding more tests. Tested for x86_64 and x86. Given my recent lgamma/gamma and log* fixes, the new tests pass (before those fixes, the new tests showed up those bugs, so illustrating the practical utility of having tests for these function variants). * math/libm-test.inc (NON_FINITE): New macro. (enable_test): Do not run tests flagged NON_FINITE if TEST_FINITE. * math/gen-libm-test.pl (show_exceptions): Add argument $non_finite. (parse_args): Update call to show_exceptions. * math/test-math-finite.h: New file. * math/test-math-no-finite.h: Likewise. * math/test-double-finite.c: Likewise. * math/test-float-finite.c: Likewise. * math/test-ldouble-finite.c: Likewise. * math/test-double.c: Include "test-math-no-finite.h". * math/test-float.c: Include "test-math-no-finite.h". * math/test-ldouble.c: Include "test-math-no-finite.h". * math/test-math-inline.h (TEST_FINITE): New macro. * math/test-math-vector.h (TEST_FINITE): Likewise. * math/Makefile (test-longdouble-yes): Add test-ldouble-finite. (libm-tests): Add test-float-finite and test-double-finite. ($(objpfx)test-float-finite.o): New dependency on $(objpfx)libm-test.stmp. ($(objpfx)test-double-finite.o): Likewise. ($(objpfx)test-ldouble-finite.o): Likewise. (libm-test-no-inline-cflags): New variable. (libm-test-finite-cflags): Likewise. (CFLAGS-test-float-finite.c): Likewise. (CFLAGS-test-double-finite.c): Likewise. (CFLAGS-test-ldouble-finite.c): Likewise. (CFLAGS-test-float.c): Use $(libm-test-no-inline-cflags). (CFLAGS-test-double.c): Likewise. (CFLAGS-test-ldouble.c): Likewise.
2015-11-05 23:28:16 +00:00
# Determine whether any arguments or results, for any rounding
# mode, are non-finite.
$non_finite = ($args =~ /qnan_value|plus_infty|minus_infty/);
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
# Add exceptions.
$cline_res .= show_exceptions ($ignore_result_any,
Run libm-test tests for finite-math-only functions. This patch arranges for the libm-test tests to be run for the finite-math-only function variants, in addition to the existing runs for out-of-line and bits/mathinline.h inline variants. gen-libm-test.pl is made to add a flag to all tests with non-finite inputs or outputs so that they can be skipped at runtime when the finite-math-only variants are being tested (skipping is for all rounding modes; that is, -ffinite-math-only is being treated as excluding overflow cases even when the rounding mode is such that the overflowed result is finite). errno setting is not tested for these variants (in general they don't set it, and it's implementation-defined in ISO C whether it's set on underflow, with the glibc definition being that it may not be for -ffinite-math-only; other cases where errno would normally be expected to be set are mostly excluded as having non-finite or overflowing arguments or results). As with the inline function tests, these ones are built with -D__FINITE_MATH_ONLY=1 to select the function variants, rather than -ffinite-math-only. Use of -ffinite-math-only would not be suitable for these tests because it would also affect libm-test.inc code that e.g. tests whether results are infinities or NaNs - if these function variants have bugs that incorrectly produce such results, we want them to show up in the tests, which means the compiler should not be optimizing the tests on the basis of results being finite. The finite-math-only functions share the same ulps settings as the main out-of-line functions. These interfaces were one significant group of untested ABIs listed at <https://sourceware.org/ml/libc-alpha/2013-07/msg00386.html>. I haven't rerun the script to list untested interfaces, but I expect that the vast bulk of interfaces there are still untested and could do with testcases being added (or, if applicable, being made compat symbols; in general, most symbols not starting '_' are safe bets to add tests for, while _* need more investigation of what the actual public API is, if any). I'd like to encourage people to help reduce the accumulation of untested interfaces by adding more tests. Tested for x86_64 and x86. Given my recent lgamma/gamma and log* fixes, the new tests pass (before those fixes, the new tests showed up those bugs, so illustrating the practical utility of having tests for these function variants). * math/libm-test.inc (NON_FINITE): New macro. (enable_test): Do not run tests flagged NON_FINITE if TEST_FINITE. * math/gen-libm-test.pl (show_exceptions): Add argument $non_finite. (parse_args): Update call to show_exceptions. * math/test-math-finite.h: New file. * math/test-math-no-finite.h: Likewise. * math/test-double-finite.c: Likewise. * math/test-float-finite.c: Likewise. * math/test-ldouble-finite.c: Likewise. * math/test-double.c: Include "test-math-no-finite.h". * math/test-float.c: Include "test-math-no-finite.h". * math/test-ldouble.c: Include "test-math-no-finite.h". * math/test-math-inline.h (TEST_FINITE): New macro. * math/test-math-vector.h (TEST_FINITE): Likewise. * math/Makefile (test-longdouble-yes): Add test-ldouble-finite. (libm-tests): Add test-float-finite and test-double-finite. ($(objpfx)test-float-finite.o): New dependency on $(objpfx)libm-test.stmp. ($(objpfx)test-double-finite.o): Likewise. ($(objpfx)test-ldouble-finite.o): Likewise. (libm-test-no-inline-cflags): New variable. (libm-test-finite-cflags): Likewise. (CFLAGS-test-float-finite.c): Likewise. (CFLAGS-test-double-finite.c): Likewise. (CFLAGS-test-ldouble-finite.c): Likewise. (CFLAGS-test-float.c): Use $(libm-test-no-inline-cflags). (CFLAGS-test-double.c): Likewise. (CFLAGS-test-ldouble.c): Likewise.
2015-11-05 23:28:16 +00:00
$non_finite,
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
($current_arg <= $#args_res)
? $args_res[$current_arg]
: undef);
# special treatment for some functions
$i = 0;
foreach (@special) {
++$i;
my ($extra_expected) = $_;
my ($run_extra) = ($extra_expected ne "IGNORE" ? 1 : 0);
if (!$run_extra) {
$extra_expected = "0";
}
$cline_res .= ", $run_extra, $extra_expected";
}
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
$cline_res =~ s/^, //;
$cline_res =~ s/plus_oflow/$plus_oflow[$rm]/g;
$cline_res =~ s/minus_oflow/$minus_oflow[$rm]/g;
$cline_res =~ s/plus_uflow/$plus_uflow[$rm]/g;
$cline_res =~ s/minus_uflow/$minus_uflow[$rm]/g;
$cline_res =~ s/ERRNO_PLUS_OFLOW/$errno_plus_oflow[$rm]/g;
$cline_res =~ s/ERRNO_MINUS_OFLOW/$errno_minus_oflow[$rm]/g;
$cline_res =~ s/ERRNO_PLUS_UFLOW/$errno_plus_uflow[$rm]/g;
$cline_res =~ s/ERRNO_MINUS_UFLOW/$errno_minus_uflow[$rm]/g;
Add libm-test support for per-rounding-mode manually specified results. This patch continues the libm-test move towards automatic testing of all test inputs in all rounding modes by adding gen-libm-test.pl support for tests specifying results in each rounding mode manually. Previously a TEST_* line could specify arguments and results, or arguments, results and flags. Now there is the option of (arguments, results-rd, flags-rd, results-rn, flags-rn, results-rz, flags-rz, results-ru, flags-ru). This is used to replace the separate arrays of results in each rounding mode for lrint, llrint and rint. (In the case of rint, some tests were only in rint_test_data and needed to have expectations for non-default rounding modes added, which I did manually. In various cases there were slight differences in things such as the ordering of tests in the arrays for each mode.) Tested x86_64 and x86. * math/gen-libm-test.pl (parse_args): Handle results specified for each rounding mode separately. * math/libm-test.inc (lrint_test_data): Merge in per-rounding-mode tests and results from lrint_tonearest_test_data, lrint_towardzero_test_data, lrint_downward_test_data and lrint_upward_test_data. (lrint_test): Use ALL_RM_TEST. (lrint_tonearest_test_data): Remove. (lrint_test_tonearest): Likewise. (lrint_towardzero_test_data): Likewise. (lrint_test_towardzero): Likewise. (lrint_downward_test_data): Likewise. (lrint_test_downward): Likewise. (lrint_upward_test_data): Likewise. (lrint_test_upward): Likewise. (llrint_test_data): Merge in per-rounding-mode tests and results from llrint_tonearest_test_data, llrint_towardzero_test_data, llrint_downward_test_data and llrint_upward_test_data. (llrint_test): Use ALL_RM_TEST. (llrint_tonearest_test_data): Remove. (llrint_test_tonearest): Likewise. (llrint_towardzero_test_data): Likewise. (llrint_test_towardzero): Likewise. (llrint_downward_test_data): Likewise. (llrint_test_downward): Likewise. (llrint_upward_test_data): Likewise. (llrint_test_upward): Likewise. (rint_test_data): Merge in per-rounding-mode tests and results from rint_tonearest_test_data, rint_towardzero_test_data, rint_downward_test_data and rint_upward_test_data. Add per-rounding-mode results for tests not in those arrays. (rint_test): Use ALL_RM_TEST. (rint_tonearest_test_data): Remove. (rint_test_tonearest): Likewise. (rint_towardzero_test_data): Likewise. (rint_test_towardzero): Likewise. (rint_downward_test_data): Likewise. (rint_test_downward): Likewise. (rint_upward_test_data): Likewise. (rint_test_upward): Likewise. (main): Don't call removed functions.
2014-03-17 12:29:26 +00:00
$cline .= ", { $cline_res }";
}
print $file " $cline },\n";
}
# Convert a condition from auto-libm-test-out to C form.
sub convert_condition {
my ($cond) = @_;
my (@conds, $ret);
@conds = split /:/, $cond;
foreach (@conds) {
s/-/_/g;
s/^/TEST_COND_/;
}
$ret = join " && ", @conds;
return "($ret)";
}
# Return text to OR a value into an accumulated flags string.
sub or_value {
my ($cond) = @_;
if ($cond eq "0") {
return "";
} else {
return " | $cond";
}
}
Adjust how gen-auto-libm-tests handles before-rounding/after-rounding cases. 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.
2014-03-06 14:11:19 +00:00
# Return a conditional expression between two values.
sub cond_value {
my ($cond, $if, $else) = @_;
if ($cond eq "1") {
Adjust how gen-auto-libm-tests handles before-rounding/after-rounding cases. 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.
2014-03-06 14:11:19 +00:00
return $if;
} elsif ($cond eq "0") {
Adjust how gen-auto-libm-tests handles before-rounding/after-rounding cases. 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.
2014-03-06 14:11:19 +00:00
return $else;
} else {
Adjust how gen-auto-libm-tests handles before-rounding/after-rounding cases. 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.
2014-03-06 14:11:19 +00:00
return "($cond ? $if : $else)";
}
}
Adjust how gen-auto-libm-tests handles before-rounding/after-rounding cases. 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.
2014-03-06 14:11:19 +00:00
# Return text to OR a conditional expression between two values into
# an accumulated flags string.
sub or_cond_value {
my ($cond, $if, $else) = @_;
return or_value (cond_value ($cond, $if, $else));
}
# Generate libm-test.c
sub generate_testfile {
my ($input, $output) = @_;
open INPUT, $input or die ("Can't open $input: $!");
open OUTPUT, ">$output" or die ("Can't open $output: $!");
# Replace the special macros
while (<INPUT>) {
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
# AUTO_TESTS (function),
if (/^\s*AUTO_TESTS_/) {
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
my ($descr, $func, @modes, $auto_test, $num_auto_tests);
my (@rm_tests, $rm, $i);
@modes = qw(downward tonearest towardzero upward);
($descr, $func) = ($_ =~ /AUTO_TESTS_(\w+)\s*\((\w+)\)/);
for ($rm = 0; $rm <= 3; $rm++) {
$rm_tests[$rm] = [sort keys %{$auto_tests{$func}{$modes[$rm]}}];
}
$num_auto_tests = scalar @{$rm_tests[0]};
for ($rm = 1; $rm <= 3; $rm++) {
if ($num_auto_tests != scalar @{$rm_tests[$rm]}) {
die ("inconsistent numbers of tests for $func\n");
}
for ($i = 0; $i < $num_auto_tests; $i++) {
if ($rm_tests[0][$i] ne $rm_tests[$rm][$i]) {
die ("inconsistent list of tests of $func\n");
}
}
}
if ($num_auto_tests == 0) {
die ("no automatic tests for $func\n");
}
foreach $auto_test (@{$rm_tests[0]}) {
my ($format, $inputs, $format_conv, $args_str);
($format, $inputs) = split / /, $auto_test, 2;
$inputs =~ s/ /, /g;
$format_conv = convert_condition ($format);
print OUTPUT "#if $format_conv\n";
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
$args_str = "$func, $inputs";
for ($rm = 0; $rm <= 3; $rm++) {
my ($auto_test_out, $outputs, $flags);
my ($flags_conv, @flags, %flag_cond);
$auto_test_out = $auto_tests{$func}{$modes[$rm]}{$auto_test};
($outputs, $flags) = split / : */, $auto_test_out;
$outputs =~ s/ /, /g;
@flags = split / /, $flags;
foreach (@flags) {
if (/^([^:]*):(.*)$/) {
my ($flag, $cond);
$flag = $1;
$cond = convert_condition ($2);
if (defined ($flag_cond{$flag})) {
if ($flag_cond{$flag} ne "1") {
$flag_cond{$flag} .= " || $cond";
}
} else {
$flag_cond{$flag} = $cond;
}
} else {
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
$flag_cond{$_} = "1";
}
}
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
$flags_conv = "";
Test cpow in all rounding modes. This patch enables testing of cpow in all rounding modes using ALL_RM_TEST. There were two reasons this was previously deferred: * MPC has complicated rounding-mode-dependent rules for the signs of exact zero real or imaginary parts in the result of mpc_pow. Annex G does not impose any such requirements and I don't think glibc should try to implement any particular logic here. This patch adds support for gen-auto-libm-tests passing the IGNORE_ZERO_INF_SIGN flag to libm-test.inc. * Error accumulations in some tests in non-default rounding modes exceed the maximum error permitted in libm-test.inc. This patch marks the problem tests with xfail-rounding. (It might be possible to reduce the accumulations a bit by using round-to-nearest when cpow calls clog, but I don't think there's much point; the implementation approach for cpow is fundamentally deficient, as discussed in the existing bug for cpow inaccuracy which can reasonably be considered to cover these less-inaccurate cases as well. It's possible that the test "cpow 2 0 10 0" will also need xfail-rounding on some platforms.) Tested x86_64 and x86 and ulps updated accordingly. * math/gen-auto-libm-tests.c: Document use of ignore-zero-inf-sign. (input_flag_type): Add value flag_ignore_zero_inf_sign. (input_flags): Add ignore-zero-inf-sign. (output_for_one_input_case): Handle flag_ignore_zero_inf_sign. * math/gen-libm-test.pl (generate_testfile): Handle ignore-zero-inf-sign. * math/auto-libm-test-in: Mark some cpow tests with ignore-zero-inf-sign and some with xfail-rounding. * math/auto-libm-test-out: Regenerated. * math/libm-test.inc (cpow_test): Use ALL_RM_TEST. * sysdeps/i386/fpu/libm-test-ulps: Update. * sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2014-06-23 20:15:14 +00:00
if (defined ($flag_cond{"ignore-zero-inf-sign"})) {
$flags_conv .= or_cond_value ($flag_cond{"ignore-zero-inf-sign"},
"IGNORE_ZERO_INF_SIGN", "0");
}
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
if (defined ($flag_cond{"no-test-inline"})) {
$flags_conv .= or_cond_value ($flag_cond{"no-test-inline"},
"NO_TEST_INLINE", "0");
Adjust how gen-auto-libm-tests handles before-rounding/after-rounding cases. 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.
2014-03-06 14:11:19 +00:00
}
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
if (defined ($flag_cond{"xfail"})) {
$flags_conv .= or_cond_value ($flag_cond{"xfail"},
"XFAIL_TEST", "0");
}
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
my (@exc_list) = qw(divbyzero inexact invalid overflow underflow);
my ($exc);
foreach $exc (@exc_list) {
my ($exc_expected, $exc_ok, $no_exc, $exc_cond, $exc_ok_cond);
$exc_expected = "\U$exc\E_EXCEPTION";
$exc_ok = "\U$exc\E_EXCEPTION_OK";
$no_exc = "0";
if ($exc eq "inexact") {
$exc_ok = "0";
$no_exc = "NO_INEXACT_EXCEPTION";
}
if (defined ($flag_cond{$exc})) {
$exc_cond = $flag_cond{$exc};
} else {
$exc_cond = "0";
}
if (defined ($flag_cond{"$exc-ok"})) {
$exc_ok_cond = $flag_cond{"$exc-ok"};
} else {
$exc_ok_cond = "0";
}
$flags_conv .= or_cond_value ($exc_cond,
cond_value ($exc_ok_cond,
$exc_ok, $exc_expected),
cond_value ($exc_ok_cond,
$exc_ok, $no_exc));
}
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
my ($errno_expected, $errno_unknown_cond);
if (defined ($flag_cond{"errno-edom"})) {
if ($flag_cond{"errno-edom"} ne "1") {
die ("unexpected condition for errno-edom");
}
if (defined ($flag_cond{"errno-erange"})) {
die ("multiple errno values expected");
}
$errno_expected = "ERRNO_EDOM";
} elsif (defined ($flag_cond{"errno-erange"})) {
if ($flag_cond{"errno-erange"} ne "1") {
die ("unexpected condition for errno-erange");
}
$errno_expected = "ERRNO_ERANGE";
} else {
$errno_expected = "ERRNO_UNCHANGED";
}
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
if (defined ($flag_cond{"errno-edom-ok"})) {
if (defined ($flag_cond{"errno-erange-ok"})
&& ($flag_cond{"errno-erange-ok"}
ne $flag_cond{"errno-edom-ok"})) {
$errno_unknown_cond = "($flag_cond{\"errno-edom-ok\"} || $flag_cond{\"errno-erange-ok\"})";
} else {
$errno_unknown_cond = $flag_cond{"errno-edom-ok"};
}
} elsif (defined ($flag_cond{"errno-erange-ok"})) {
$errno_unknown_cond = $flag_cond{"errno-erange-ok"};
} else {
$errno_unknown_cond = "0";
}
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
$flags_conv .= or_cond_value ($errno_unknown_cond,
"0", $errno_expected);
if ($flags_conv eq "") {
$flags_conv = ", NO_EXCEPTION";
} else {
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
$flags_conv =~ s/^ \|/,/;
}
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
$args_str .= ", $outputs$flags_conv";
}
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
&parse_args (\*OUTPUT, $descr, $args_str);
print OUTPUT "#endif\n";
}
next;
}
# TEST_...
if (/^\s*TEST_/) {
my ($descr, $args);
chop;
($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
&parse_args (\*OUTPUT, $descr, $args);
next;
}
print OUTPUT;
}
close INPUT;
close OUTPUT;
}
# Parse ulps file
sub parse_ulps {
my ($file) = @_;
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
my ($test, $type, $float, $eps);
# $type has the following values:
# "normal": No complex variable
# "real": Real part of complex result
# "imag": Imaginary part of complex result
open ULP, $file or die ("Can't open $file: $!");
while (<ULP>) {
chop;
# ignore comments and empty lines
next if /^#/;
next if /^\s*$/;
if (/^Function: /) {
2000-08-30 16:32:14 +00:00
if (/Real part of/) {
s/Real part of //;
$type = 'real';
} elsif (/Imaginary part of/) {
s/Imaginary part of //;
$type = 'imag';
} else {
$type = 'normal';
}
($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
next;
}
if (/^i?(float|double|ldouble):/) {
($float, $eps) = split /\s*:\s*/,$_,2;
if ($eps eq "0") {
# ignore
next;
} else {
$results{$test}{$type}{'ulp'}{$float} = $eps;
$results{$test}{'has_ulps'} = 1;
}
if ($type =~ /^real|imag$/) {
$results{$test}{'type'} = 'complex';
} elsif ($type eq 'normal') {
$results{$test}{'type'} = 'normal';
}
next;
}
print "Skipping unknown entry: `$_'\n";
}
close ULP;
}
# Clean up a floating point number
sub clean_up_number {
my ($number) = @_;
# Remove trailing zeros after the decimal point
if ($number =~ /\./) {
$number =~ s/0+$//;
$number =~ s/\.$//;
}
return $number;
}
# Output a file which can be read in as ulps file.
sub print_ulps_file {
my ($file) = @_;
my ($test, $type, $float, $eps, $fct, $last_fct);
$last_fct = '';
open NEWULP, ">$file" or die ("Can't open $file: $!");
print NEWULP "# Begin of automatic generation\n";
print NEWULP "\n# Maximal error of functions:\n";
foreach $fct (sort keys %results) {
foreach $type ('real', 'imag', 'normal') {
if (exists $results{$fct}{$type}) {
if ($type eq 'normal') {
print NEWULP "Function: \"$fct\":\n";
} elsif ($type eq 'real') {
print NEWULP "Function: Real part of \"$fct\":\n";
} elsif ($type eq 'imag') {
print NEWULP "Function: Imaginary part of \"$fct\":\n";
}
foreach $float (@all_floats) {
if (exists $results{$fct}{$type}{'ulp'}{$float}) {
print NEWULP "$float: ",
&clean_up_number ($results{$fct}{$type}{'ulp'}{$float}),
"\n";
}
}
print NEWULP "\n";
}
}
}
print NEWULP "# end of automatic generation\n";
close NEWULP;
}
sub get_ulps {
my ($test, $type, $float) = @_;
return (exists $results{$test}{$type}{'ulp'}{$float}
? $results{$test}{$type}{'ulp'}{$float} : "0");
}
# Return the ulps value for a single test.
sub get_all_ulps_for_test {
my ($test, $type) = @_;
my ($ldouble, $double, $float, $ildouble, $idouble, $ifloat);
if (exists $results{$test}{'has_ulps'}) {
# XXX use all_floats (change order!)
$ldouble = &get_ulps ($test, $type, "ldouble");
$double = &get_ulps ($test, $type, "double");
$float = &get_ulps ($test, $type, "float");
$ildouble = &get_ulps ($test, $type, "ildouble");
$idouble = &get_ulps ($test, $type, "idouble");
$ifloat = &get_ulps ($test, $type, "ifloat");
return "CHOOSE ($ldouble, $double, $float, $ildouble, $idouble, $ifloat)";
} else {
die "get_all_ulps_for_test called for \"$test\" with no ulps\n";
}
}
# Print include file
sub output_ulps {
my ($file, $ulps_filename) = @_;
my ($i, $fct, $type, $ulp, $ulp_real, $ulp_imag);
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
my (%func_ulps, %func_real_ulps, %func_imag_ulps);
open ULP, ">$file" or die ("Can't open $file: $!");
print ULP "/* This file is automatically generated\n";
print ULP " from $ulps_filename with gen-libm-test.pl.\n";
print ULP " Don't change it - change instead the master files. */\n\n";
foreach $fct (keys %results) {
$type = $results{$fct}{'type'};
if ($type eq 'normal') {
$ulp = get_all_ulps_for_test ($fct, 'normal');
} elsif ($type eq 'complex') {
$ulp_real = get_all_ulps_for_test ($fct, 'real');
$ulp_imag = get_all_ulps_for_test ($fct, 'imag');
} else {
die "unknown results ($fct) type $type\n";
}
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
if ($type eq 'normal') {
$func_ulps{$fct} = $ulp;
} else {
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
$func_real_ulps{$fct} = $ulp_real;
$func_imag_ulps{$fct} = $ulp_imag;
}
}
print ULP "\n/* Maximal error of functions. */\n";
print ULP "static const struct ulp_data func_ulps[] =\n {\n";
foreach $fct (sort keys %func_ulps) {
print ULP " { \"$fct\", $func_ulps{$fct} },\n";
}
print ULP " };\n";
print ULP "static const struct ulp_data func_real_ulps[] =\n {\n";
foreach $fct (sort keys %func_real_ulps) {
print ULP " { \"$fct\", $func_real_ulps{$fct} },\n";
}
print ULP " };\n";
print ULP "static const struct ulp_data func_imag_ulps[] =\n {\n";
foreach $fct (sort keys %func_imag_ulps) {
print ULP " { \"$fct\", $func_imag_ulps{$fct} },\n";
}
print ULP " };\n";
close ULP;
}
# Parse auto-libm-test-out.
sub parse_auto_input {
my ($file) = @_;
open AUTO, $file or die ("Can't open $file: $!");
while (<AUTO>) {
chop;
next if !/^= /;
s/^= //;
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*. This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
2014-03-20 11:48:07 +00:00
if (/^(\S+) (\S+) ([^:]*) : (.*)$/) {
$auto_tests{$1}{$2}{$3} = $4;
} else {
die ("bad automatic test line: $_\n");
}
}
close AUTO;
}