From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCH] softfloat: fix floatx80_is_{quiet, signaling}_nan()
Date: Wed, 12 Jan 2011 20:59:39 +0100 [thread overview]
Message-ID: <1294862379-31353-1-git-send-email-aurelien@aurel32.net> (raw)
floatx80_is_{quiet,signaling}_nan() functions are incorrectly detecting
the type of NaN, depending on SNAN_BIT_IS_ONE, one of the two is
returning the correct value, and the other true for any kind of NaN.
This patch fixes that by applying the same kind of comparison as for
other float formats, but taking into account the explicit bit.
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
fpu/softfloat-specialize.h | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index f293f24..50e56b4 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -482,7 +482,8 @@ int floatx80_is_quiet_nan( floatx80 a )
&& (bits64) ( aLow<<1 )
&& ( a.low == aLow );
#else
- return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 );
+ return ( ( a.high & 0x7FFF ) == 0x7FFF )
+ && (LIT64( 0x8000000000000000 ) >= ((bits64) ( a.low<<1 )));
#endif
}
@@ -494,7 +495,8 @@ int floatx80_is_quiet_nan( floatx80 a )
int floatx80_is_signaling_nan( floatx80 a )
{
#if SNAN_BIT_IS_ONE
- return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 );
+ return ( ( a.high & 0x7FFF ) == 0x7FFF )
+ && (LIT64( 0x8000000000000000 ) >= ((bits64) ( a.low<<1 )));
#else
bits64 aLow;
--
1.7.2.3
next reply other threads:[~2011-01-12 19:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-12 19:59 Aurelien Jarno [this message]
2011-01-12 21:05 ` [Qemu-devel] Re: [PATCH] softfloat: fix floatx80_is_{quiet, signaling}_nan() Peter Maydell
2011-01-13 7:31 ` Aurelien Jarno
2011-01-13 12:15 ` Peter Maydell
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=1294862379-31353-1-git-send-email-aurelien@aurel32.net \
--to=aurelien@aurel32.net \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).