Skip to content

Commit

Permalink
Fix nvsize in config/auto/format.pm, number_4*_be pbcs
Browse files Browse the repository at this point in the history
nvsize should be the same as numvalsize, probed in auto::sizes,
but not one of floatvalsize, doublevalsize or hugefloatvalsize.
E.g. with long double used and __float128 possible hugefloatvalsize
is 16

Add generated ppc pbcs
  • Loading branch information
Reini Urban committed Sep 9, 2012
1 parent 5851213 commit 44b7e3d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions config/auto/format.pm
Expand Up @@ -61,32 +61,30 @@ sub _set_intvalfmt {

sub _set_floatvalfmt_nvsize {
my $conf = shift;
my ( $nv, $floatsize, $doublesize, $ldsize, $cpuarch ) =
$conf->data->get(qw(nv floatsize doublesize hugefloatvalsize cpuarch));
my ( $nv, $numvalsize, $cpuarch ) =
$conf->data->get(qw(nv numvalsize cpuarch));
my ( $nvformat, $nvsize, $floattype );
$nvsize = $floatsize;
$nvsize = $numvalsize;
if ( $nv eq "double" ) {
$nvsize = $doublesize;
$nvformat = "%.15g";
$floattype = 'FLOATTYPE_8';
}
elsif ( $nv eq "long double" ) {
# 64 or 80 bits, 12 or 16 bytes
$nvsize = $ldsize;
my $spri = $conf->data->get('sPRIgldbl_provisional');
if ( defined $spri ) {
# TT #308 same values as in imcc
if ($nvsize == 8) {
$floattype = 'FLOATTYPE_8';
$nvformat = "%.16" . $spri;
$nvformat = "%.15" . $spri;
}
elsif ($nvsize == 12) {
$floattype = 'FLOATTYPE_10';
$nvformat = "%.16Lg"; # i386 only
}
elsif ($nvsize == 16) {
$nvformat = "%.41Lg";
if ($cpuarch =~ /^amd64|ia64$/) {
if ($cpuarch =~ /^i386|amd64|ia64$/) {
$floattype = 'FLOATTYPE_10';
$nvformat = "%.16Lg";
}
Expand All @@ -95,7 +93,8 @@ sub _set_floatvalfmt_nvsize {
$floattype = 'FLOATTYPE_16MIPS';
}
elsif ($cpuarch eq 'ppc') {
# double-double
# double-double https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/float.3.html
$nvformat = "%.31Lg";
$floattype = 'FLOATTYPE_16PPC';
}
elsif ($cpuarch =~ /^s390|sparc/) {
Expand All @@ -113,7 +112,6 @@ sub _set_floatvalfmt_nvsize {
}
}
elsif ( $nv eq '__float128' ) {
$nvsize = $ldsize;
# TODO probe for "%Qg" libquadmath printf hook support (linux only)
$nvformat = "%.41Lg";
$floattype = 'FLOATTYPE_16';
Expand Down
Binary file added t/native_pbc/integer_4_be.pbc
Binary file not shown.
Binary file added t/native_pbc/number_4_16PPC_be.pbc
Binary file not shown.
Binary file added t/native_pbc/string_4_be.pbc
Binary file not shown.

0 comments on commit 44b7e3d

Please sign in to comment.