!fixup softfloat: get default NaN values for SNAN_BIT_IS_ONE right
diff mbox

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
correction.

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

Patch
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);
       defined(TARGET_XTENSA)
 const float32 float32_default_nan = const_float32(0x7FC00000);
 #elif SNAN_BIT_IS_ONE
-const float32 float32_default_nan = const_float32(0xFF800000);
+const float32 float32_default_nan = const_float32(0x7FBFFFFF);
 #else
 const float32 float32_default_nan = const_float32(0xFFC00000);
 #endif
@@ -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 ));
 #elif SNAN_BIT_IS_ONE
-const float64 float64_default_nan = const_float64(LIT64(0xFFF0000000000000));
+const float64 float64_default_nan = const_float64(LIT64(0x7FF7FFFFFFFFFFFF));
 #else
 const float64 float64_default_nan = const_float64(LIT64( 0xFFF8000000000000 ));
 #endif
@@ -138,8 +138,8 @@  const float64 float64_default_nan = const_float64(LIT64( 0xFFF8000000000000 ));
 | The pattern for a default generated extended double-precision NaN.
 *----------------------------------------------------------------------------*/
 #if SNAN_BIT_IS_ONE
-#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)
 #else
 #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.
 *----------------------------------------------------------------------------*/
 #if SNAN_BIT_IS_ONE
-#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)
 #else
 #define float128_default_nan_high LIT64( 0xFFFF800000000000 )
 #define float128_default_nan_low  LIT64( 0x0000000000000000 )