diff mbox

!fixup softfloat: get default NaN values for SNAN_BIT_IS_ONE right

Message ID 1418320836-5622-1-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell Dec. 11, 2014, 6 p.m. UTC
The default NaN values for SNAN_BIT_IS_ONE were actually
infinities (all exponent bits set, all mantissa bits clear).
Make them really NaNs (all exponent bits set, top bit of
mantissa clear, all other mantissa bits set).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This fixes the error pointed out by Maciej.

I'll squash this patch into the other softfloat-relicensing patch;
it didn't seem worth sending out the whole series again for this
since I anticipate further review. In the meantime, here's the

 fpu/softfloat-specialize.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox


diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index b65505f..5b4dbcd 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -116,7 +116,7 @@  const float32 float32_default_nan = const_float32(0x7FFFFFFF);
 const float32 float32_default_nan = const_float32(0x7FC00000);
-const float32 float32_default_nan = const_float32(0xFF800000);
+const float32 float32_default_nan = const_float32(0x7FBFFFFF);
 const float32 float32_default_nan = const_float32(0xFFC00000);
@@ -129,7 +129,7 @@  const float64 float64_default_nan = const_float64(LIT64( 0x7FFFFFFFFFFFFFFF ));
 #elif defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA)
 const float64 float64_default_nan = const_float64(LIT64( 0x7FF8000000000000 ));
-const float64 float64_default_nan = const_float64(LIT64(0xFFF0000000000000));
+const float64 float64_default_nan = const_float64(LIT64(0x7FF7FFFFFFFFFFFF));
 const float64 float64_default_nan = const_float64(LIT64( 0xFFF8000000000000 ));
@@ -138,8 +138,8 @@  const float64 float64_default_nan = const_float64(LIT64( 0xFFF8000000000000 ));
 | The pattern for a default generated extended double-precision NaN.
-#define floatx80_default_nan_high 0xFFFF
-#define floatx80_default_nan_low  LIT64(0x8000000000000000)
+#define floatx80_default_nan_high 0x7FFF
+#define floatx80_default_nan_low  LIT64(0xBFFFFFFFFFFFFFFF)
 #define floatx80_default_nan_high 0xFFFF
 #define floatx80_default_nan_low  LIT64( 0xC000000000000000 )
@@ -153,8 +153,8 @@  const floatx80 floatx80_default_nan
 | `low' values hold the most- and least-significant bits, respectively.
-#define float128_default_nan_high LIT64(0xFFFF000000000000)
-#define float128_default_nan_low  LIT64(0x0000000000000000)
+#define float128_default_nan_high LIT64(0x7FFF7FFFFFFFFFFF)
+#define float128_default_nan_low  LIT64(0xFFFFFFFFFFFFFFFF)
 #define float128_default_nan_high LIT64( 0xFFFF800000000000 )
 #define float128_default_nan_low  LIT64( 0x0000000000000000 )