qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	"Maciej W. Rozycki" <macro@codesourcery.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	patches@linaro.org
Subject: [Qemu-devel] [PATCH] !fixup softfloat: get default NaN values for SNAN_BIT_IS_ONE right
Date: Thu, 11 Dec 2014 18:00:36 +0000	[thread overview]
Message-ID: <1418320836-5622-1-git-send-email-peter.maydell@linaro.org> (raw)

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(-)

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 )
-- 
1.9.1

                 reply	other threads:[~2014-12-11 18:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418320836-5622-1-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=macro@codesourcery.com \
    --cc=patches@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).