From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Cc: Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCH 3/6] softfloat: add float{x80, 128}_maybe_silence_nan()
Date: Mon, 3 Jan 2011 15:34:30 +0100 [thread overview]
Message-ID: <1294065273-30274-4-git-send-email-aurelien@aurel32.net> (raw)
In-Reply-To: <1294065273-30274-1-git-send-email-aurelien@aurel32.net>
Add float{x80,128}_maybe_silence_nan() functions, they will be need by
propagateFloat{x80,128}NaN().
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
fpu/softfloat-specialize.h | 38 ++++++++++++++++++++++++++++++++++++++
fpu/softfloat.h | 2 ++
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index 31481e7..49e3cc2 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -470,6 +470,25 @@ int floatx80_is_signaling_nan( floatx80 a )
}
/*----------------------------------------------------------------------------
+| Returns a quiet NaN if the extended double-precision floating point value
+| `a' is a signaling NaN; otherwise returns `a'.
+*----------------------------------------------------------------------------*/
+
+floatx80 floatx80_maybe_silence_nan( floatx80 a )
+{
+ if (floatx80_is_signaling_nan(a)) {
+#if SNAN_BIT_IS_ONE
+ a.low = floatx80_default_nan_low;
+ a.high = floatx80_default_nan_high;
+#else
+ a.low |= LIT64( 0xC000000000000000 );
+ return a;
+#endif
+ }
+ return a;
+}
+
+/*----------------------------------------------------------------------------
| Returns the result of converting the extended double-precision floating-
| point NaN `a' to the canonical NaN format. If `a' is a signaling NaN, the
| invalid exception is raised.
@@ -601,6 +620,25 @@ int float128_is_signaling_nan( float128 a )
}
/*----------------------------------------------------------------------------
+| Returns a quiet NaN if the quadruple-precision floating point value `a' is
+| a signaling NaN; otherwise returns `a'.
+*----------------------------------------------------------------------------*/
+
+float128 float128_maybe_silence_nan( float128 a )
+{
+ if (float128_is_signaling_nan(a)) {
+#if SNAN_BIT_IS_ONE
+ a.low = float128_default_nan_low;
+ a.high = float128_default_nan_high;
+#else
+ a.high |= LIT64( 0x0000800000000000 );
+ return a;
+#endif
+ }
+ return a;
+}
+
+/*----------------------------------------------------------------------------
| Returns the result of converting the quadruple-precision floating-point NaN
| `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid
| exception is raised.
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 1f37877..f2104c6 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -439,6 +439,7 @@ int floatx80_le_quiet( floatx80, floatx80 STATUS_PARAM );
int floatx80_lt_quiet( floatx80, floatx80 STATUS_PARAM );
int floatx80_is_quiet_nan( floatx80 );
int floatx80_is_signaling_nan( floatx80 );
+floatx80 floatx80_maybe_silence_nan( floatx80 );
floatx80 floatx80_scalbn( floatx80, int STATUS_PARAM );
INLINE floatx80 floatx80_abs(floatx80 a)
@@ -505,6 +506,7 @@ int float128_compare( float128, float128 STATUS_PARAM );
int float128_compare_quiet( float128, float128 STATUS_PARAM );
int float128_is_quiet_nan( float128 );
int float128_is_signaling_nan( float128 );
+float128 float128_maybe_silence_nan( float128 );
float128 float128_scalbn( float128, int STATUS_PARAM );
INLINE float128 float128_abs(float128 a)
--
1.7.2.3
next prev parent reply other threads:[~2011-01-03 14:34 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-03 14:34 [Qemu-devel] softfloat: fix NaN propagation for MIPS and PowerPC + cleanup Aurelien Jarno
2011-01-03 14:34 ` [Qemu-devel] [PATCH 1/6] softfloat: remove HPPA specific code Aurelien Jarno
2011-01-03 15:22 ` Peter Maydell
2011-01-03 15:26 ` Aurelien Jarno
2011-01-04 19:54 ` Andreas Färber
2011-01-04 20:07 ` Aurelien Jarno
2011-01-04 22:53 ` Andreas Färber
2011-01-04 23:56 ` Aurelien Jarno
2011-01-05 8:15 ` Andreas Färber
2011-01-05 10:21 ` Aurelien Jarno
2011-01-05 23:13 ` Stuart Brady
2011-01-06 8:58 ` Peter Maydell
2011-01-06 18:13 ` Stuart Brady
2011-01-06 18:43 ` Peter Maydell
2011-01-06 19:25 ` Stuart Brady
2011-01-06 14:35 ` Aurelien Jarno
2011-01-06 15:34 ` Peter Maydell
2011-01-06 18:48 ` Aurelien Jarno
2011-01-06 21:19 ` Peter Maydell
2011-01-06 21:31 ` Aurelien Jarno
2011-01-06 19:26 ` Nathan Froyd
2011-01-06 13:10 ` Andreas Färber
2011-01-06 15:08 ` Aurelien Jarno
2011-01-03 14:34 ` [Qemu-devel] [PATCH 2/6] softfloat: fix float{32, 64}_maybe_silence_nan() for MIPS Aurelien Jarno
2011-01-03 15:15 ` Peter Maydell
2011-01-03 15:24 ` Aurelien Jarno
2011-01-03 14:34 ` Aurelien Jarno [this message]
2011-01-03 15:33 ` [Qemu-devel] [PATCH 3/6] softfloat: add float{x80, 128}_maybe_silence_nan() Peter Maydell
2011-01-03 14:34 ` [Qemu-devel] [PATCH 4/6] softfloat: use float{32, 64, x80, 128}_maybe_silence_nan() Aurelien Jarno
2011-01-03 17:34 ` Peter Maydell
2011-01-03 22:44 ` Aurelien Jarno
2011-01-03 14:34 ` [Qemu-devel] [PATCH 5/6] target-mips: Implement correct NaN propagation rules Aurelien Jarno
2011-01-03 14:34 ` [Qemu-devel] [PATCH 6/6] target-ppc: " Aurelien Jarno
2011-01-05 12:45 ` Nathan Froyd
2011-01-05 17:24 ` [Qemu-devel] " Alexander Graf
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=1294065273-30274-4-git-send-email-aurelien@aurel32.net \
--to=aurelien@aurel32.net \
--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).