Source-Changes-HG archive

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

[src/trunk]: src/gnu/dist/gcc4/gcc/config/m68k Pull the following revision fr...



details:   https://anonhg.NetBSD.org/src/rev/84c292668158
branches:  trunk
changeset: 765792:84c292668158
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Mon Jun 06 12:02:26 2011 +0000

description:
Pull the following revision from upstream to provide __unordsf2() and
other missing softfloat functions:
---
Revision 108487
2005-12-13  Paul Brook  <paul%codesourcery.com@localhost>
        * config/m68k/fpgnulib.c (__unordsf2, __unorddf2, __unordxf2,
        __floatunsidf, __floatunsisf, __floatunsixf): New functions.
---

Fixes link errors of sources that refer isnan() on m68000.

Note this file is not GPLed.

diffstat:

 gnu/dist/gcc4/gcc/config/m68k/fpgnulib.c |  96 ++++++++++++++++++++++++++++++++
 1 files changed, 96 insertions(+), 0 deletions(-)

diffs (134 lines):

diff -r 0cdf3264766f -r 84c292668158 gnu/dist/gcc4/gcc/config/m68k/fpgnulib.c
--- a/gnu/dist/gcc4/gcc/config/m68k/fpgnulib.c  Mon Jun 06 08:04:19 2011 +0000
+++ b/gnu/dist/gcc4/gcc/config/m68k/fpgnulib.c  Mon Jun 06 12:02:26 2011 +0000
@@ -105,6 +105,69 @@
 
 #ifndef EXTFLOAT
 
+int
+__unordsf2(float a, float b)
+{
+  union float_long fl;
+
+  fl.f = a;
+  if (EXP(fl.l) == EXP(~0u) && (MANT(fl.l) & ~HIDDEN) != 0)
+    return 1;
+  fl.f = b;
+  if (EXP(fl.l) == EXP(~0u) && (MANT(fl.l) & ~HIDDEN) != 0)
+    return 1;
+  return 0;
+}
+
+int
+__unorddf2(double a, double b)
+{
+  union double_long dl;
+
+  dl.d = a;
+  if (EXPD(dl) == EXPDMASK
+      && ((dl.l.upper & MANTDMASK) != 0 || dl.l.lower != 0))
+    return 1;
+  dl.d = b;
+  if (EXPD(dl) == EXPDMASK
+      && ((dl.l.upper & MANTDMASK) != 0 || dl.l.lower != 0))
+    return 1;
+  return 0;
+}
+
+/* convert unsigned int to double */
+double
+__floatunsidf (unsigned long a1)
+{
+  long exp = 32 + EXCESSD;
+  union double_long dl;
+
+  if (!a1)
+    {
+      dl.l.upper = dl.l.lower = 0;
+      return dl.d;
+    }
+
+  while (a1 < 0x2000000L)
+    {
+      a1 <<= 4;
+      exp -= 4;
+    }
+
+  while (a1 < 0x80000000L)
+    {
+      a1 <<= 1;
+      exp--;
+    }
+
+  /* pack up and go home */
+  dl.l.upper = exp << 20L;
+  dl.l.upper |= (a1 >> 11L) & ~HIDDEND;
+  dl.l.lower = a1 << 21L;
+
+  return dl.d;
+}
+
 /* convert int to double */
 double
 __floatsidf (long a1)
@@ -151,6 +214,14 @@
   return dl.d;
 }
 
+/* convert unsigned int to float */
+float
+__floatunsisf (unsigned long l)
+{
+  double foo = __floatunsidf (l);
+  return foo;
+}
+
 /* convert int to float */
 float
 __floatsisf (long l)
@@ -292,6 +363,7 @@
    We assume all numbers are normalized, don't do any rounding, etc.  */
 
 /* Prototypes for the above in case we use them.  */
+double __floatunsidf (unsigned long);
 double __floatsidf (long);
 float __floatsisf (long);
 double __extendsfdf2 (float);
@@ -300,6 +372,22 @@
 long __fixsfsi (float);
 int __cmpdf2 (double, double);
 
+int
+__unordxf2(long double a, long double b)
+{
+  union long_double_long ldl;
+
+  ldl.ld = a;
+  if (EXPX(ldl) == EXPXMASK
+      && ((ldl.l.middle & MANTXMASK) != 0 || ldl.l.lower != 0))
+    return 1;
+  ldl.ld = b;
+  if (EXPX(ldl) == EXPXMASK
+      && ((ldl.l.middle & MANTXMASK) != 0 || ldl.l.lower != 0))
+    return 1;
+  return 0;
+}
+
 /* convert double to long double */
 long double
 __extenddfxf2 (double d)
@@ -382,6 +470,14 @@
   return foo;
 }
 
+/* convert an unsigned int to a long double */
+long double
+__floatunsixf (unsigned long l)
+{
+  double foo = __floatunsidf (l);
+  return foo;
+}
+
 /* convert a long double to an int */
 long
 __fixxfsi (long double ld)



Home | Main Index | Thread Index | Old Index