qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] [PPC] Math functions helper for CONFIG_SOFTFLOA


From: Aurelien Jarno
Subject: [Qemu-devel] [PATCH 2/3] [PPC] Math functions helper for CONFIG_SOFTFLOAT=yes
Date: Wed, 13 Feb 2008 01:45:55 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

The patch below adds isfinite() and isnormal() functions which can
work with float64 type, used when CONFIG_SOFTFLOAT=yes.

Signed-off-by: Aurelien Jarno <address@hidden>
---
 target-ppc/op_helper.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
index 7136e51..544d906 100644
--- a/target-ppc/op_helper.c
+++ b/target-ppc/op_helper.c
@@ -492,6 +492,27 @@ static always_inline int isinfinity (float64 d)
         (u.ll & 0x000FFFFFFFFFFFFFULL) == 0;
 }
 
+#ifdef CONFIG_SOFTFLOAT
+static always_inline int isfinite (float64 d)
+{
+    CPU_DoubleU u;
+
+    u.d = d;
+
+    return (((u.ll >> 52) & 0x7FF) != 0x7FF);
+}
+
+static always_inline int isnormal (float64 d)
+{
+    CPU_DoubleU u;
+
+    u.d = d;
+
+    uint32_t exp = (u.ll >> 52) & 0x7FF;
+    return ((0 < exp) && (exp < 0x7FF));
+}
+#endif
+
 void do_compute_fprf (int set_fprf)
 {
     int isneg;
-- 
1.5.3.8

-- 
  .''`.  Aurelien Jarno             | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   address@hidden         | address@hidden
   `-    people.debian.org/~aurel32 | www.aurel32.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]