qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [6052] target-ppc: fadd/fsub: correctly propagate NaN
@ 2008-12-15 17:14 Aurelien Jarno
  0 siblings, 0 replies; only message in thread
From: Aurelien Jarno @ 2008-12-15 17:14 UTC (permalink / raw)
  To: qemu-devel

Revision: 6052
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6052
Author:   aurel32
Date:     2008-12-15 17:14:35 +0000 (Mon, 15 Dec 2008)

Log Message:
-----------
target-ppc: fadd/fsub: correctly propagate NaN

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Modified Paths:
--------------
    trunk/target-ppc/op_helper.c

Modified: trunk/target-ppc/op_helper.c
===================================================================
--- trunk/target-ppc/op_helper.c	2008-12-15 17:14:27 UTC (rev 6051)
+++ trunk/target-ppc/op_helper.c	2008-12-15 17:14:35 UTC (rev 6052)
@@ -563,17 +563,7 @@
     return ((u.ll >> 52) & 0x7FF) == 0;
 }
 
-
 #ifdef CONFIG_SOFTFLOAT
-static always_inline int isfinite (float64 d)
-{
-    CPU_DoubleU u;
-
-    u.d = d;
-
-    return (((u.ll >> 52) & 0x7FF) != 0x7FF);
-}
-
 static always_inline int isnormal (float64 d)
 {
     CPU_DoubleU u;
@@ -1028,12 +1018,12 @@
                  float64_is_signaling_nan(farg2.d))) {
         /* sNaN addition */
         farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
-    } else if (likely(isfinite(farg1.d) || isfinite(farg2.d) ||
-                      float64_is_neg(farg1.d) == float64_is_neg(farg2.d))) {
-        farg1.d = float64_add(farg1.d, farg2.d, &env->fp_status);
-    } else {
+    } else if (unlikely(float64_is_infinity(farg1.d) && float64_is_infinity(farg2.d) &&
+                      float64_is_neg(farg1.d) != float64_is_neg(farg2.d))) {
         /* Magnitude subtraction of infinities */
         farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXISI);
+    } else {
+        farg1.d = float64_add(farg1.d, farg2.d, &env->fp_status);
     }
 #else
     farg1.d = float64_add(farg1.d, farg2.d, &env->fp_status);
@@ -1054,12 +1044,12 @@
                  float64_is_signaling_nan(farg2.d))) {
         /* sNaN subtraction */
         farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
-    } else if (likely(isfinite(farg1.d) || isfinite(farg2.d) ||
-                      float64_is_neg(farg1.d) != float64_is_neg(farg2.d))) {
-        farg1.d = float64_sub(farg1.d, farg2.d, &env->fp_status);
-    } else {
+    } else if (unlikely(float64_is_infinity(farg1.d) && float64_is_infinity(farg2.d) &&
+                      float64_is_neg(farg1.d) == float64_is_neg(farg2.d))) {
         /* Magnitude subtraction of infinities */
         farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXISI);
+    } else {
+        farg1.d = float64_sub(farg1.d, farg2.d, &env->fp_status);
     }
 }
 #else

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-15 17:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-15 17:14 [Qemu-devel] [6052] target-ppc: fadd/fsub: correctly propagate NaN Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).