All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Cc: Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCH v2 4/8] softfloat: fix float{32, 64}_maybe_silence_nan() for MIPS
Date: Tue,  4 Jan 2011 16:15:46 +0100	[thread overview]
Message-ID: <1294154150-7528-5-git-send-email-aurelien@aurel32.net> (raw)
In-Reply-To: <1294154150-7528-1-git-send-email-aurelien@aurel32.net>

On targets that define sNaN with the sNaN bit as one, simply clearing
this bit may correspond to an infinite value.

Convert it to a default NaN if SNAN_BIT_IS_ONE, as it corresponds to
the MIPS implementation, the only emulated CPU with SNAN_BIT_IS_ONE.
When other CPU of this type are added, this might be updated to include
more cases.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 fpu/softfloat-specialize.h |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index 0003cbe..ac26214 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -107,13 +107,17 @@ int float32_is_signaling_nan( float32 a_ )
 float32 float32_maybe_silence_nan( float32 a_ )
 {
     if (float32_is_signaling_nan(a_)) {
-        bits32 a = float32_val(a_);
 #if SNAN_BIT_IS_ONE
-        a &= ~(1 << 22);
+#  if defined(TARGET_MIPS)
+        return float32_default_nan;
+#  else
+#    error Rules for silencing a signaling NaN are target-specific
+#  endif
 #else
+        bits32 a = float32_val(a_);
         a |= (1 << 22);
-#endif
         return make_float32(a);
+#endif
     }
     return a_;
 }
@@ -322,13 +326,17 @@ int float64_is_signaling_nan( float64 a_ )
 float64 float64_maybe_silence_nan( float64 a_ )
 {
     if (float64_is_signaling_nan(a_)) {
-        bits64 a = float64_val(a_);
 #if SNAN_BIT_IS_ONE
-        a &= ~LIT64( 0x0008000000000000 );
+#  if defined(TARGET_MIPS)
+        return float64_default_nan;
+#  else
+#    error Rules for silencing a signaling NaN are target-specific
+#  endif
 #else
+        bits64 a = float64_val(a_);
         a |= LIT64( 0x0008000000000000 );
-#endif
         return make_float64(a);
+#endif
     }
     return a_;
 }
-- 
1.7.2.3

  parent reply	other threads:[~2011-01-04 15:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-04 15:15 [Qemu-devel] (no subject) Aurelien Jarno
2011-01-04 15:15 ` [Qemu-devel] [PATCH v2 1/8] softfloat: remove HPPA specific code Aurelien Jarno
2011-01-04 15:15 ` [Qemu-devel] [PATCH v2 2/8] softfloat: use bits32 instead of uint32 Aurelien Jarno
2011-01-04 15:51   ` Peter Maydell
2011-01-04 16:11     ` Aurelien Jarno
2011-01-04 16:34       ` Peter Maydell
2011-01-04 19:23       ` Andreas Färber
2011-01-04 15:15 ` [Qemu-devel] [PATCH v2 3/8] softfloat: rename *IsNaN variables to *IsQuietNaN Aurelien Jarno
2011-01-04 16:01   ` Peter Maydell
2011-01-04 15:15 ` Aurelien Jarno [this message]
2011-01-04 15:15 ` [Qemu-devel] [PATCH v2 5/8] softfloat: add float{x80, 128}_maybe_silence_nan() Aurelien Jarno
2011-01-04 15:15 ` [Qemu-devel] [PATCH v2 6/8] softfloat: use float{32, 64, x80, 128}_maybe_silence_nan() Aurelien Jarno
2011-01-04 16:03   ` Peter Maydell
2011-01-04 15:15 ` [Qemu-devel] [PATCH v2 7/8] target-mips: Implement correct NaN propagation rules Aurelien Jarno
2011-01-04 15:15 ` [Qemu-devel] [PATCH v2 8/8] target-ppc: " Aurelien Jarno
2011-01-04 15:38   ` Peter Maydell
2011-01-04 15:41     ` Aurelien Jarno
2011-01-04 16:06 ` [Qemu-devel] (no subject) Peter Maydell
2011-01-04 16:12   ` Aurelien Jarno

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=1294154150-7528-5-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.