2 # Copyright (C) 1999-2017 Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
4 # Contributed by Andreas Jaeger <aj@suse.de>, 1999.
6 # The GNU C Library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
11 # The GNU C Library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, see
18 # <http://www.gnu.org/licenses/>.
20 # This file needs to be tidied up
21 # Note that functions and tests share the same namespace.
23 # Information about tests are stored in: %results
24 # $results{$test}{"type"} is the result type, e.g. normal or complex.
25 # $results{$test}{"has_ulps"} is set if deltas exist.
26 # In the following description $type and $float are:
27 # - $type is either "normal", "real" (for the real part of a complex number)
28 # or "imag" (for the imaginary part # of a complex number).
29 # - $float is either of float, ifloat, double, idouble, ldouble, ildouble;
30 # It represents the underlying floating point type (float, double or long
31 # double) and if inline functions (the leading i stands for inline)
33 # $results{$test}{$type}{"ulp"}{$float} is defined and has a delta as value
40 use vars qw
($input $output $auto_input);
41 use vars qw
(%results);
42 use vars qw
(%beautify @all_floats %all_floats_pfx);
43 use vars qw
($ulps_file);
44 use vars qw
(%auto_tests);
46 # all_floats is sorted and contains all recognised float types
47 @all_floats = ('double', 'float', 'float128', 'idouble',
48 'ifloat', 'ifloat128', 'ildouble', 'ldouble');
50 # all_floats_pfx maps C types to their C like prefix for macros.
55 "float128" => "FLT128",
59 ( "minus_zero" => "-0",
67 "minus_infty" => "-inf",
68 "plus_infty" => "inf",
69 "qnan_value" => "qNaN",
70 "snan_value" => "sNaN",
71 "snan_value_ld" => "sNaN",
77 # a: auto-libm-test-out input file
81 # C: libm-test.c output file
82 # H: libm-test-ulps.h output file
84 use vars
qw($opt_a $opt_c $opt_u $opt_n $opt_C $opt_H $opt_h);
85 getopts('a:c:u:n:C:H:h');
87 $ulps_file = 'libm-test-ulps';
90 print "Usage: gen-libm-test.pl [OPTIONS]\n";
91 print " -h print this help, then exit\n";
92 print " -a FILE input file with automatically generated tests\n";
93 print " -c FILE input file .inc file with tests\n";
94 print " -u FILE input file with ulps\n";
95 print " -n FILE generate sorted file FILE from libm-test-ulps\n";
96 print " -C FILE generate output C file FILE from libm-test.inc\n";
97 print " -H FILE generate output ulps header FILE from libm-test-ulps\n";
101 $ulps_file = $opt_u if ($opt_u);
103 $input = $opt_c if ($opt_c);
104 $auto_input = $opt_a if ($opt_a);
105 $output = $opt_C if ($opt_C);
107 &parse_ulps ($ulps_file) if ($opt_H || $opt_n);
108 &parse_auto_input ($auto_input) if ($opt_C);
109 &generate_testfile ($input, $output) if ($opt_C);
110 &output_ulps ($opt_H, $ulps_file) if ($opt_H);
111 &print_ulps_file ($opt_n) if ($opt_n);
113 # Return a nicer representation
118 if (exists $beautify{$arg}) {
119 return $beautify{$arg};
124 if (exists $beautify{$tmp}) {
125 return '-' . $beautify{$tmp};
128 if ($arg =~ /^-?0x[0-9a-f.]*p[-+][0-9]+f$/) {
131 if ($arg =~ /[0-9]L$/) {
137 # Return a nicer representation of a complex number
138 sub build_complex_beautify {
142 $str1 = &beautify ($r);
143 $str2 = &beautify ($i);
146 $str1 .= ' - ' . $str2;
148 $str1 .= ' + ' . $str2;
154 # Return the text to put in an initializer for a test's exception
156 sub show_exceptions {
157 my ($ignore_result, $non_finite, $test_snan, $exception) = @_;
158 $ignore_result = ($ignore_result ? "IGNORE_RESULT|" : "");
159 $non_finite = ($non_finite ? "NON_FINITE|" : "");
160 $test_snan = ($test_snan ? "TEST_SNAN|" : "");
161 if (defined $exception) {
162 return ", ${ignore_result}${non_finite}${test_snan}$exception";
164 return ", ${ignore_result}${non_finite}${test_snan}0";
168 # Apply the LIT(x) macro to a literal floating point constant
169 # and strip any existing suffix.
172 my $exp_re = "([+-])?[[:digit:]]+";
173 # Don't wrap something that does not look like a:
174 # * Hexadecimal FP value
175 # * Decimal FP value without a decimal point
176 # * Decimal value with a fraction
177 return $lit if $lit !~ /([+-])?0x[[:xdigit:]\.]+[pP]$exp_re/
178 and $lit !~ /[[:digit:]]+[eE]$exp_re/
179 and $lit !~ /[[:digit:]]*\.[[:digit:]]*([eE]$exp_re)?/;
181 # Strip any existing literal suffix.
184 return "LIT (${lit})";
187 # Apply LIT macro to individual tokens within an expression.
189 # This function assumes the C expression follows GNU coding
190 # standards. Specifically, a space separates each lexical
191 # token. Otherwise, this post-processing may apply LIT
192 # incorrectly, or around an entire expression.
195 my @toks = split (/ /, $lit);
197 $_ = _apply_lit ($_);
199 return join (' ', @toks);
202 # Parse the arguments to TEST_x_y
204 my ($file, $descr, $args) = @_;
205 my (@args, $descr_args, $descr_res, @descr);
206 my ($current_arg, $cline, $cline_res, $i);
209 my ($ignore_result_any, $ignore_result_all);
210 my ($num_res, @args_res, @start_rm, $rm);
211 my (@plus_oflow, @minus_oflow, @plus_uflow, @minus_uflow);
212 my (@errno_plus_oflow, @errno_minus_oflow);
213 my (@errno_plus_uflow, @errno_minus_uflow);
214 my (@xfail_rounding_ibm128_libgcc);
215 my ($non_finite, $test_snan);
217 ($descr_args, $descr_res) = split /_/,$descr, 2;
219 @args = split /,\s*/, $args;
223 # Generate first the string that's shown to the user
225 @descr = split //,$descr_args;
226 for ($i = 0; $i <= $#descr; $i++) {
228 if ($current_arg > 1) {
231 # FLOAT, long double, int, unsigned int, long int, long long int
232 if ($descr[$i] =~ /f|j|i|u|l|L/) {
233 $call_args .= $comma . &beautify ($args[$current_arg]);
237 # Argument passed via pointer.
238 if ($descr[$i] =~ /p/) {
241 # &FLOAT, &int - simplify call by not showing argument.
242 if ($descr[$i] =~ /F|I/) {
246 if ($descr[$i] eq 'c') {
247 $call_args .= $comma . &build_complex_beautify ($args[$current_arg], $args[$current_arg+1]);
252 die ("$descr[$i] is unknown");
256 @args_res = @args[$current_arg .. $#args];
258 @descr = split //,$descr_res;
260 if ($_ =~ /f|i|l|L|M|U/) {
262 } elsif ($_ eq 'c') {
264 } elsif ($_ eq 'b') {
267 } elsif ($_ eq '1') {
270 die ("$_ is unknown");
274 if ($#args_res == $num_res - 1) {
275 # One set of results for all rounding modes, no flags.
276 @start_rm = ( 0, 0, 0, 0 );
277 } elsif ($#args_res == $num_res) {
278 # One set of results for all rounding modes, with flags.
279 die ("wrong number of arguments")
280 unless ($args_res[$#args_res] =~ /EXCEPTION|ERRNO|IGNORE_ZERO_INF_SIGN|TEST_NAN_SIGN|NO_TEST_INLINE|XFAIL/);
281 @start_rm = ( 0, 0, 0, 0 );
282 } elsif ($#args_res == 4 * $num_res + 3) {
283 # One set of results per rounding mode, with flags.
284 @start_rm = ( 0, $num_res + 1, 2 * $num_res + 2, 3 * $num_res + 3 );
286 die ("wrong number of arguments");
289 # Put the C program line together
290 # Reset some variables to start again
292 $call_args =~ s/\"/\\\"/g;
293 $cline = "{ \"$call_args\"";
294 @descr = split //,$descr_args;
295 for ($i=0; $i <= $#descr; $i++) {
296 # FLOAT, int, long int, long long int
297 if ($descr[$i] =~ /f|j|i|u|l|L/) {
298 if ($descr[$i] eq "f") {
299 $cline .= ", " . &apply_lit ($args[$current_arg]);
301 $cline .= ", $args[$current_arg]";
306 # &FLOAT, &int, argument passed via pointer
307 if ($descr[$i] =~ /F|I|p/) {
311 if ($descr[$i] eq 'c') {
312 $cline .= ", " . &apply_lit ($args[$current_arg]);
313 $cline .= ", " . &apply_lit ($args[$current_arg+1]);
319 @descr = split //,$descr_res;
320 @plus_oflow = qw(max_value plus_infty max_value plus_infty);
321 @minus_oflow = qw(minus_infty minus_infty -max_value -max_value);
322 @plus_uflow = qw(plus_zero plus_zero plus_zero min_subnorm_value);
323 @minus_uflow = qw(-min_subnorm_value minus_zero minus_zero minus_zero);
324 @errno_plus_oflow = qw(0 ERRNO_ERANGE 0 ERRNO_ERANGE);
325 @errno_minus_oflow = qw(ERRNO_ERANGE ERRNO_ERANGE 0 0);
326 @errno_plus_uflow = qw(ERRNO_ERANGE ERRNO_ERANGE ERRNO_ERANGE 0);
327 @errno_minus_uflow = qw(0 ERRNO_ERANGE ERRNO_ERANGE ERRNO_ERANGE);
328 @xfail_rounding_ibm128_libgcc = qw(XFAIL_IBM128_LIBGCC 0
329 XFAIL_IBM128_LIBGCC XFAIL_IBM128_LIBGCC);
330 for ($rm = 0; $rm <= 3; $rm++) {
331 $current_arg = $start_rm[$rm];
332 $ignore_result_any = 0;
333 $ignore_result_all = 1;
337 if ($_ =~ /b|f|j|i|l|L|M|U/ ) {
338 my ($result) = $args_res[$current_arg];
339 if ($result eq "IGNORE") {
340 $ignore_result_any = 1;
343 $ignore_result_all = 0;
346 $result = apply_lit
($result);
348 $cline_res .= ", $result";
350 } elsif ($_ eq 'c') {
351 my ($result1) = $args_res[$current_arg];
352 if ($result1 eq "IGNORE") {
353 $ignore_result_any = 1;
356 $ignore_result_all = 0;
358 my ($result2) = $args_res[$current_arg + 1];
359 if ($result2 eq "IGNORE") {
360 $ignore_result_any = 1;
363 $ignore_result_all = 0;
365 $result1 = apply_lit
($result1);
366 $result2 = apply_lit
($result2);
367 $cline_res .= ", $result1, $result2";
369 } elsif ($_ eq '1') {
370 push @special, $args_res[$current_arg];
374 if ($ignore_result_any && !$ignore_result_all) {
375 die ("some but not all function results ignored\n");
377 # Determine whether any arguments or results, for any rounding
378 # mode, are non-finite.
379 $non_finite = ($args =~ /qnan_value|snan_value|plus_infty|minus_infty/);
380 $test_snan = ($args =~ /snan_value/);
382 $cline_res .= show_exceptions
($ignore_result_any,
385 ($current_arg <= $#args_res)
386 ?
$args_res[$current_arg]
389 # special treatment for some functions
393 my ($extra_expected) = $_;
394 my ($run_extra) = ($extra_expected ne "IGNORE" ?
1 : 0);
396 $extra_expected = "0";
398 $extra_expected = apply_lit
($extra_expected);
400 $cline_res .= ", $run_extra, $extra_expected";
402 $cline_res =~ s/^, //;
403 $cline_res =~ s/plus_oflow/$plus_oflow[$rm]/g;
404 $cline_res =~ s/minus_oflow/$minus_oflow[$rm]/g;
405 $cline_res =~ s/plus_uflow/$plus_uflow[$rm]/g;
406 $cline_res =~ s/minus_uflow/$minus_uflow[$rm]/g;
407 $cline_res =~ s/ERRNO_PLUS_OFLOW/$errno_plus_oflow[$rm]/g;
408 $cline_res =~ s/ERRNO_MINUS_OFLOW/$errno_minus_oflow[$rm]/g;
409 $cline_res =~ s/ERRNO_PLUS_UFLOW/$errno_plus_uflow[$rm]/g;
410 $cline_res =~ s/ERRNO_MINUS_UFLOW/$errno_minus_uflow[$rm]/g;
411 $cline_res =~ s/XFAIL_ROUNDING_IBM128_LIBGCC/$xfail_rounding_ibm128_libgcc[$rm]/g;
412 $cline .= ", { $cline_res }";
414 print $file " $cline },\n";
417 # Convert a condition from auto-libm-test-out to C form.
418 sub convert_condition
{
421 @conds = split /:/, $cond;
426 $ret = join " && ", @conds;
430 # Return text to OR a value into an accumulated flags string.
440 # Return a conditional expression between two values.
442 my ($cond, $if, $else) = @_;
445 } elsif ($cond eq "0") {
448 return "($cond ? $if : $else)";
452 # Return text to OR a conditional expression between two values into
453 # an accumulated flags string.
455 my ($cond, $if, $else) = @_;
456 return or_value
(cond_value
($cond, $if, $else));
459 # Generate libm-test.c
460 sub generate_testfile
{
461 my ($input, $output) = @_;
463 open INPUT
, $input or die ("Can't open $input: $!");
464 open OUTPUT
, ">$output" or die ("Can't open $output: $!");
466 # Replace the special macros
468 # AUTO_TESTS (function),
469 if (/^\s*AUTO_TESTS_/) {
470 my ($descr, $func, @modes, $auto_test, $num_auto_tests);
471 my (@rm_tests, $rm, $i);
472 @modes = qw(downward tonearest towardzero upward);
473 ($descr, $func) = ($_ =~ /AUTO_TESTS_(\w+)\s*\((\w+)\)/);
474 for ($rm = 0; $rm <= 3; $rm++) {
475 $rm_tests[$rm] = [sort keys %{$auto_tests{$func}{$modes[$rm]}}];
477 $num_auto_tests = scalar @
{$rm_tests[0]};
478 for ($rm = 1; $rm <= 3; $rm++) {
479 if ($num_auto_tests != scalar @
{$rm_tests[$rm]}) {
480 die ("inconsistent numbers of tests for $func\n");
482 for ($i = 0; $i < $num_auto_tests; $i++) {
483 if ($rm_tests[0][$i] ne $rm_tests[$rm][$i]) {
484 die ("inconsistent list of tests of $func\n");
488 if ($num_auto_tests == 0) {
489 die ("no automatic tests for $func\n");
491 foreach $auto_test (@
{$rm_tests[0]}) {
492 my ($format, $inputs, $format_conv, $args_str);
493 ($format, $inputs) = split / /, $auto_test, 2;
495 $format_conv = convert_condition
($format);
496 print OUTPUT
"#if $format_conv\n";
497 $args_str = "$func, $inputs";
498 for ($rm = 0; $rm <= 3; $rm++) {
499 my ($auto_test_out, $outputs, $flags);
500 my ($flags_conv, @flags, %flag_cond);
501 $auto_test_out = $auto_tests{$func}{$modes[$rm]}{$auto_test};
502 ($outputs, $flags) = split / : */, $auto_test_out;
503 $outputs =~ s/ /, /g;
504 @flags = split / /, $flags;
506 if (/^([^:]*):(.*)$/) {
509 $cond = convert_condition
($2);
510 if (defined ($flag_cond{$flag})) {
511 if ($flag_cond{$flag} ne "1") {
512 $flag_cond{$flag} .= " || $cond";
515 $flag_cond{$flag} = $cond;
518 $flag_cond{$_} = "1";
522 if (defined ($flag_cond{"ignore-zero-inf-sign"})) {
523 $flags_conv .= or_cond_value
($flag_cond{"ignore-zero-inf-sign"},
524 "IGNORE_ZERO_INF_SIGN", "0");
526 if (defined ($flag_cond{"no-test-inline"})) {
527 $flags_conv .= or_cond_value
($flag_cond{"no-test-inline"},
528 "NO_TEST_INLINE", "0");
530 if (defined ($flag_cond{"xfail"})) {
531 $flags_conv .= or_cond_value
($flag_cond{"xfail"},
534 my (@exc_list) = qw(divbyzero inexact invalid overflow underflow);
536 foreach $exc (@exc_list) {
537 my ($exc_expected, $exc_ok, $no_exc, $exc_cond, $exc_ok_cond);
538 $exc_expected = "\U$exc\E_EXCEPTION";
539 $exc_ok = "\U$exc\E_EXCEPTION_OK";
541 if ($exc eq "inexact") {
543 $no_exc = "NO_INEXACT_EXCEPTION";
545 if (defined ($flag_cond{$exc})) {
546 $exc_cond = $flag_cond{$exc};
550 if (defined ($flag_cond{"$exc-ok"})) {
551 $exc_ok_cond = $flag_cond{"$exc-ok"};
555 $flags_conv .= or_cond_value
($exc_cond,
556 cond_value
($exc_ok_cond,
557 $exc_ok, $exc_expected),
558 cond_value
($exc_ok_cond,
561 my ($errno_expected, $errno_unknown_cond);
562 if (defined ($flag_cond{"errno-edom"})) {
563 if ($flag_cond{"errno-edom"} ne "1") {
564 die ("unexpected condition for errno-edom");
566 if (defined ($flag_cond{"errno-erange"})) {
567 die ("multiple errno values expected");
569 $errno_expected = "ERRNO_EDOM";
570 } elsif (defined ($flag_cond{"errno-erange"})) {
571 if ($flag_cond{"errno-erange"} ne "1") {
572 die ("unexpected condition for errno-erange");
574 $errno_expected = "ERRNO_ERANGE";
576 $errno_expected = "ERRNO_UNCHANGED";
578 if (defined ($flag_cond{"errno-edom-ok"})) {
579 if (defined ($flag_cond{"errno-erange-ok"})
580 && ($flag_cond{"errno-erange-ok"}
581 ne $flag_cond{"errno-edom-ok"})) {
582 $errno_unknown_cond = "($flag_cond{\"errno-edom-ok\"} || $flag_cond{\"errno-erange-ok\"})";
584 $errno_unknown_cond = $flag_cond{"errno-edom-ok"};
586 } elsif (defined ($flag_cond{"errno-erange-ok"})) {
587 $errno_unknown_cond = $flag_cond{"errno-erange-ok"};
589 $errno_unknown_cond = "0";
591 $flags_conv .= or_cond_value
($errno_unknown_cond,
592 "0", $errno_expected);
593 if ($flags_conv eq "") {
594 $flags_conv = ", NO_EXCEPTION";
596 $flags_conv =~ s/^ \|/,/;
598 $args_str .= ", $outputs$flags_conv";
600 &parse_args
(\
*OUTPUT
, $descr, $args_str);
601 print OUTPUT
"#endif\n";
610 ($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
611 &parse_args
(\
*OUTPUT
, $descr, $args);
625 my ($test, $type, $float, $eps, $float_regex);
627 # Build a basic regex to match type entries in the
628 # generated ULPS file.
629 foreach my $ftype (@all_floats) {
630 $float_regex .= "|" . $ftype;
632 $float_regex = "^" . substr ($float_regex, 1) . ":";
634 # $type has the following values:
635 # "normal": No complex variable
636 # "real": Real part of complex result
637 # "imag": Imaginary part of complex result
638 open ULP
, $file or die ("Can't open $file: $!");
641 # ignore comments and empty lines
645 if (/Real part of/) {
648 } elsif (/Imaginary part of/) {
649 s/Imaginary part of //;
654 ($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
657 if (/$float_regex/) {
658 ($float, $eps) = split /\s*:\s*/,$_,2;
664 if (!defined ($results{$test}{$type}{'ulp'}{$float})
665 || $results{$test}{$type}{'ulp'}{$float} < $eps) {
666 $results{$test}{$type}{'ulp'}{$float} = $eps;
667 $results{$test}{'has_ulps'} = 1;
670 if ($type =~ /^real|imag$/) {
671 $results{$test}{'type'} = 'complex';
672 } elsif ($type eq 'normal') {
673 $results{$test}{'type'} = 'normal';
677 print "Skipping unknown entry: `$_'\n";
683 # Clean up a floating point number
684 sub clean_up_number
{
687 # Remove trailing zeros after the decimal point
688 if ($number =~ /\./) {
695 # Output a file which can be read in as ulps file.
696 sub print_ulps_file
{
698 my ($test, $type, $float, $eps, $fct, $last_fct);
701 open NEWULP
, ">$file" or die ("Can't open $file: $!");
702 print NEWULP
"# Begin of automatic generation\n";
703 print NEWULP
"\n# Maximal error of functions:\n";
705 foreach $fct (sort keys %results) {
706 foreach $type ('real', 'imag', 'normal') {
707 if (exists $results{$fct}{$type}) {
708 if ($type eq 'normal') {
709 print NEWULP
"Function: \"$fct\":\n";
710 } elsif ($type eq 'real') {
711 print NEWULP
"Function: Real part of \"$fct\":\n";
712 } elsif ($type eq 'imag') {
713 print NEWULP
"Function: Imaginary part of \"$fct\":\n";
715 foreach $float (@all_floats) {
716 if (exists $results{$fct}{$type}{'ulp'}{$float}) {
717 print NEWULP
"$float: ",
718 &clean_up_number
($results{$fct}{$type}{'ulp'}{$float}),
726 print NEWULP
"# end of automatic generation\n";
731 my ($test, $type, $float) = @_;
733 return (exists $results{$test}{$type}{'ulp'}{$float}
734 ?
$results{$test}{$type}{'ulp'}{$float} : "0");
737 # Return the ulps value for a single test.
738 sub get_all_ulps_for_test
{
739 my ($test, $type) = @_;
740 my ($ldouble, $double, $float, $ildouble, $idouble, $ifloat);
743 if (exists $results{$test}{'has_ulps'}) {
744 foreach $float (@all_floats) {
745 $ulps_str .= &get_ulps
($test, $type, $float) . ", ";
747 return "{" . substr ($ulps_str, 0, -2) . "}";
749 die "get_all_ulps_for_test called for \"$test\" with no ulps\n";
755 my ($file, $ulps_filename) = @_;
756 my ($i, $fct, $type, $ulp, $ulp_real, $ulp_imag);
757 my (%func_ulps, %func_real_ulps, %func_imag_ulps);
759 open ULP
, ">$file" or die ("Can't open $file: $!");
761 print ULP
"/* This file is automatically generated\n";
762 print ULP
" from $ulps_filename with gen-libm-test.pl.\n";
763 print ULP
" Don't change it - change instead the master files. */\n\n";
765 print ULP
"struct ulp_data\n";
767 print ULP
" const char *name;\n";
768 print ULP
" FLOAT max_ulp[" . @all_floats . "];\n";
771 for ($i = 0; $i <= $#all_floats; $i++) {
772 $type = $all_floats[$i];
773 print ULP
"#define ULP_";
776 $type = substr $type, 1;
778 print ULP
"$all_floats_pfx{$type} $i\n";
781 foreach $fct (keys %results) {
782 $type = $results{$fct}{'type'};
783 if ($type eq 'normal') {
784 $ulp = get_all_ulps_for_test
($fct, 'normal');
785 } elsif ($type eq 'complex') {
786 $ulp_real = get_all_ulps_for_test
($fct, 'real');
787 $ulp_imag = get_all_ulps_for_test
($fct, 'imag');
789 die "unknown results ($fct) type $type\n";
791 if ($type eq 'normal') {
792 $func_ulps{$fct} = $ulp;
794 $func_real_ulps{$fct} = $ulp_real;
795 $func_imag_ulps{$fct} = $ulp_imag;
798 print ULP
"\n/* Maximal error of functions. */\n";
799 print ULP
"static const struct ulp_data func_ulps[] =\n {\n";
800 foreach $fct (sort keys %func_ulps) {
801 print ULP
" { \"$fct\", $func_ulps{$fct} },\n";
804 print ULP
"static const struct ulp_data func_real_ulps[] =\n {\n";
805 foreach $fct (sort keys %func_real_ulps) {
806 print ULP
" { \"$fct\", $func_real_ulps{$fct} },\n";
809 print ULP
"static const struct ulp_data func_imag_ulps[] =\n {\n";
810 foreach $fct (sort keys %func_imag_ulps) {
811 print ULP
" { \"$fct\", $func_imag_ulps{$fct} },\n";
817 # Parse auto-libm-test-out.
818 sub parse_auto_input
{
820 open AUTO
, $file or die ("Can't open $file: $!");
825 if (/^(\S+) (\S+) ([^:]*) : (.*)$/) {
826 $auto_tests{$1}{$2}{$3} = $4;
828 die ("bad automatic test line: $_\n");