2 # Copyright (C) 1999, 2001 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, write to the Free
18 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 # Information about tests are stored in: %results
22 # $results{$test}{"type"} is the result type, e.g. normal or complex.
23 # In the following description $platform, $type and $float are:
24 # - $platform is the used platform
25 # - $type is either "normal", "real" (for the real part of a complex number)
26 # or "imag" (for the imaginary part # of a complex number).
27 # - $float is either of float, ifloat, double, idouble, ldouble, ildouble;
28 # It represents the underlying floating point type (float, double or long
29 # double) and if inline functions (the leading i stands for inline)
31 # $results{$test}{$platform}{$type}{$float} is defined and has a delta
38 use vars qw
($sources @platforms %pplatforms);
39 use vars qw
(%results @all_floats %suffices @all_functions);
42 # all_floats is in output order and contains all recognised float types that
43 # we're going to output
44 @all_floats = ('float', 'double', 'ldouble');
51 # Pretty description of platform
53 ( "i386/fpu" => "ix86",
54 "generic" => "Generic",
55 "alpha/fpu" => "Alpha",
59 "powerpc/fpu" => "PowerPC",
60 "sparc/sparc32/fpu" => "Sparc 32-bit",
61 "sparc/sparc64/fpu" => "Sparc 64-bit",
62 "sh/sh4/fpu" => "SH4",
63 "s390/fpu" => "S/390",
68 ( "acos", "acosh", "asin", "asinh", "atan", "atanh",
69 "atan2", "cabs", "cacos", "cacosh", "carg", "casin", "casinh",
70 "catan", "catanh", "cbrt", "ccos", "ccosh", "ceil", "cexp", "cimag",
71 "clog", "clog10", "conj", "copysign", "cos", "cosh", "cpow", "cproj",
72 "creal", "csin", "csinh", "csqrt", "ctan", "ctanh", "erf", "erfc",
73 "exp", "exp10", "exp2", "expm1", "fabs", "fdim", "floor", "fma",
74 "fmax", "fmin", "fmod", "frexp", "gamma", "hypot",
75 "ilogb", "j0", "j1", "jn", "lgamma", "lrint",
76 "llrint", "log", "log10", "log1p", "log2", "logb", "lround",
77 "llround", "modf", "nearbyint", "nextafter", "nexttoward", "pow",
78 "remainder", "remquo", "rint", "round", "scalb", "scalbn", "scalbln",
79 "sin", "sincos", "sinh", "sqrt", "tan", "tanh", "tgamma",
80 "trunc", "y0", "y1", "yn" );
81 # "fpclassify", "isfinite", "isnormal", "signbit" are not tabulated
86 $sources = '/usr/src/cvs/libc';
89 find
(\
&find_files
, $sources);
91 @platforms = sort by_platforms
@platforms;
96 if ($_ eq 'libm-test-ulps') {
97 # print "Parsing $File::Find::name\n";
98 push @platforms, $File::Find
::dir
;
99 &parse_ulps
($File::Find
::name
, $File::Find
::dir
);
105 my ($file, $platform) = @_;
106 my ($test, $type, $float, $eps, $kind);
108 # $type has the following values:
109 # "normal": No complex variable
110 # "real": Real part of complex result
111 # "imag": Imaginary part of complex result
112 open ULP
, $file or die ("Can't open $file: $!");
115 # ignore comments and empty lines
123 if (/Real part of/) {
126 } elsif (/Imaginary part of/) {
127 s/Imaginary part of //;
132 ($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
136 # Only handle maximal errors of functions
137 next if ($kind eq 'test');
138 if (/^i?(float|double|ldouble):/) {
139 ($float, $eps) = split /\s*:\s*/,$_,2;
140 if ($eps eq 'fail') {
141 $results{$test}{$platform}{$type}{$float} = 'fail';
142 } elsif ($eps eq "0") {
145 } elsif (!exists $results{$test}{$platform}{$type}{$float}
146 || $results{$test}{$platform}{$type}{$float} ne 'fail') {
147 $results{$test}{$platform}{$type}{$float} = $eps;
149 if ($type =~ /^real|imag$/) {
150 $results{$test}{'type'} = 'complex';
151 } elsif ($type eq 'normal') {
152 $results{$test}{'type'} = 'normal';
156 print "Skipping unknown entry: `$_'\n";
162 my ($fct, $platform, $type, $float) = @_;
164 return (exists $results{$fct}{$platform}{$type}{$float}
165 ?
$results{$fct}{$platform}{$type}{$float} : "0");
168 sub canonicalize_platform
{
171 $platform =~ s
|^(.*/sysdeps/)||;
174 return exists $pplatforms{$platform} ?
$pplatforms{$platform} : $platform;
177 sub print_platforms
{
179 my ($fct, $platform, $float, $first, $i, $platform_no, $platform_total);
181 print '@multitable {nexttowardf} ';
183 print ' {1000 + i 1000}';
187 print '@item Function ';
190 print &canonicalize_platform
($_);
195 foreach $fct (@all_functions) {
196 foreach $float (@all_floats) {
197 print "\@item $fct$suffices{$float} ";
198 foreach $platform (@p) {
200 if (exists $results{$fct}{$platform}{'normal'}{$float}
201 || exists $results{$fct}{$platform}{'real'}{$float}
202 || exists $results{$fct}{$platform}{'imag'}{$float}) {
203 if ($results{$fct}{'type'} eq 'complex') {
204 print &get_value
($fct, $platform, 'real', $float),
205 ' + i ', &get_value
($fct, $platform, 'imag', $float);
207 print $results{$fct}{$platform}{'normal'}{$float};
217 print "\@end multitable\n";
225 # Print only 5 platforms at a time.
226 for ($i=0; $i < $#platforms; $i+=$columns) {
227 $max = $i+$columns-1 > $#platforms ?
$#platforms : $i+$columns-1;
228 print_platforms
(@platforms[$i .. $max]);
235 $pa = $pplatforms{$a} ?
$pplatforms{$a} : $a;
236 $pb = $pplatforms{$b} ?
$pplatforms{$b} : $b;