diff options
author | pbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-13 22:49:56 +0000 |
---|---|---|
committer | pbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-12-13 22:49:56 +0000 |
commit | cd7a21ef35109620b88f28f9f59882d5917b9563 (patch) | |
tree | 221a903a29cd125a6976d43749f9528bfe84ceab /gcc/config | |
parent | aa1d552e49994059978c0deac0353d7078edeb5a (diff) | |
download | gcc-cd7a21ef35109620b88f28f9f59882d5917b9563.tar.gz |
2005-12-13 Paul Brook <paul@codesourcery.com>
* config/m68k/fpgnulib.c (__unordsf2, __unorddf2, __unordxf2,
__floatunsidf, __floatunsisf, __floatunsixf): New functions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108487 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-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 2e8dd5d1430..a3ebc21608e 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) |