This is the mail archive of the gcc-patches@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]

[PowerPC] pr25960: __gcc_qadd doesn't handle -0.0L properly


-0.0L + -0.0L ought to return -0.0L.  Bootstrapped and regression
tested powerpc64-linux.  OK mainline and 4.1?  I'll also add the
testcase in the PR to testsuite/gcc.target/powerpc/.

	PR target/25960
	* config/rs6000/darwin-ldouble.c (__gcc_qadd): Preserve -0.0 result.

Index: gcc/config/rs6000/darwin-ldouble.c
===================================================================
--- gcc/config/rs6000/darwin-ldouble.c	(revision 110522)
+++ gcc/config/rs6000/darwin-ldouble.c	(working copy)
@@ -117,8 +117,12 @@ __gcc_qadd (double a, double aa, double 
     {
       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;
 

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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