Disable x87 inline functions for SSE2 math
[glibc.git] / math / gen-libm-test.pl
bloba1c528d970617fed7d0b4aea726dcbf4ab5589e7
1 #!/usr/bin/perl -w
2 # Copyright (C) 1999-2014 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}{"kind"} is either "fct" or "test" and flags whether this
25 # is a maximal error of a function or a single test.
26 # $results{$test}{"type"} is the result type, e.g. normal or complex.
27 # $results{$test}{"has_ulps"} is set if deltas exist.
28 # In the following description $type and $float are:
29 # - $type is either "normal", "real" (for the real part of a complex number)
30 # or "imag" (for the imaginary part # of a complex number).
31 # - $float is either of float, ifloat, double, idouble, ldouble, ildouble;
32 # It represents the underlying floating point type (float, double or long
33 # double) and if inline functions (the leading i stands for inline)
34 # are used.
35 # $results{$test}{$type}{"ulp"}{$float} is defined and has a delta as value
38 use Getopt::Std;
40 use strict;
42 use vars qw ($input $output $auto_input);
43 use vars qw (%results);
44 use vars qw (%beautify @all_floats);
45 use vars qw ($output_dir $ulps_file $srcdir);
46 use vars qw (%auto_tests);
48 # all_floats is sorted and contains all recognised float types
49 @all_floats = ('double', 'float', 'idouble',
50 'ifloat', 'ildouble', 'ldouble');
52 %beautify =
53 ( "minus_zero" => "-0",
54 "plus_zero" => "+0",
55 "-0x0p+0f" => "-0",
56 "-0x0p+0" => "-0",
57 "-0x0p+0L" => "-0",
58 "0x0p+0f" => "+0",
59 "0x0p+0" => "+0",
60 "0x0p+0L" => "+0",
61 "minus_infty" => "-inf",
62 "plus_infty" => "inf",
63 "qnan_value" => "qNaN",
67 # get Options
68 # Options:
69 # u: ulps-file
70 # h: help
71 # o: output-directory
72 # n: generate new ulps file
73 use vars qw($opt_u $opt_h $opt_o $opt_n);
74 getopts('u:o:nh');
76 $ulps_file = 'libm-test-ulps';
77 $output_dir = '';
78 ($srcdir = $0) =~ s{[^/]*$}{};
80 if ($opt_h) {
81 print "Usage: gen-libm-test.pl [OPTIONS]\n";
82 print " -h print this help, then exit\n";
83 print " -o DIR directory where generated files will be placed\n";
84 print " -n only generate sorted file NewUlps from libm-test-ulps\n";
85 print " -u FILE input file with ulps\n";
86 exit 0;
89 $ulps_file = $opt_u if ($opt_u);
90 $output_dir = $opt_o if ($opt_o);
92 $input = "libm-test.inc";
93 $auto_input = "${srcdir}auto-libm-test-out";
94 $output = "${output_dir}libm-test.c";
96 &parse_ulps ($ulps_file);
97 &parse_auto_input ($auto_input);
98 &generate_testfile ($input, $output) unless ($opt_n);
99 &output_ulps ("${output_dir}libm-test-ulps.h", $ulps_file) unless ($opt_n);
100 &print_ulps_file ("${output_dir}NewUlps") if ($opt_n);
102 # Return a nicer representation
103 sub beautify {
104 my ($arg) = @_;
105 my ($tmp);
107 if (exists $beautify{$arg}) {
108 return $beautify{$arg};
110 if ($arg =~ /^-/) {
111 $tmp = $arg;
112 $tmp =~ s/^-//;
113 if (exists $beautify{$tmp}) {
114 return '-' . $beautify{$tmp};
117 if ($arg =~ /^-?0x[0-9a-f.]*p[-+][0-9]+f$/) {
118 $arg =~ s/f$//;
120 if ($arg =~ /[0-9]L$/) {
121 $arg =~ s/L$//;
123 return $arg;
126 # Return a nicer representation of a complex number
127 sub build_complex_beautify {
128 my ($r, $i) = @_;
129 my ($str1, $str2);
131 $str1 = &beautify ($r);
132 $str2 = &beautify ($i);
133 if ($str2 =~ /^-/) {
134 $str2 =~ s/^-//;
135 $str1 .= ' - ' . $str2;
136 } else {
137 $str1 .= ' + ' . $str2;
139 $str1 .= ' i';
140 return $str1;
143 # Return the text to put in an initializer for a test's exception
144 # information.
145 sub show_exceptions {
146 my ($ignore_result, $exception) = @_;
147 $ignore_result = ($ignore_result ? "IGNORE_RESULT|" : "");
148 if (defined $exception) {
149 return ", ${ignore_result}$exception";
150 } else {
151 return ", ${ignore_result}0";
155 # Parse the arguments to TEST_x_y
156 sub parse_args {
157 my ($file, $descr, $args) = @_;
158 my (@args, $descr_args, $descr_res, @descr);
159 my ($current_arg, $cline, $i);
160 my (@special);
161 my ($call_args);
162 my ($ignore_result_any, $ignore_result_all);
164 ($descr_args, $descr_res) = split /_/,$descr, 2;
166 @args = split /,\s*/, $args;
168 $call_args = "";
170 # Generate first the string that's shown to the user
171 $current_arg = 1;
172 @descr = split //,$descr_args;
173 for ($i = 0; $i <= $#descr; $i++) {
174 my $comma = "";
175 if ($current_arg > 1) {
176 $comma = ', ';
178 # FLOAT, int, long int, long long int
179 if ($descr[$i] =~ /f|i|l|L/) {
180 $call_args .= $comma . &beautify ($args[$current_arg]);
181 ++$current_arg;
182 next;
184 # &FLOAT, &int - simplify call by not showing argument.
185 if ($descr[$i] =~ /F|I/) {
186 next;
188 # complex
189 if ($descr[$i] eq 'c') {
190 $call_args .= $comma . &build_complex_beautify ($args[$current_arg], $args[$current_arg+1]);
191 $current_arg += 2;
192 next;
195 die ("$descr[$i] is unknown");
198 # Result
199 @descr = split //,$descr_res;
200 foreach (@descr) {
201 if ($_ =~ /f|i|l|L/) {
202 ++$current_arg;
203 } elsif ($_ eq 'c') {
204 $current_arg += 2;
205 } elsif ($_ eq 'b') {
206 # boolean
207 ++$current_arg;
208 } elsif ($_ eq '1') {
209 ++$current_arg;
210 } else {
211 die ("$_ is unknown");
214 # consistency check
215 if ($current_arg == $#args) {
216 die ("wrong number of arguments")
217 unless ($args[$current_arg] =~ /EXCEPTION|ERRNO|IGNORE_ZERO_INF_SIGN|TEST_NAN_SIGN|NO_TEST_INLINE|XFAIL_TEST/);
218 } elsif ($current_arg < $#args) {
219 die ("wrong number of arguments");
220 } elsif ($current_arg > ($#args+1)) {
221 die ("wrong number of arguments");
225 # Put the C program line together
226 # Reset some variables to start again
227 $current_arg = 1;
228 $cline = "{ \"$call_args\"";
229 @descr = split //,$descr_args;
230 for ($i=0; $i <= $#descr; $i++) {
231 # FLOAT, int, long int, long long int
232 if ($descr[$i] =~ /f|i|l|L/) {
233 $cline .= ", $args[$current_arg]";
234 $current_arg++;
235 next;
237 # &FLOAT, &int
238 if ($descr[$i] =~ /F|I/) {
239 next;
241 # complex
242 if ($descr[$i] eq 'c') {
243 $cline .= ", $args[$current_arg], $args[$current_arg+1]";
244 $current_arg += 2;
245 next;
249 @descr = split //,$descr_res;
250 $ignore_result_any = 0;
251 $ignore_result_all = 1;
252 foreach (@descr) {
253 if ($_ =~ /b|f|i|l|L/ ) {
254 my ($result) = $args[$current_arg];
255 if ($result eq "IGNORE") {
256 $ignore_result_any = 1;
257 $result = "0";
258 } else {
259 $ignore_result_all = 0;
261 $cline .= ", $result";
262 $current_arg++;
263 } elsif ($_ eq 'c') {
264 my ($result1) = $args[$current_arg];
265 if ($result1 eq "IGNORE") {
266 $ignore_result_any = 1;
267 $result1 = "0";
268 } else {
269 $ignore_result_all = 0;
271 my ($result2) = $args[$current_arg + 1];
272 if ($result2 eq "IGNORE") {
273 $ignore_result_any = 1;
274 $result2 = "0";
275 } else {
276 $ignore_result_all = 0;
278 $cline .= ", $result1, $result2";
279 $current_arg += 2;
280 } elsif ($_ eq '1') {
281 push @special, $args[$current_arg];
282 ++$current_arg;
285 if ($ignore_result_any && !$ignore_result_all) {
286 die ("some but not all function results ignored\n");
288 # Add exceptions.
289 $cline .= show_exceptions ($ignore_result_any,
290 ($current_arg <= $#args)
291 ? $args[$current_arg]
292 : undef);
294 # special treatment for some functions
295 $i = 0;
296 foreach (@special) {
297 ++$i;
298 my ($extra_expected) = $_;
299 my ($run_extra) = ($extra_expected ne "IGNORE" ? 1 : 0);
300 if (!$run_extra) {
301 $extra_expected = "0";
303 $cline .= ", $run_extra, $extra_expected";
305 print $file " $cline },\n";
308 # Convert a condition from auto-libm-test-out to C form.
309 sub convert_condition {
310 my ($cond) = @_;
311 my (@conds, $ret);
312 @conds = split /:/, $cond;
313 foreach (@conds) {
314 s/-/_/g;
315 s/^/TEST_COND_/;
317 $ret = join " && ", @conds;
318 return "($ret)";
321 # Return text to OR a value into an accumulated flags string.
322 sub or_value {
323 my ($cond) = @_;
324 if ($cond eq "0") {
325 return "";
326 } else {
327 return " | $cond";
331 # Return text to OR a conditional expression between two values into
332 # an accumulated flags string.
333 sub or_cond_value {
334 my ($cond, $if, $else) = @_;
335 if ($cond eq "1") {
336 return or_value ($if);
337 } elsif ($cond eq "0") {
338 return or_value ($else);
339 } else {
340 return or_value ("($cond ? $if : $else)");
344 # Generate libm-test.c
345 sub generate_testfile {
346 my ($input, $output) = @_;
348 open INPUT, $input or die ("Can't open $input: $!");
349 open OUTPUT, ">$output" or die ("Can't open $output: $!");
351 # Replace the special macros
352 while (<INPUT>) {
353 # AUTO_TESTS (function, mode),
354 if (/^\s*AUTO_TESTS_/) {
355 my ($descr, $func, $mode, $auto_test, $num_auto_tests);
356 ($descr, $func, $mode) = ($_ =~ /AUTO_TESTS_(\w+)\s*\((\w+),\s*(\w+)\)/);
357 $num_auto_tests = 0;
358 foreach $auto_test (sort keys %{$auto_tests{$func}{$mode}}) {
359 my ($finputs, $format, $inputs, $outputs, $flags);
360 my ($format_conv, $flags_conv, @flags, %flag_cond);
361 $num_auto_tests++;
362 ($finputs, $outputs, $flags) = split / : */, $auto_test;
363 ($format, $inputs) = split / /, $finputs, 2;
364 $inputs =~ s/ /, /g;
365 $outputs =~ s/ /, /g;
366 $format_conv = convert_condition ($format);
367 print OUTPUT "#if $format_conv\n";
368 @flags = split / /, $flags;
369 foreach (@flags) {
370 if (/^([^:]*):(.*)$/) {
371 my ($flag, $cond);
372 $flag = $1;
373 $cond = convert_condition ($2);
374 if (defined ($flag_cond{$flag})) {
375 if ($flag_cond{$flag} ne "1") {
376 $flag_cond{$flag} .= " || $cond";
378 } else {
379 $flag_cond{$flag} = $cond;
381 } else {
382 $flag_cond{$_} = "1";
385 $flags_conv = "";
386 if (defined ($flag_cond{"no-test-inline"})) {
387 $flags_conv .= or_cond_value ($flag_cond{"no-test-inline"},
388 "NO_TEST_INLINE", "0");
390 if (defined ($flag_cond{"xfail"})) {
391 $flags_conv .= or_cond_value ($flag_cond{"xfail"},
392 "XFAIL_TEST", "0");
394 my (@exc_list) = qw(divbyzero inexact invalid overflow underflow);
395 my ($exc);
396 foreach $exc (@exc_list) {
397 my ($exc_expected, $exc_ok, $no_exc);
398 $exc_expected = "\U$exc\E_EXCEPTION";
399 $exc_ok = "\U$exc\E_EXCEPTION_OK";
400 $no_exc = "0";
401 if ($exc eq "inexact") {
402 $exc_ok = "0";
403 $no_exc = "NO_INEXACT_EXCEPTION";
405 if (defined ($flag_cond{$exc})) {
406 if ($flag_cond{$exc} ne "1") {
407 die ("unexpected condition for $exc\n");
409 if (defined ($flag_cond{"$exc-ok"})) {
410 $flags_conv .= or_cond_value ($flag_cond{"$exc-ok"},
411 $exc_ok, $exc_expected);
412 } else {
413 $flags_conv .= or_value ($exc_expected);
415 } else {
416 if (defined ($flag_cond{"$exc-ok"})) {
417 $flags_conv .= or_cond_value ($flag_cond{"$exc-ok"},
418 $exc_ok, $no_exc);
419 } else {
420 $flags_conv .= or_value ($no_exc);
424 my ($errno_expected, $errno_unknown_cond);
425 if (defined ($flag_cond{"errno-edom"})) {
426 if ($flag_cond{"errno-edom"} ne "1") {
427 die ("unexpected condition for errno-edom");
429 if (defined ($flag_cond{"errno-erange"})) {
430 die ("multiple errno values expected");
432 $errno_expected = "ERRNO_EDOM";
433 } elsif (defined ($flag_cond{"errno-erange"})) {
434 if ($flag_cond{"errno-erange"} ne "1") {
435 die ("unexpected condition for errno-erange");
437 $errno_expected = "ERRNO_ERANGE";
438 } else {
439 $errno_expected = "ERRNO_UNCHANGED";
441 if (defined ($flag_cond{"errno-edom-ok"})) {
442 if (defined ($flag_cond{"errno-erange-ok"})
443 && $flag_cond{"errno-erange-ok"} ne $flag_cond{"errno-edom-ok"}) {
444 $errno_unknown_cond = "($flag_cond{\"errno-edom-ok\"} || $flag_cond{\"errno-erange-ok\"})";
445 } else {
446 $errno_unknown_cond = $flag_cond{"errno-edom-ok"};
448 } elsif (defined ($flag_cond{"errno-erange-ok"})) {
449 $errno_unknown_cond = $flag_cond{"errno-erange-ok"};
450 } else {
451 $errno_unknown_cond = "0";
453 $flags_conv .= or_cond_value ($errno_unknown_cond,
454 "0", $errno_expected);
455 if ($flags_conv ne "") {
456 $flags_conv =~ s/^ \|/,/;
458 &parse_args (\*OUTPUT, $descr,
459 "$func, $inputs, $outputs$flags_conv");
460 print OUTPUT "#endif\n";
462 if ($num_auto_tests == 0) {
463 die ("no automatic tests for $func, $mode\n");
465 next;
468 # TEST_...
469 if (/^\s*TEST_/) {
470 my ($descr, $args);
471 chop;
472 ($descr, $args) = ($_ =~ /TEST_(\w+)\s*\((.*)\)/);
473 &parse_args (\*OUTPUT, $descr, $args);
474 next;
476 print OUTPUT;
478 close INPUT;
479 close OUTPUT;
484 # Parse ulps file
485 sub parse_ulps {
486 my ($file) = @_;
487 my ($test, $type, $float, $eps, $kind);
489 # $type has the following values:
490 # "normal": No complex variable
491 # "real": Real part of complex result
492 # "imag": Imaginary part of complex result
493 open ULP, $file or die ("Can't open $file: $!");
494 while (<ULP>) {
495 chop;
496 # ignore comments and empty lines
497 next if /^#/;
498 next if /^\s*$/;
499 if (/^Test/) {
500 if (/Real part of:/) {
501 s/Real part of: //;
502 $type = 'real';
503 } elsif (/Imaginary part of:/) {
504 s/Imaginary part of: //;
505 $type = 'imag';
506 } else {
507 $type = 'normal';
509 s/^.+\"(.*)\".*$/$1/;
510 $test = $_;
511 $kind = 'test';
512 next;
514 if (/^Function: /) {
515 if (/Real part of/) {
516 s/Real part of //;
517 $type = 'real';
518 } elsif (/Imaginary part of/) {
519 s/Imaginary part of //;
520 $type = 'imag';
521 } else {
522 $type = 'normal';
524 ($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
525 $kind = 'fct';
526 next;
528 if (/^i?(float|double|ldouble):/) {
529 ($float, $eps) = split /\s*:\s*/,$_,2;
531 if ($eps eq "0") {
532 # ignore
533 next;
534 } else {
535 $results{$test}{$type}{'ulp'}{$float} = $eps;
536 $results{$test}{'has_ulps'} = 1;
538 if ($type =~ /^real|imag$/) {
539 $results{$test}{'type'} = 'complex';
540 } elsif ($type eq 'normal') {
541 $results{$test}{'type'} = 'normal';
543 $results{$test}{'kind'} = $kind;
544 next;
546 print "Skipping unknown entry: `$_'\n";
548 close ULP;
552 # Clean up a floating point number
553 sub clean_up_number {
554 my ($number) = @_;
556 # Remove trailing zeros after the decimal point
557 if ($number =~ /\./) {
558 $number =~ s/0+$//;
559 $number =~ s/\.$//;
561 return $number;
564 # Output a file which can be read in as ulps file.
565 sub print_ulps_file {
566 my ($file) = @_;
567 my ($test, $type, $float, $eps, $fct, $last_fct);
569 $last_fct = '';
570 open NEWULP, ">$file" or die ("Can't open $file: $!");
571 print NEWULP "# Begin of automatic generation\n";
572 # first the function calls
573 foreach $test (sort keys %results) {
574 next if ($results{$test}{'kind'} ne 'test');
575 foreach $type ('real', 'imag', 'normal') {
576 if (exists $results{$test}{$type}) {
577 if (defined $results{$test}) {
578 ($fct) = ($test =~ /^(\w+)\s/);
579 if ($fct ne $last_fct) {
580 $last_fct = $fct;
581 print NEWULP "\n# $fct\n";
584 if ($type eq 'normal') {
585 print NEWULP "Test \"$test\":\n";
586 } elsif ($type eq 'real') {
587 print NEWULP "Test \"Real part of: $test\":\n";
588 } elsif ($type eq 'imag') {
589 print NEWULP "Test \"Imaginary part of: $test\":\n";
591 foreach $float (@all_floats) {
592 if (exists $results{$test}{$type}{'ulp'}{$float}) {
593 print NEWULP "$float: ",
594 &clean_up_number ($results{$test}{$type}{'ulp'}{$float}),
595 "\n";
601 print NEWULP "\n# Maximal error of functions:\n";
603 foreach $fct (sort keys %results) {
604 next if ($results{$fct}{'kind'} ne 'fct');
605 foreach $type ('real', 'imag', 'normal') {
606 if (exists $results{$fct}{$type}) {
607 if ($type eq 'normal') {
608 print NEWULP "Function: \"$fct\":\n";
609 } elsif ($type eq 'real') {
610 print NEWULP "Function: Real part of \"$fct\":\n";
611 } elsif ($type eq 'imag') {
612 print NEWULP "Function: Imaginary part of \"$fct\":\n";
614 foreach $float (@all_floats) {
615 if (exists $results{$fct}{$type}{'ulp'}{$float}) {
616 print NEWULP "$float: ",
617 &clean_up_number ($results{$fct}{$type}{'ulp'}{$float}),
618 "\n";
621 print NEWULP "\n";
625 print NEWULP "# end of automatic generation\n";
626 close NEWULP;
629 sub get_ulps {
630 my ($test, $type, $float) = @_;
632 return (exists $results{$test}{$type}{'ulp'}{$float}
633 ? $results{$test}{$type}{'ulp'}{$float} : "0");
636 # Return the ulps value for a single test.
637 sub get_all_ulps_for_test {
638 my ($test, $type) = @_;
639 my ($ldouble, $double, $float, $ildouble, $idouble, $ifloat);
641 if (exists $results{$test}{'has_ulps'}) {
642 # XXX use all_floats (change order!)
643 $ldouble = &get_ulps ($test, $type, "ldouble");
644 $double = &get_ulps ($test, $type, "double");
645 $float = &get_ulps ($test, $type, "float");
646 $ildouble = &get_ulps ($test, $type, "ildouble");
647 $idouble = &get_ulps ($test, $type, "idouble");
648 $ifloat = &get_ulps ($test, $type, "ifloat");
649 return "CHOOSE ($ldouble, $double, $float, $ildouble, $idouble, $ifloat)";
650 } else {
651 die "get_all_ulps_for_test called for \"$test\" with no ulps\n";
655 # Print include file
656 sub output_ulps {
657 my ($file, $ulps_filename) = @_;
658 my ($i, $fct, $type, $ulp, $ulp_real, $ulp_imag);
659 my (%test_ulps, %func_ulps, %func_real_ulps, %func_imag_ulps);
661 open ULP, ">$file" or die ("Can't open $file: $!");
663 print ULP "/* This file is automatically generated\n";
664 print ULP " from $ulps_filename with gen-libm-test.pl.\n";
665 print ULP " Don't change it - change instead the master files. */\n\n";
667 foreach $fct (keys %results) {
668 $type = $results{$fct}{'type'};
669 if ($type eq 'normal') {
670 $ulp = get_all_ulps_for_test ($fct, 'normal');
671 } elsif ($type eq 'complex') {
672 $ulp_real = get_all_ulps_for_test ($fct, 'real');
673 $ulp_imag = get_all_ulps_for_test ($fct, 'imag');
674 } else {
675 die "unknown results ($fct) type $type\n";
677 if ($results{$fct}{'kind'} eq 'fct') {
678 if ($type eq 'normal') {
679 $func_ulps{$fct} = $ulp;
680 } else {
681 $func_real_ulps{$fct} = $ulp_real;
682 $func_imag_ulps{$fct} = $ulp_imag;
684 } elsif ($results{$fct}{'kind'} eq 'test') {
685 if ($type eq 'normal') {
686 $test_ulps{$fct} = $ulp;
687 } else {
688 $test_ulps{"Real part of: $fct"} = $ulp_real;
689 $test_ulps{"Imaginary part of: $fct"} = $ulp_imag;
691 } else {
692 die "unknown results ($fct) kind $results{$fct}{'kind'}\n";
695 print ULP "\n/* Maximal error of functions. */\n";
696 print ULP "static const struct ulp_data func_ulps[] =\n {\n";
697 foreach $fct (sort keys %func_ulps) {
698 print ULP " { \"$fct\", $func_ulps{$fct} },\n";
700 print ULP " };\n";
701 print ULP "static const struct ulp_data func_real_ulps[] =\n {\n";
702 foreach $fct (sort keys %func_real_ulps) {
703 print ULP " { \"$fct\", $func_real_ulps{$fct} },\n";
705 print ULP " };\n";
706 print ULP "static const struct ulp_data func_imag_ulps[] =\n {\n";
707 foreach $fct (sort keys %func_imag_ulps) {
708 print ULP " { \"$fct\", $func_imag_ulps{$fct} },\n";
710 print ULP " };\n";
712 print ULP "\n/* Error of single function calls. */\n";
713 print ULP "static const struct ulp_data test_ulps[] =\n {\n";
714 foreach $fct (sort keys %test_ulps) {
715 print ULP " { \"$fct\", $test_ulps{$fct} },\n";
717 print ULP " };\n";
718 close ULP;
721 # Parse auto-libm-test-out.
722 sub parse_auto_input {
723 my ($file) = @_;
724 open AUTO, $file or die ("Can't open $file: $!");
725 while (<AUTO>) {
726 chop;
727 next if !/^= /;
728 s/^= //;
729 if (/^(\S+) (\S+) (.*)$/) {
730 $auto_tests{$1}{$2}{$3} = 1;
731 } else {
732 die ("bad automatic test line: $_\n");
735 close AUTO;