re PR target/25960 (__gcc_qadd doesn't handle -0.0L properly)
authorAlan Modra <amodra@bigpond.net.au>
Fri, 3 Feb 2006 11:44:08 +0000 (11:44 +0000)
committerAlan Modra <amodra@gcc.gnu.org>
Fri, 3 Feb 2006 11:44:08 +0000 (22:14 +1030)
PR target/25960
gcc/
* config/rs6000/darwin-ldouble.c (__gcc_qadd): Preserve -0.0 result.
gcc/testsuite/
* gcc.target/powerpc/pr25960.c: New test.

From-SVN: r110540

gcc/ChangeLog
gcc/config/rs6000/darwin-ldouble.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr25960.c [new file with mode: 0644]

index 2a8be97..53e6953 100644 (file)
@@ -1,3 +1,8 @@
+2006-02-03  Alan Modra  <amodra@bigpond.net.au>
+
+       PR target/25960
+       * config/rs6000/darwin-ldouble.c (__gcc_qadd): Preserve -0.0 result.
+
 2006-02-03  Andreas Krebbel  <krebbel1@de.ibm.com>
             Ulrich Weigand  <uweigand@de.ibm.com>
 
 
 2006-01-20  Alan Modra  <amodra@bigpond.net.au>
 
+       PR target/25668
        * libgcc2.c (__floatdisf, __floatdidf): Don't use IBM Extended
        Double TFmode.
        (__floatundisf, __floatundidf): Likewise.
index 11df649..08ff351 100644 (file)
@@ -117,8 +117,12 @@ __gcc_qadd (double a, double aa, double c, double cc)
     {
       q = a - z;
       zz = q + c + (a - (q + z)) + aa + cc;
-      xh = z + zz;
 
+      /* Keep -0 result.  */
+      if (zz == 0.0)
+       return z;
+
+      xh = z + zz;
       if (nonfinite (xh))
        return xh;
 
index 217aad8..c4d4528 100644 (file)
@@ -1,3 +1,7 @@
+2006-02-03  Alan Modra  <amodra@bigpond.net.au>
+
+       * gcc.target/powerpc/pr25960.c: New test.
+
 2006-02-02  Steven G. Kargl  <kargls@comcast>
 
        PR fortran/24958
diff --git a/gcc/testsuite/gcc.target/powerpc/pr25960.c b/gcc/testsuite/gcc.target/powerpc/pr25960.c
new file mode 100644 (file)
index 0000000..9ab9a10
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do run { target { powerpc*-*-darwin* powerpc*-*-aix* rs6000-*-* powerpc*-*-linux* } } } */
+/* { dg-options "-O2 -mlong-double-128" } */
+
+extern void abort (void);
+
+volatile long double l, m, n;
+
+int
+main (void)
+{
+  l = __builtin_copysignl (0.0L, -1.0L);
+  m = __builtin_copysignl (0.0L, -1.0L);
+  n = l + m;
+  if (__builtin_copysignl (1.0L, n) >= 0.0L)
+    abort ();
+  return 0;
+}