diff options
Diffstat (limited to 'math')
| -rw-r--r-- | math/Makefile | 26 | ||||
| -rw-r--r-- | math/README.libm-test | 20 | ||||
| -rwxr-xr-x | math/gen-libm-test.pl | 846 | ||||
| -rwxr-xr-x | math/gen-libm-test.py | 603 | ||||
| -rw-r--r-- | math/libm-test-driver.c | 2 | ||||
| -rw-r--r-- | math/libm-test-nexttoward.inc | 2 | ||||
| -rw-r--r-- | math/libm-test-support.c | 2 | ||||
| -rw-r--r-- | math/libm-test-support.h | 4 |
8 files changed, 631 insertions, 874 deletions
diff --git a/math/Makefile b/math/Makefile index 90b3b68916..d78f40f741 100644 --- a/math/Makefile +++ b/math/Makefile @@ -252,7 +252,7 @@ tests += test-math-isinff test-math-iszero test-math-issignaling \ test-math-iscanonical test-math-cxx11 test-math-iseqsig endif -ifneq (no,$(PERL)) +ifdef PYTHON libm-vec-tests = $(addprefix test-,$(libmvec-tests)) libm-test-support = $(foreach t,$(test-types),libm-test-support-$(t)) test-extras += $(libm-test-support) @@ -263,9 +263,9 @@ extra-test-objs += $(addsuffix .o, $(libm-vec-test-wrappers)) ulps-file = $(firstword $(wildcard $(sysdirs:%=%/libm-test-ulps))) -$(objpfx)libm-test-ulps.h: $(ulps-file) gen-libm-test.pl +$(objpfx)libm-test-ulps.h: $(ulps-file) gen-libm-test.py $(make-target-directory) - $(PERL) gen-libm-test.pl -u $< -H $@ + $(PYTHON) gen-libm-test.py -u $< -H $@ libm-test-funcs-auto = acos acosh asin asinh atan atan2 atanh cabs cacos \ cacosh carg casin casinh catan catanh cbrt ccos ccosh \ @@ -333,21 +333,21 @@ libm-test-c-noauto-obj = $(addprefix $(objpfx),$(libm-test-c-noauto)) libm-test-c-narrow-obj = $(addprefix $(objpfx),$(libm-test-c-narrow)) $(libm-test-c-noauto-obj): $(objpfx)libm-test%.c: libm-test%.inc \ - gen-libm-test.pl + gen-libm-test.py $(make-target-directory) - $(PERL) gen-libm-test.pl -c $< -a /dev/null -C $@ + $(PYTHON) gen-libm-test.py -c $< -a /dev/null -C $@ $(libm-test-c-auto-obj): $(objpfx)libm-test%.c: libm-test%.inc \ - gen-libm-test.pl \ + gen-libm-test.py \ auto-libm-test-out% $(make-target-directory) - $(PERL) gen-libm-test.pl -c $< -a auto-libm-test-out$* -C $@ + $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@ $(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \ - gen-libm-test.pl \ + gen-libm-test.py \ auto-libm-test-out% $(make-target-directory) - $(PERL) gen-libm-test.pl -c $< -a auto-libm-test-out$* -C $@ + $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@ endif ifdef PYTHON @@ -473,7 +473,7 @@ $(objpfx)gen-libm-templates.stmp: Makefile $(foreach t, $(call type-foreach, $(gen-all-calls)), \ $(objpfx)$(t).c): $(objpfx)gen-libm-templates.stmp -ifneq (no,$(PERL)) +ifdef PYTHON # This must come after the inclusion of sysdeps Makefiles via Rules. $(foreach t,$(libm-tests-normal),$(objpfx)$(t).c): $(objpfx)test-%.c: @@ -628,15 +628,15 @@ regen-ulps: $(addprefix $(objpfx),$(libm-tests)) cat $(objpfx)ULPs >> $(objpfx)libm-test-ulps; \ rm $(objpfx)ULPs; \ done; \ - $(PERL) gen-libm-test.pl -n $(objpfx)NewUlps \ - -u $(objpfx)libm-test-ulps; \ + $(PYTHON) gen-libm-test.py -n $(objpfx)NewUlps \ + -u $(objpfx)libm-test-ulps; \ echo "Automatic regeneration of ULPs complete."; \ echo "Difference between the current baseline and the new baseline is:";\ diff -urN $(ulps-file) $(objpfx)NewUlps; \ echo "Copy $(objpfx)NewUlps to $(ulps-file) (relative to source)." else regen-ulps: - @echo "Automatic regeneration of ULPs requires perl."; \ + @echo "Automatic regeneration of ULPs requires python."; \ exit 1; endif diff --git a/math/README.libm-test b/math/README.libm-test index 41702c6537..53172bbff8 100644 --- a/math/README.libm-test +++ b/math/README.libm-test @@ -3,10 +3,10 @@ README for libm-test math test suite The libm-test math test suite tests a number of function points of math functions in the GNU C library. The following sections contain a -brief overview. Please note that the test drivers and the Perl script -"gen-libm-test.pl" have some options. A full list of options is -available with --help (for the test drivers) and -h for -"gen-libm-test.pl". +brief overview. Please note that the test drivers and the Python +script "gen-libm-test.py" have some options. A full list of options +is available with --help (for the test drivers) and -h for +"gen-libm-test.py". What is tested? @@ -25,8 +25,8 @@ The main files are "libm-test-<func>.inc". They are independent of the target platform and the specific real floating type and format and contain placeholder test "templates" for math functions defined in libm. These files, along with generated files named -"auto-libm-test-out-<func>", are preprocessed by the Perl script -"gen-libm-test.pl" to expand the templates and produce a set of test +"auto-libm-test-out-<func>", are preprocessed by the Python script +"gen-libm-test.py" to expand the templates and produce a set of test cases for each math function that are specific to the target platform but still independent of the real floating type. The results of the processing are "libm-test-<func>.c" and a file "libm-test-ulps.h" with @@ -48,7 +48,7 @@ defines or undefines the __NO_MATH_INLINES macro just before including respectively. Each driver is compiled into a single executable test program with the corresponding name. -As mentioned above, the "gen-libm-test.pl" script looks for a file +As mentioned above, the "gen-libm-test.py" script looks for a file named "libm-test-ulps" in the platform specific sysdep directory (or its fpu or nofpu subdirectory) and for each variant (real floating type and rounding mode) of every tested function reads from it the @@ -80,17 +80,17 @@ This generates a file "ULPs" with all double ULPs in it, ignoring any previously calculated ULPs, and running with the newly built dynamic loader and math library (assumes you didn't install your build). Now generate the ULPs for all other formats, the tests will be appending the -data to the "ULPs" file. As final step run "gen-libm-test.pl" with the +data to the "ULPs" file. As final step run "gen-libm-test.py" with the file as input and ask to generate a pretty printed output in the file "NewUlps": - gen-libm-test.pl -u ULPs -n NewUlps + gen-libm-test.py -u ULPs -n NewUlps Copy "NewUlps" to "libm-test-ulps" in the appropriate machine sysdep directory. Note that the test drivers have an option "-u" to output an unsorted list of all epsilons that the functions have. The output can be read in directly but it's better to pretty print it first. -"gen-libm-test.pl" has an option to generate a pretty-printed and +"gen-libm-test.py" has an option to generate a pretty-printed and sorted new ULPs file from the output of the test drivers. Contents of libm-test-ulps diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl deleted file mode 100755 index 664fba5909..0000000000 --- a/math/gen-libm-test.pl +++ /dev/null @@ -1,846 +0,0 @@ -#!/usr/bin/perl -w -# Copyright (C) 1999-2018 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 %all_floats_pfx); -use vars qw ($ulps_file); -use vars qw (%auto_tests); - -# all_floats is sorted and contains all recognised float types -@all_floats = ('double', 'float', 'float128', 'idouble', - 'ifloat', 'ifloat128', 'ildouble', 'ldouble'); - -# all_floats_pfx maps C types to their C like prefix for macros. -%all_floats_pfx = - ( "double" => "DBL", - "ldouble" => "LDBL", - "float" => "FLT", - "float128" => "FLT128", - ); - -%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", - "snan_value" => "sNaN", - "snan_value_ld" => "sNaN", - ); - - -# get Options -# Options: -# a: auto-libm-test-out input file -# c: .inc input file -# u: ulps-file -# n: new ulps file -# C: libm-test.c output file -# H: libm-test-ulps.h output file -# h: help -use vars qw($opt_a $opt_c $opt_u $opt_n $opt_C $opt_H $opt_h); -getopts('a:c:u:n:C:H:h'); - -$ulps_file = 'libm-test-ulps'; - -if ($opt_h) { - print "Usage: gen-libm-test.pl [OPTIONS]\n"; - print " -h print this help, then exit\n"; - print " -a FILE input file with automatically generated tests\n"; - print " -c FILE input file .inc file with tests\n"; - print " -u FILE input file with ulps\n"; - print " -n FILE generate sorted file FILE from libm-test-ulps\n"; - print " -C FILE generate output C file FILE from libm-test.inc\n"; - print " -H FILE generate output ulps header FILE from libm-test-ulps\n"; - exit 0; -} - -$ulps_file = $opt_u if ($opt_u); - -$input = $opt_c if ($opt_c); -$auto_input = $opt_a if ($opt_a); -$output = $opt_C if ($opt_C); - -&parse_ulps ($ulps_file) if ($opt_H || $opt_n); -&parse_auto_input ($auto_input) if ($opt_C); -&generate_testfile ($input, $output) if ($opt_C); -&output_ulps ($opt_H, $ulps_file) if ($opt_H); -&print_ulps_file ($opt_n) 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 { - my ($ignore_result, $non_finite, $test_snan, $exception) = @_; - $ignore_result = ($ignore_result ? "IGNORE_RESULT|" : ""); - $non_finite = ($non_finite ? "NON_FINITE|" : ""); - $test_snan = ($test_snan ? "TEST_SNAN|" : ""); - if (defined $exception) { - return ", ${ignore_result}${non_finite}${test_snan}$exception"; - } else { - return ", ${ignore_result}${non_finite}${test_snan}0"; - } -} - -# Apply the LIT(x) or ARG_LIT(x) macro to a literal floating point constant -# and strip any existing suffix. -sub _apply_lit { - my ($macro, $lit) = @_; - my $exp_re = "([+-])?[[:digit:]]+"; - # Don't wrap something that does not look like a: - # * Hexadecimal FP value - # * Decimal FP value without a decimal point - # * Decimal value with a fraction - return $lit if $lit !~ /([+-])?0x[[:xdigit:]\.]+[pP]$exp_re/ - and $lit !~ /[[:digit:]]+[eE]$exp_re/ - and $lit !~ /[[:digit:]]*\.[[:digit:]]*([eE]$exp_re)?/; - - # Strip any existing literal suffix. - $lit =~ s/[lLfF]$//; - - return "$macro (${lit})"; -} - -# Apply LIT macro to individual tokens within an expression. -# -# This function assumes the C expression follows GNU coding -# standards. Specifically, a space separates each lexical -# token. Otherwise, this post-processing may apply LIT -# incorrectly, or around an entire expression. -sub apply_lit { - my ($lit) = @_; - my @toks = split (/ /, $lit); - foreach (@toks) { - $_ = _apply_lit ("LIT", $_); - } - return join (' ', @toks); -} - -# Likewise, but apply ARG_LIT for arguments to narrowing functions. -sub apply_arglit { - my ($lit) = @_; - my @toks = split (/ /, $lit); - foreach (@toks) { - $_ = _apply_lit ("ARG_LIT", $_); - } - return join (' ', @toks); -} - -# Parse the arguments to TEST_x_y -sub parse_args { - my ($file, $descr, $args) = @_; - my (@args, $descr_args, $descr_res, @descr); - 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); - my (@xfail_rounding_ibm128_libgcc); - my ($non_finite, $test_snan); - - ($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, ARG_FLOAT, long double, int, unsigned int, long int, long long int - if ($descr[$i] =~ /f|a|j|i|u|l|L/) { - $call_args .= $comma . &beautify ($args[$current_arg]); - ++$current_arg; - next; - } - # Argument passed via pointer. - if ($descr[$i] =~ /p/) { - 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 - @args_res = @args[$current_arg .. $#args]; - $num_res = 0; - @descr = split //,$descr_res; - foreach (@descr) { - if ($_ =~ /f|i|l|L|M|U/) { - ++$num_res; - } elsif ($_ eq 'c') { - $num_res += 2; - } elsif ($_ eq 'b') { - # boolean - ++$num_res; - } elsif ($_ eq '1') { - ++$num_res; - } else { - die ("$_ is unknown"); - } - } - # consistency check - if ($#args_res == $num_res - 1) { - # One set of results for all rounding modes, no flags. - @start_rm = ( 0, 0, 0, 0 ); - } elsif ($#args_res == $num_res) { - # One set of results for all rounding modes, with flags. - die ("wrong number of arguments") - unless ($args_res[$#args_res] =~ /EXCEPTION|ERRNO|IGNORE_ZERO_INF_SIGN|TEST_NAN_SIGN|NO_TEST_INLINE|XFAIL/); - @start_rm = ( 0, 0, 0, 0 ); - } 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 ); - } else { - die ("wrong number of arguments"); - } - - # Put the C program line together - # Reset some variables to start again - $current_arg = 1; - $call_args =~ s/\"/\\\"/g; - $cline = "{ \"$call_args\""; - @descr = split //,$descr_args; - for ($i=0; $i <= $#descr; $i++) { - # FLOAT, ARG_FLOAT, long double, int, unsigned int, long int, long long int - if ($descr[$i] =~ /f|a|j|i|u|l|L/) { - if ($descr[$i] eq "f") { - $cline .= ", " . &apply_lit ($args[$current_arg]); - } elsif ($descr[$i] eq "a") { - $cline .= ", " . &apply_arglit ($args[$current_arg]); - } else { - $cline .= ", $args[$current_arg]"; - } - $current_arg++; - next; - } - # &FLOAT, &int, argument passed via pointer - if ($descr[$i] =~ /F|I|p/) { - next; - } - # complex - if ($descr[$i] eq 'c') { - $cline .= ", " . &apply_lit ($args[$current_arg]); - $cline .= ", " . &apply_lit ($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); - @xfail_rounding_ibm128_libgcc = qw(XFAIL_IBM128_LIBGCC 0 - XFAIL_IBM128_LIBGCC XFAIL_IBM128_LIBGCC); - for ($rm = 0; $rm <= 3; $rm++) { - $current_arg = $start_rm[$rm]; - $ignore_result_any = 0; - $ignore_result_all = 1; - $cline_res = ""; - @special = (); - foreach (@descr) { - if ($_ =~ /b|f|j|i|l|L|M|U/ ) { - my ($result) = $args_res[$current_arg]; - if ($result eq "IGNORE") { - $ignore_result_any = 1; - $result = "0"; - } else { - $ignore_result_all = 0; - } - if ($_ eq "f") { - $result = apply_lit ($result); - } - $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; - } - $result1 = apply_lit ($result1); - $result2 = apply_lit ($result2); - $cline_res .= ", $result1, $result2"; - $current_arg += 2; - } elsif ($_ eq '1') { - push @special, $args_res[$current_arg]; - ++$current_arg; - } - } - if ($ignore_result_any && !$ignore_result_all) { - die ("some but not all function results ignored\n"); - } - # Determine whether any arguments or results, for any rounding - # mode, are non-finite. - $non_finite = ($args =~ /qnan_value|snan_value|plus_infty|minus_infty/); - $test_snan = ($args =~ /snan_value/); - # Add exceptions. - $cline_res .= show_exceptions ($ignore_result_any, - $non_finite, - $test_snan, - ($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"; - } else { - $extra_expected = apply_lit ($extra_expected); - } - $cline_res .= ", $run_extra, $extra_expected"; - } - $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; - $cline_res =~ s/XFAIL_ROUNDING_IBM128_LIBGCC/$xfail_rounding_ibm128_libgcc[$rm]/g; - $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) { - if ($_ !~ /^arg_fmt\(/) { - 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"; - } -} - -# Return a conditional expression between two values. -sub cond_value { - my ($cond, $if, $else) = @_; - if ($cond eq "1") { - return $if; - } elsif ($cond eq "0") { - return $else; - } else { - return "($cond ? $if : $else)"; - } -} - -# 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>) { - # AUTO_TESTS (function), - if (/^\s*AUTO_TESTS_/) { - 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"; - $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 = |
