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, see
18 # <http://www.gnu.org/licenses/>.
20 # Information about tests are stored in: %results
21 # $results{$test}{"type"} is the result type, e.g. normal or complex.
22 # In the following description $platform, $type and $float are:
23 # - $platform is the used platform
24 # - $type is either "normal", "real" (for the real part of a complex number)
25 # or "imag" (for the imaginary part # of a complex number).
26 # - $float is either of float, ifloat, double, idouble, ldouble, ildouble;
27 # It represents the underlying floating point type (float, double or long
28 # double) and if inline functions (the leading i stands for inline)
30 # $results{$test}{$platform}{$type}{$float} is defined and has a delta
37 use vars qw
($sources @platforms %pplatforms);
38 use vars qw
(%results @all_floats %suffices @all_functions);
41 # all_floats is in output order and contains all recognised float types that
42 # we're going to output
43 @all_floats = ('float', 'double', 'ldouble');
50 # Pretty description of platform
52 ( "i386/fpu" => "ix86",
53 "generic" => "Generic",
54 "alpha/fpu" => "Alpha",
58 "powerpc/fpu" => "PowerPC",
59 "sparc/sparc32/fpu" => "Sparc 32-bit",
60 "sparc/sparc64/fpu" => "Sparc 64-bit",
61 "sh/sh4/fpu" => "SH4",
62 "s390/fpu" => "S/390",
67 ( "acos", "acosh", "asin", "asinh", "atan", "atanh",
68 "atan2", "cabs", "cacos", "cacosh", "carg", "casin", "casinh",
69 "catan", "catanh", "cbrt", "ccos", "ccosh", "ceil", "cexp", "cimag",
70 "clog", "clog10", "conj", "copysign", "cos", "cosh", "cpow", "cproj",
71 "creal", "csin", "csinh", "csqrt", "ctan", "ctanh", "erf", "erfc",
72 "exp", "exp10", "exp2", "expm1", "fabs", "fdim", "floor", "fma",
73 "fmax", "fmin", "fmod", "frexp", "gamma", "hypot",
74 "ilogb", "j0", "j1", "jn", "lgamma", "lrint",
75 "llrint", "log", "log10", "log1p", "log2", "logb", "lround",
76 "llround", "modf", "nearbyint", "nextafter", "nexttoward", "pow",
77 "remainder", "remquo", "rint", "round", "scalb", "scalbn", "scalbln",
78 "sin", "sincos", "sinh", "sqrt", "tan", "tanh", "tgamma",
79 "trunc", "y0", "y1", "yn" );
80 # "fpclassify", "isfinite", "isnormal", "signbit" are not tabulated
85 $sources = '/usr/src/cvs/libc';
88 find
(\
&find_files
, $sources);
90 @platforms = sort by_platforms
@platforms;
95 if ($_ eq 'libm-test-ulps') {
96 # print "Parsing $File::Find::name\n";
97 push @platforms, $File::Find
::dir
;
98 &parse_ulps
($File::Find
::name
, $File::Find
::dir
);
104 my ($file, $platform) = @_;
105 my ($test, $type, $float, $eps, $kind);
107 # $type has the following values:
108 # "normal": No complex variable
109 # "real": Real part of complex result
110 # "imag": Imaginary part of complex result
111 open ULP
, $file or die ("Can't open $file: $!");
114 # ignore comments and empty lines
122 if (/Real part of/) {
125 } elsif (/Imaginary part of/) {
126 s/Imaginary part of //;
131 ($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
135 # Only handle maximal errors of functions
136 next if ($kind eq 'test');
137 if (/^i?(float|double|ldouble):/) {
138 ($float, $eps) = split /\s*:\s*/,$_,2;
139 if ($eps eq 'fail') {
140 $results{$test}{$platform}{$type}{$float} = 'fail';
141 } elsif ($eps eq "0") {
144 } elsif (!exists $results{$test}{$platform}{$type}{$float}
145 || $results{$test}{$platform}{$type}{$float} ne 'fail') {
146 $results{$test}{$platform}{$type}{$float} = $eps;
148 if ($type =~ /^real|imag$/) {
149 $results{$test}{'type'} = 'complex';
150 } elsif ($type eq 'normal') {
151 $results{$test}{'type'} = 'normal';
155 print "Skipping unknown entry: `$_'\n";
161 my ($fct, $platform, $type, $float) = @_;
163 return (exists $results{$fct}{$platform}{$type}{$float}
164 ?
$results{$fct}{$platform}{$type}{$float} : "0");
167 sub canonicalize_platform
{
170 $platform =~ s
|^(.*/sysdeps/)||;
173 return exists $pplatforms{$platform} ?
$pplatforms{$platform} : $platform;
176 sub print_platforms
{
178 my ($fct, $platform, $float, $first, $i, $platform_no, $platform_total);
180 print '@multitable {nexttowardf} ';
182 print ' {1000 + i 1000}';
186 print '@item Function ';
189 print &canonicalize_platform
($_);
194 foreach $fct (@all_functions) {
195 foreach $float (@all_floats) {
196 print "\@item $fct$suffices{$float} ";
197 foreach $platform (@p) {
199 if (exists $results{$fct}{$platform}{'normal'}{$float}
200 || exists $results{$fct}{$platform}{'real'}{$float}
201 || exists $results{$fct}{$platform}{'imag'}{$float}) {
202 if ($results{$fct}{'type'} eq 'complex') {
203 print &get_value
($fct, $platform, 'real', $float),
204 ' + i ', &get_value
($fct, $platform, 'imag', $float);
206 print $results{$fct}{$platform}{'normal'}{$float};
216 print "\@end multitable\n";
224 # Print only 5 platforms at a time.
225 for ($i=0; $i < $#platforms; $i+=$columns) {
226 $max = $i+$columns-1 > $#platforms ?
$#platforms : $i+$columns-1;
227 print_platforms
(@platforms[$i .. $max]);
234 $pa = $pplatforms{$a} ?
$pplatforms{$a} : $a;
235 $pb = $pplatforms{$b} ?
$pplatforms{$b} : $b;