[Bug target/25960] __gcc_add doesn't handle -0.0L properly

2006-02-02 Thread amodra at bigpond dot net dot au


-- 

amodra at bigpond dot net dot au changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |amodra at bigpond dot net
   |dot org |dot au
 Status|REOPENED|ASSIGNED
   Last reconfirmed|2006-01-25 14:39:25 |2006-02-02 23:32:19
   date||


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



[Bug target/25960] __gcc_add doesn't handle -0.0L properly

2006-02-02 Thread geoffk at gcc dot gnu dot org


--- Comment #6 from geoffk at gcc dot gnu dot org  2006-02-02 08:50 ---
I agree with Alan.

Although the format is not compatible with IEEE arithmetic, this applies only
because the arithmetic is different, not the handling of special cases.  In
every case where the inputs are exactly representable as a double (including
+/-0, Inf, and NaN) and 'double' arithmetic would be exact, the result of the
computation in this 'long double' representation should be the same as if it
had been done in 'double'.

As for the patch, it looks right to me, but it's probably better for
performance if instead it does

if (zz == 0.0)
  return z;


-- 

geoffk at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|INVALID |


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



[Bug target/25960] __gcc_add doesn't handle -0.0L properly

2006-02-01 Thread amodra at bigpond dot net dot au


--- Comment #4 from amodra at bigpond dot net dot au  2006-02-02 04:30 
---
I don't think this bug should have been closed so quickly.  Fixing __gcc_qadd
to properly handle a -0 result is trivial, and only costs one extra compare and
branch.  The multiply and divide support in darwin-ldouble.c already have
special code for -0, with a comment Preserve -0, so I think lack of such a
test in __gcc_qadd is simply an oversight.


-- 

amodra at bigpond dot net dot au changed:

   What|Removed |Added

 CC||munroesj at us dot ibm dot
   ||com


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



[Bug target/25960] __gcc_add doesn't handle -0.0L properly

2006-02-01 Thread amodra at bigpond dot net dot au


--- Comment #5 from amodra at bigpond dot net dot au  2006-02-02 06:18 
---
* 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 110484)
+++ gcc/config/rs6000/darwin-ldouble.c  (working copy)
@@ -117,10 +117,15 @@ __gcc_qadd (double a, double aa, double 
 {
   q = a - z;
   zz = q + c + (a - (q + z)) + aa + cc;
-  xh = z + zz;
-
-  if (nonfinite (xh))
-   return xh;
+  xh = z;
+  /* Keep -0 result.  */
+  if (zz != 0.0)
+   {
+ xh += zz;
+
+ if (nonfinite (xh))
+   return xh;
+   }

   x.dval[0] = xh;
   x.dval[1] = z - xh + zz;


-- 


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



[Bug target/25960] __gcc_add doesn't handle -0.0L properly

2006-01-27 Thread dje at gcc dot gnu dot org


--- Comment #2 from dje at gcc dot gnu dot org  2006-01-27 17:59 ---
The IBM 128-bit extended floating point format is not fully compliant with IEEE
754.  It is functioning as designed.


-- 


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



[Bug target/25960] __gcc_add doesn't handle -0.0L properly

2006-01-27 Thread pinskia at gcc dot gnu dot org


--- Comment #3 from pinskia at gcc dot gnu dot org  2006-01-27 18:02 ---
So closing as invalid.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||INVALID


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



[Bug target/25960] __gcc_add doesn't handle -0.0L properly

2006-01-25 Thread pinskia at gcc dot gnu dot org


--- Comment #1 from pinskia at gcc dot gnu dot org  2006-01-25 14:39 ---
Confirmed on powerpc-darwin also which uses IBM's 128bit long double format by
default.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||geoffk at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
 GCC target triplet|powerpc*-linux  |powerpc*-*
   Keywords||wrong-code
   Last reconfirmed|-00-00 00:00:00 |2006-01-25 14:39:25
   date||


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