1999-10-29 17:38:14 +00:00
|
|
|
#!/usr/bin/perl -w
|
2018-01-01 00:32:25 +00:00
|
|
|
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
1999-10-29 17:38:14 +00:00
|
|
|
# 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
|
2001-07-06 04:58:11 +00:00
|
|
|
# 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.
|
1999-10-29 17:38:14 +00:00
|
|
|
|
|
|
|
# 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
|
2001-07-06 04:58:11 +00:00
|
|
|
# Lesser General Public License for more details.
|
1999-10-29 17:38:14 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
# License along with the GNU C Library; if not, see
|
|
|
|
# <http://www.gnu.org/licenses/>.
|
1999-10-29 17:38:14 +00:00
|
|
|
|
|
|
|
# Information about tests are stored in: %results
|
|
|
|
# $results{$test}{"type"} is the result type, e.g. normal or complex.
|
|
|
|
# In the following description $platform, $type and $float are:
|
|
|
|
# - $platform is the used platform
|
|
|
|
# - $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}{$platform}{$type}{$float} is defined and has a delta
|
|
|
|
# or 'fail' as value.
|
|
|
|
|
|
|
|
use File::Find;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use vars qw ($sources @platforms %pplatforms);
|
2017-02-06 17:55:59 +00:00
|
|
|
use vars qw (%results @all_floats %suffices %all_functions);
|
1999-10-29 17:38:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
# all_floats is in output order and contains all recognised float types that
|
|
|
|
# we're going to output
|
2017-06-22 13:07:04 +00:00
|
|
|
@all_floats = ('float', 'double', 'ldouble', 'float128');
|
1999-10-29 17:38:14 +00:00
|
|
|
%suffices =
|
|
|
|
( 'float' => 'f',
|
|
|
|
'double' => '',
|
2017-06-22 13:07:04 +00:00
|
|
|
'ldouble' => 'l',
|
|
|
|
'float128' => 'f128'
|
1999-10-29 17:38:14 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
# Pretty description of platform
|
2016-11-04 16:49:06 +00:00
|
|
|
%pplatforms = ();
|
1999-10-29 17:38:14 +00:00
|
|
|
|
2017-02-06 17:55:59 +00:00
|
|
|
%all_functions = ();
|
1999-10-29 17:38:14 +00:00
|
|
|
|
|
|
|
if ($#ARGV == 0) {
|
|
|
|
$sources = $ARGV[0];
|
|
|
|
} else {
|
|
|
|
$sources = '/usr/src/cvs/libc';
|
|
|
|
}
|
|
|
|
|
|
|
|
find (\&find_files, $sources);
|
|
|
|
|
2001-08-28 08:05:41 +00:00
|
|
|
@platforms = sort by_platforms @platforms;
|
|
|
|
|
1999-10-29 17:38:14 +00:00
|
|
|
&print_all;
|
|
|
|
|
|
|
|
sub find_files {
|
|
|
|
if ($_ eq 'libm-test-ulps') {
|
|
|
|
# print "Parsing $File::Find::name\n";
|
|
|
|
push @platforms, $File::Find::dir;
|
2016-11-04 16:49:06 +00:00
|
|
|
my ($file, $name);
|
|
|
|
$file = "${File::Find::name}-name";
|
|
|
|
open NAME, $file or die ("Can't open $file: $!");
|
|
|
|
$name = <NAME>;
|
|
|
|
chomp $name;
|
|
|
|
close NAME;
|
|
|
|
$pplatforms{$File::Find::dir} = $name;
|
1999-10-29 17:38:14 +00:00
|
|
|
&parse_ulps ($File::Find::name, $File::Find::dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Parse ulps file
|
|
|
|
sub parse_ulps {
|
|
|
|
my ($file, $platform) = @_;
|
2017-02-06 17:55:59 +00:00
|
|
|
my ($test, $type, $float, $eps, $ignore_fn);
|
1999-10-29 17:38:14 +00:00
|
|
|
|
|
|
|
# $type has the following values:
|
|
|
|
# "normal": No complex variable
|
|
|
|
# "real": Real part of complex result
|
|
|
|
# "imag": Imaginary part of complex result
|
|
|
|
open ULP, $file or die ("Can't open $file: $!");
|
|
|
|
while (<ULP>) {
|
|
|
|
chop;
|
|
|
|
# ignore comments and empty lines
|
|
|
|
next if /^#/;
|
|
|
|
next if /^\s*$/;
|
|
|
|
if (/^Function: /) {
|
2001-06-05 06:21:21 +00:00
|
|
|
if (/Real part of/) {
|
1999-10-29 17:38:14 +00:00
|
|
|
s/Real part of //;
|
|
|
|
$type = 'real';
|
|
|
|
} elsif (/Imaginary part of/) {
|
|
|
|
s/Imaginary part of //;
|
|
|
|
$type = 'imag';
|
|
|
|
} else {
|
|
|
|
$type = 'normal';
|
|
|
|
}
|
|
|
|
($test) = ($_ =~ /^Function:\s*\"([a-zA-Z0-9_]+)\"/);
|
|
|
|
next;
|
|
|
|
}
|
2017-02-06 17:55:59 +00:00
|
|
|
if ($test =~ /_(downward|towardzero|upward|vlen)/) {
|
|
|
|
$ignore_fn = 1;
|
|
|
|
} else {
|
|
|
|
$ignore_fn = 0;
|
|
|
|
$all_functions{$test} = 1;
|
|
|
|
}
|
2017-06-22 13:07:04 +00:00
|
|
|
if (/^i?(float|double|ldouble|float128):/) {
|
1999-10-29 17:38:14 +00:00
|
|
|
($float, $eps) = split /\s*:\s*/,$_,2;
|
2017-02-06 17:55:59 +00:00
|
|
|
if ($ignore_fn) {
|
|
|
|
next;
|
|
|
|
} elsif ($eps eq 'fail') {
|
1999-10-29 17:38:14 +00:00
|
|
|
$results{$test}{$platform}{$type}{$float} = 'fail';
|
|
|
|
} elsif ($eps eq "0") {
|
|
|
|
# ignore
|
|
|
|
next;
|
2001-08-28 08:05:41 +00:00
|
|
|
} elsif (!exists $results{$test}{$platform}{$type}{$float}
|
1999-10-29 17:38:14 +00:00
|
|
|
|| $results{$test}{$platform}{$type}{$float} ne 'fail') {
|
|
|
|
$results{$test}{$platform}{$type}{$float} = $eps;
|
|
|
|
}
|
|
|
|
if ($type =~ /^real|imag$/) {
|
|
|
|
$results{$test}{'type'} = 'complex';
|
|
|
|
} elsif ($type eq 'normal') {
|
|
|
|
$results{$test}{'type'} = 'normal';
|
|
|
|
}
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
print "Skipping unknown entry: `$_'\n";
|
|
|
|
}
|
|
|
|
close ULP;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub get_value {
|
|
|
|
my ($fct, $platform, $type, $float) = @_;
|
|
|
|
|
2001-08-28 08:05:41 +00:00
|
|
|
return (exists $results{$fct}{$platform}{$type}{$float}
|
1999-10-29 17:38:14 +00:00
|
|
|
? $results{$fct}{$platform}{$type}{$float} : "0");
|
|
|
|
}
|
|
|
|
|
2001-08-28 08:05:41 +00:00
|
|
|
sub print_platforms {
|
|
|
|
my (@p) = @_;
|
|
|
|
my ($fct, $platform, $float, $first, $i, $platform_no, $platform_total);
|
1999-10-29 17:38:14 +00:00
|
|
|
|
|
|
|
print '@multitable {nexttowardf} ';
|
2001-08-28 08:05:41 +00:00
|
|
|
foreach (@p) {
|
1999-10-29 17:38:14 +00:00
|
|
|
print ' {1000 + i 1000}';
|
|
|
|
}
|
|
|
|
print "\n";
|
|
|
|
|
|
|
|
print '@item Function ';
|
2001-08-28 08:05:41 +00:00
|
|
|
foreach (@p) {
|
1999-10-29 17:38:14 +00:00
|
|
|
print ' @tab ';
|
2016-11-04 16:49:06 +00:00
|
|
|
print $pplatforms{$_};
|
1999-10-29 17:38:14 +00:00
|
|
|
}
|
|
|
|
print "\n";
|
|
|
|
|
2001-08-28 08:05:41 +00:00
|
|
|
|
2017-02-06 17:55:59 +00:00
|
|
|
foreach $fct (sort keys %all_functions) {
|
1999-10-29 17:38:14 +00:00
|
|
|
foreach $float (@all_floats) {
|
|
|
|
print "\@item $fct$suffices{$float} ";
|
2001-08-28 08:05:41 +00:00
|
|
|
foreach $platform (@p) {
|
1999-10-29 17:38:14 +00:00
|
|
|
print ' @tab ';
|
|
|
|
if (exists $results{$fct}{$platform}{'normal'}{$float}
|
|
|
|
|| exists $results{$fct}{$platform}{'real'}{$float}
|
|
|
|
|| exists $results{$fct}{$platform}{'imag'}{$float}) {
|
|
|
|
if ($results{$fct}{'type'} eq 'complex') {
|
|
|
|
print &get_value ($fct, $platform, 'real', $float),
|
|
|
|
' + i ', &get_value ($fct, $platform, 'imag', $float);
|
|
|
|
} else {
|
|
|
|
print $results{$fct}{$platform}{'normal'}{$float};
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
print '-';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
print "\@end multitable\n";
|
|
|
|
}
|
2001-08-28 08:05:41 +00:00
|
|
|
|
|
|
|
sub print_all {
|
|
|
|
my ($i, $max);
|
|
|
|
|
|
|
|
my ($columns) = 5;
|
|
|
|
|
|
|
|
# Print only 5 platforms at a time.
|
|
|
|
for ($i=0; $i < $#platforms; $i+=$columns) {
|
|
|
|
$max = $i+$columns-1 > $#platforms ? $#platforms : $i+$columns-1;
|
|
|
|
print_platforms (@platforms[$i .. $max]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub by_platforms {
|
2016-11-04 16:49:06 +00:00
|
|
|
return $pplatforms{$a} cmp $pplatforms{$b};
|
2001-08-28 08:05:41 +00:00
|
|
|
}
|