qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PULL 17/26] target-hppa: Add softfloat specializations
Date: Sun, 22 Jan 2017 18:17:39 -0800	[thread overview]
Message-ID: <20170123021748.13170-18-rth@twiddle.net> (raw)
In-Reply-To: <20170123021748.13170-1-rth@twiddle.net>

Like the original MIPS, HPPA has the MSB of an SNaN set.
However, it has different rules for silencing an SNaN:
(1) msb is cleared and (2) msb-1 must be set if the fraction
is now zero, and (implementation defined) may be set always.
I haven't checked real hardware but chose the set always
alternative because it's easy and within spec.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 fpu/softfloat-specialize.h | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index f5aed72..f05c865 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -116,6 +116,8 @@ float32 float32_default_nan(float_status *status)
 #elif defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA) || \
       defined(TARGET_XTENSA) || defined(TARGET_S390X) || defined(TARGET_TRICORE)
     return const_float32(0x7FC00000);
+#elif defined(TARGET_HPPA)
+    return const_float32(0x7FA00000);
 #else
     if (status->snan_bit_is_one) {
         return const_float32(0x7FBFFFFF);
@@ -139,6 +141,8 @@ float64 float64_default_nan(float_status *status)
 #elif defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA) || \
       defined(TARGET_S390X)
     return const_float64(LIT64(0x7FF8000000000000));
+#elif defined(TARGET_HPPA)
+    return const_float64(LIT64(0x7FF4000000000000));
 #else
     if (status->snan_bit_is_one) {
         return const_float64(LIT64(0x7FF7FFFFFFFFFFFF));
@@ -361,7 +365,14 @@ float32 float32_maybe_silence_nan(float32 a_, float_status *status)
 {
     if (float32_is_signaling_nan(a_, status)) {
         if (status->snan_bit_is_one) {
+#ifdef TARGET_HPPA
+            uint32_t a = float32_val(a_);
+            a &= ~0x00400000;
+            a |=  0x00200000;
+            return make_float32(a);
+#else
             return float32_default_nan(status);
+#endif
         } else {
             uint32_t a = float32_val(a_);
             a |= (1 << 22);
@@ -449,7 +460,7 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
         return 1;
     }
 }
-#elif defined(TARGET_MIPS)
+#elif defined(TARGET_MIPS) || defined(TARGET_HPPA)
 static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
                     flag aIsLargerSignificand)
 {
@@ -794,7 +805,14 @@ float64 float64_maybe_silence_nan(float64 a_, float_status *status)
 {
     if (float64_is_signaling_nan(a_, status)) {
         if (status->snan_bit_is_one) {
+#ifdef TARGET_HPPA
+            uint64_t a = float64_val(a_);
+            a &= ~0x0008000000000000ULL;
+            a |=  0x0004000000000000ULL;
+            return make_float64(a);
+#else
             return float64_default_nan(status);
+#endif
         } else {
             uint64_t a = float64_val(a_);
             a |= LIT64(0x0008000000000000);
-- 
2.9.3

  parent reply	other threads:[~2017-01-23  2:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23  2:17 [Qemu-devel] [PULL 00/26] New hppa-linux target support Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 01/26] Revert "Remove remainders of HPPA backend" Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 02/26] linux-user: Support stack-grows-up in elfload.c Richard Henderson
2017-06-27 16:32   ` Peter Maydell
2017-01-23  2:17 ` [Qemu-devel] [PULL 03/26] linux-user: Handle TIOCSTART and TIOCSTOP Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 04/26] linux-user: Add SIOCGPGRP, SIOCGSTAMP, SIOCGSTAMPNS Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 05/26] linux-user: Handle ERFKILL and EHWPOISON Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 06/26] linux-user: Handle more IPV6 sockopts Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 08/26] linux-user: Add HPPA socket.h definitions Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 09/26] linux-user: Add HPPA syscall numbers Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 10/26] linux-user: Add HPPA termbits.h Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 11/26] linux-user: Add HPPA target_syscall.h Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 12/26] linux-user: Add HPPA definitions to syscall_defs.h Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 13/26] linux-user: Add HPPA target_structs.h Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 14/26] linux-user: Add HPPA target_signal.h and target_cpu.h Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 15/26] linux-user: Add HPPA signal handling Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 16/26] linux-user: Add HPPA startup and main loop Richard Henderson
2017-01-23  2:17 ` Richard Henderson [this message]
2017-01-23  2:17 ` [Qemu-devel] [PULL 18/26] target-hppa: Add framework and enable compilation Richard Henderson
2017-01-30 13:49   ` Peter Maydell
2017-02-07  2:27     ` Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 19/26] target-hppa: Add nullification framework Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 20/26] target-hppa: Implement basic arithmetic Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 21/26] target-hppa: Implement branches Richard Henderson
2017-01-26 12:14   ` Paolo Bonzini
2017-01-26 17:18     ` Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 22/26] target-hppa: Implement linux-user gateway page Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 23/26] target-hppa: Implement shifts and deposits Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 24/26] target-hppa: Implement loads and stores Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 25/26] target-hppa: Implement system and memory-management insns Richard Henderson
2017-01-23  2:17 ` [Qemu-devel] [PULL 26/26] target-hppa: Implement floating-point insns Richard Henderson
2017-01-23 10:31 ` [Qemu-devel] [PULL 00/26] New hppa-linux target support 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=20170123021748.13170-18-rth@twiddle.net \
    --to=rth@twiddle.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).