diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-15 17:14:35 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-12-15 17:14:35 +0000 |
commit | 17218d1fd9b33a94028bdca3c4e9481f05e0a318 (patch) | |
tree | ce161bec2c6792f10b935b59e4cdb03dfeda7c43 /target-ppc/op_helper.c | |
parent | f23c346e69e293d26fdbb2bd06310b4e261b4749 (diff) |
target-ppc: fadd/fsub: correctly propagate NaN
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6052 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc/op_helper.c')
-rw-r--r-- | target-ppc/op_helper.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index 4368df8e4e..420059ca48 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -563,17 +563,7 @@ static always_inline int isden (float64 d) 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 @@ uint64_t helper_fadd (uint64_t arg1, uint64_t arg2) 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 @@ uint64_t helper_fsub (uint64_t arg1, uint64_t arg2) 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 |