This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PowerPC] pr25960: __gcc_qadd doesn't handle -0.0L properly
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: gcc-patches at gcc dot gnu dot org
- Cc: geoffk at gcc dot gnu dot org
- Date: Fri, 3 Feb 2006 11:20:33 +1030
- Subject: [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