qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ben Taylor <sol10x86@cox.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Updated PATCH: solaris-softloat.diff
Date: Fri, 28 Apr 2006 13:04:23 -0400	[thread overview]
Message-ID: <3686352.1146243863904.JavaMail.root@eastrmwml05.mgt.cox.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

After figuring out there was some typos in fpu/softfloat-native.h, this patch has been
reworked to more closely mirror the BSD structure.

This is against the current CVS  post pbrook's patching of fpu/softfloat-native.h

Ben

[-- Attachment #2: solaris-softfloat.diff --]
[-- Type: text/x-patch, Size: 4927 bytes --]

diff -ruN qemu/configure qemu-solaris/configure
--- qemu/configure	2006-04-27 17:05:14.000000000 -0400
+++ qemu-solaris/configure	2006-04-28 10:13:05.630371000 -0400
@@ -148,9 +148,6 @@
     make="gmake"
     install="ginstall"
     solarisrev=`uname -r | cut -f2 -d.`
-    if test $solarisrev -lt 10 ; then
-      presolaris10="yes"
-    fi
 fi
 
 # find source path
@@ -640,9 +637,7 @@
 fi
 if test "$solaris" = "yes" ; then
   echo "CONFIG_SOLARIS=yes" >> $config_mak
-  if test "$presolaris10" = "yes" ; then
-    echo "#define _PRESOLARIS10 1" >> $config_h
-  fi
+  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
 fi
 if test "$gdbstub" = "yes" ; then
   echo "CONFIG_GDBSTUB=yes" >> $config_mak
diff -ruN qemu/fpu/softfloat-native.c qemu-solaris/fpu/softfloat-native.c
--- qemu/fpu/softfloat-native.c	2006-04-23 18:59:41.000000000 -0400
+++ qemu-solaris/fpu/softfloat-native.c	2006-04-28 12:46:39.078840000 -0400
@@ -6,7 +6,7 @@
 void set_float_rounding_mode(int val STATUS_PARAM)
 {
     STATUS(float_rounding_mode) = val;
-#if defined(_BSD) && !defined(__APPLE__)
+#if defined(_BSD) && !defined(__APPLE__) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10)
     fpsetround(val);
 #elif defined(__arm__)
     /* nothing to do */
@@ -22,9 +22,14 @@
 }
 #endif
 
-#if defined(_BSD)
-#define lrint(d)		((long)rint(d))
-#define llrint(d)		((long long)rint(d))
+#if defined(_BSD) || (defined(HOST_SOLARIS) && HOST_SOLARIS < 10)
+#define lrint(d)		((int32_t)rint(d))
+#define llrint(d)		((int64_t)rint(d))
+#define lrintf(f)		((int32_t)rint(f))
+#define llrintf(f)		((int64_t)rint(f))
+#define sqrtf(f)		((float)sqrt(f))
+#define remainderf(fa, fb)	((float)remainder(fa, fb))
+#define rintf(f)		((float)rint(f))
 #endif
 
 #if defined(__powerpc__)
diff -ruN qemu/fpu/softfloat-native.h qemu-solaris/fpu/softfloat-native.h
--- qemu/fpu/softfloat-native.h	2006-04-28 11:26:51.000000000 -0400
+++ qemu-solaris/fpu/softfloat-native.h	2006-04-28 12:49:02.689799000 -0400
@@ -1,11 +1,36 @@
 /* Native implementation of soft float functions */
 #include <math.h>
-#if defined(_BSD) && !defined(__APPLE__)
+
+#if (defined(_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS)
 #include <ieeefp.h>
+#define fabsf(f) ((float)fabs(f))
 #else
-#if !defined(_PRESOLARIS10)
 #include <fenv.h>
 #endif
+
+/*
+ * Define some C99-7.12.3 classification macros and
+ *        some C99-.12.4 for Solaris systems OS less than 10,
+ *        or Solaris 10 systems running GCC 3.x or less.
+ *   Solaris 10 with GCC4 does not need these macros as they
+ *   are defined in <iso/math_c99.h> with a compiler directive
+ */
+#if defined(HOST_SOLARIS) && (( HOST_SOLARIS <= 9 ) || ( ( HOST_SOLARIS >= 10 ) && ( __GNUC__ <= 4) ))
+/*
+ * C99 7.12.3 classification macros
+ * and
+ * C99 7.12.14 comparison macros
+ *
+ * ... do not work on Solaris 10 using GNU CC 3.4.x.
+ * Try to workaround the missing / broken C99 math macros.
+ */
+
+#define isnormal(x)             (fpclass(x) >= FP_NZERO)
+#define isgreater(x, y)         ((!unordered(x, y)) && ((x) > (y)))
+#define isgreaterequal(x, y)    ((!unordered(x, y)) && ((x) >= (y)))
+#define isless(x, y)            ((!unordered(x, y)) && ((x) < (y)))
+#define islessequal(x, y)       ((!unordered(x, y)) && ((x) <= (y)))
+#define isunordered(x,y)        unordered(x, y)
 #endif
 
 typedef float float32;
@@ -35,7 +60,7 @@
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE floating-point rounding mode.
 *----------------------------------------------------------------------------*/
-#if defined(_BSD) && !defined(__APPLE__)
+#if (defined(_BSD) && !defined(__APPLE__)) || defined(HOST_SOLARIS)
 enum {
     float_round_nearest_even = FP_RN,
     float_round_down         = FP_RM,
diff -ruN qemu/fpu/softfloat-specialize.h qemu-solaris/fpu/softfloat-specialize.h
--- qemu/fpu/softfloat-specialize.h	2005-03-13 11:54:06.000000000 -0500
+++ qemu-solaris/fpu/softfloat-specialize.h	2006-04-28 10:56:36.073018000 -0400
@@ -43,7 +43,7 @@
 | should be simply `float_exception_flags |= flags;'.
 *----------------------------------------------------------------------------*/
 
-void float_raise( int8 flags STATUS_PARAM )
+void float_raise( signed char flags STATUS_PARAM )
 {
 
     STATUS(float_exception_flags) |= flags;
diff -ruN qemu/fpu/softfloat.h qemu-solaris/fpu/softfloat.h
--- qemu/fpu/softfloat.h	2006-04-25 18:36:06.000000000 -0400
+++ qemu-solaris/fpu/softfloat.h	2006-04-28 12:17:04.341485000 -0400
@@ -177,7 +177,7 @@
 | Routine to raise any or all of the software IEC/IEEE floating-point
 | exception flags.
 *----------------------------------------------------------------------------*/
-void float_raise( int8 flags STATUS_PARAM);
+void float_raise( signed char flags STATUS_PARAM);
 
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE integer-to-floating-point conversion routines.

                 reply	other threads:[~2006-04-28 17:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3686352.1146243863904.JavaMail.root@eastrmwml05.mgt.cox.net \
    --to=sol10x86@cox.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).