diff options
author | Paul Brook <paul@codesourcery.com> | 2005-12-13 22:49:56 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2005-12-13 22:49:56 +0000 |
commit | 383eca9ccea8275baab7d6bdf5f464e113482dec (patch) | |
tree | 221a903a29cd125a6976d43749f9528bfe84ceab /gcc/config/m68k/fpgnulib.c | |
parent | c3d7c86daf797aa476dfa38efe11075ae01a2ae9 (diff) | |
download | gcc-383eca9ccea8275baab7d6bdf5f464e113482dec.zip gcc-383eca9ccea8275baab7d6bdf5f464e113482dec.tar.gz gcc-383eca9ccea8275baab7d6bdf5f464e113482dec.tar.bz2 |
fpgnulib.c (__unordsf2, [...]): New functions.
2005-12-13 Paul Brook <paul@codesourcery.com>
* config/m68k/fpgnulib.c (__unordsf2, __unorddf2, __unordxf2,
__floatunsidf, __floatunsisf, __floatunsixf): New functions.
From-SVN: r108487
Diffstat (limited to 'gcc/config/m68k/fpgnulib.c')
-rw-r--r-- | gcc/config/m68k/fpgnulib.c | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/gcc/config/m68k/fpgnulib.c b/gcc/config/m68k/fpgnulib.c index 2e8dd5d..a3ebc21 100644 --- a/gcc/config/m68k/fpgnulib.c +++ b/gcc/config/m68k/fpgnulib.c @@ -105,6 +105,69 @@ union long_double_long #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 @@ __floatsidf (long a1) 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 @@ __fixsfsi (float a1) 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); @@ -299,6 +371,22 @@ float __truncdfsf2 (double); long __fixdfsi (double); long __fixsfsi (float); +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) @@ -381,6 +469,14 @@ __floatsixf (long l) 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) |