This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/14406] New: rs6000 abstf2 is broken


The following demonstrates an error in the rs6000 abstf2 pattern.
The IBM extended double format uses a sum of two doubles to represent a long
double.  The first double is required to be the closest double to the long
double value, which implies that the second double may be of opposite sign to
the first.  

#include <stdio.h>

long double x = 0x1.FFFFFFFFFFFFF8P0L;

int main (void)
{
  long double y = __builtin_fabsl (x);
  union { long double ld; double d[2]; unsigned int x[4]; } u;

  u.ld = x;
  printf ("%e %e\n", u.d[0], u.d[1]);
  printf ("%08x %08x %08x %08x\n", u.x[0], u.x[1], u.x[2], u.x[3]);

  u.ld = y;
  printf ("%e %e\n", u.d[0], u.d[1]);
  printf ("%08x %08x %08x %08x\n", u.x[0], u.x[1], u.x[2], u.x[3]);
  return 0;
}

$ gcc/xgcc -Bgcc/ -O1 -mlong-double-128 /src/tmp/fabs.c
$ ./a.out
2.000000e+00 -1.110223e-16
40000000 00000000 bca00000 00000000
2.000000e+00 1.110223e-16
40000000 00000000 3ca00000 00000000

-- 
           Summary: rs6000 abstf2 is broken
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amodra at bigpond dot net dot au
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14406


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]