Commit 48568ec7 by Markus F.X.J. Oberhumer Committed by Bernardo Innocenti

re PR target/12148 (longstanding m68k libgcc.a bug when using ` -mshort')

	PR c/12148
	* config/m68k/fpgnulib.c: Fix `-mshort' bugs: Use `long' instead of
	`int' in a number of places to make sure we always have a SImode
	and not a HImode.  Add a 'L' suffix to a number of constants.

From-SVN: r75703
parent 124c9423
2004-01-12 Markus F.X.J. Oberhumer <markus@oberhumer.com>
PR c/12148
* config/m68k/fpgnulib.c: Fix `-mshort' bugs: Use `long' instead of
`int' in a number of places to make sure we always have a SImode
and not a HImode. Add a 'L' suffix to a number of constants.
2004-01-11 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> 2004-01-11 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* pa.c: Don't include obstack.h. * pa.c: Don't include obstack.h.
......
...@@ -59,24 +59,24 @@ ...@@ -59,24 +59,24 @@
#define PACK(s,e,m) ((s) | ((e) << 23L) | (m)) #define PACK(s,e,m) ((s) | ((e) << 23L) | (m))
/* the following deal with IEEE double-precision numbers */ /* the following deal with IEEE double-precision numbers */
#define EXCESSD 1022 #define EXCESSD 1022L
#define HIDDEND (1L << 20L) #define HIDDEND (1L << 20L)
#define EXPDBITS 11 #define EXPDBITS 11
#define EXPDMASK 0x7FF #define EXPDMASK 0x7FFL
#define EXPD(fp) (((fp.l.upper) >> 20L) & 0x7FFL) #define EXPD(fp) (((fp.l.upper) >> 20L) & 0x7FFL)
#define SIGND(fp) ((fp.l.upper) & SIGNBIT) #define SIGND(fp) ((fp.l.upper) & SIGNBIT)
#define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \ #define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \
(fp.l.lower >> 22)) (fp.l.lower >> 22))
#define MANTDMASK 0xFFFFF /* mask of upper part */ #define MANTDMASK 0xFFFFFL /* mask of upper part */
/* the following deal with IEEE extended-precision numbers */ /* the following deal with IEEE extended-precision numbers */
#define EXCESSX 16382 #define EXCESSX 16382L
#define HIDDENX (1L << 31L) #define HIDDENX (1L << 31L)
#define EXPXBITS 15 #define EXPXBITS 15
#define EXPXMASK 0x7FFF #define EXPXMASK 0x7FFF
#define EXPX(fp) (((fp.l.upper) >> 16) & EXPXMASK) #define EXPX(fp) (((fp.l.upper) >> 16) & EXPXMASK)
#define SIGNX(fp) ((fp.l.upper) & SIGNBIT) #define SIGNX(fp) ((fp.l.upper) & SIGNBIT)
#define MANTXMASK 0x7FFFFFFF /* mask of upper part */ #define MANTXMASK 0x7FFFFFFFL /* mask of upper part */
union double_long union double_long
{ {
...@@ -107,7 +107,7 @@ union long_double_long ...@@ -107,7 +107,7 @@ union long_double_long
/* convert int to double */ /* convert int to double */
double double
__floatsidf (int a1) __floatsidf (long a1)
{ {
long sign = 0, exp = 31 + EXCESSD; long sign = 0, exp = 31 + EXCESSD;
union double_long dl; union double_long dl;
...@@ -130,13 +130,13 @@ __floatsidf (int a1) ...@@ -130,13 +130,13 @@ __floatsidf (int a1)
} }
} }
while (a1 < 0x1000000) while (a1 < 0x1000000L)
{ {
a1 <<= 4; a1 <<= 4;
exp -= 4; exp -= 4;
} }
while (a1 < 0x40000000) while (a1 < 0x40000000L)
{ {
a1 <<= 1; a1 <<= 1;
exp--; exp--;
...@@ -153,7 +153,7 @@ __floatsidf (int a1) ...@@ -153,7 +153,7 @@ __floatsidf (int a1)
/* convert int to float */ /* convert int to float */
float float
__floatsisf (int l) __floatsisf (long l)
{ {
double foo = __floatsidf (l); double foo = __floatsidf (l);
return foo; return foo;
...@@ -208,7 +208,7 @@ __truncdfsf2 (double a1) ...@@ -208,7 +208,7 @@ __truncdfsf2 (double a1)
mant >>= 1; mant >>= 1;
/* did the round overflow? */ /* did the round overflow? */
if (mant & 0xFF000000) if (mant & 0xFF000000L)
{ {
mant >>= 1; mant >>= 1;
exp++; exp++;
...@@ -222,7 +222,7 @@ __truncdfsf2 (double a1) ...@@ -222,7 +222,7 @@ __truncdfsf2 (double a1)
} }
/* convert double to int */ /* convert double to int */
int long
__fixdfsi (double a1) __fixdfsi (double a1)
{ {
register union double_long dl1; register union double_long dl1;
...@@ -240,7 +240,7 @@ __fixdfsi (double a1) ...@@ -240,7 +240,7 @@ __fixdfsi (double a1)
if (exp > 0) if (exp > 0)
{ {
/* Return largest integer. */ /* Return largest integer. */
return SIGND (dl1) ? 0x80000000 : 0x7fffffff; return SIGND (dl1) ? 0x80000000L : 0x7fffffffL;
} }
if (exp <= -32) if (exp <= -32)
...@@ -254,7 +254,7 @@ __fixdfsi (double a1) ...@@ -254,7 +254,7 @@ __fixdfsi (double a1)
} }
/* convert float to int */ /* convert float to int */
int long
__fixsfsi (float a1) __fixsfsi (float a1)
{ {
double foo = a1; double foo = a1;
...@@ -268,12 +268,12 @@ __fixsfsi (float a1) ...@@ -268,12 +268,12 @@ __fixsfsi (float a1)
We assume all numbers are normalized, don't do any rounding, etc. */ We assume all numbers are normalized, don't do any rounding, etc. */
/* Prototypes for the above in case we use them. */ /* Prototypes for the above in case we use them. */
double __floatsidf (int); double __floatsidf (long);
float __floatsisf (int); float __floatsisf (long);
double __extendsfdf2 (float); double __extendsfdf2 (float);
float __truncdfsf2 (double); float __truncdfsf2 (double);
int __fixdfsi (double); long __fixdfsi (double);
int __fixsfsi (float); long __fixsfsi (float);
/* convert double to long double */ /* convert double to long double */
long double long double
...@@ -351,17 +351,17 @@ __truncxfsf2 (long double ld) ...@@ -351,17 +351,17 @@ __truncxfsf2 (long double ld)
/* convert an int to a long double */ /* convert an int to a long double */
long double long double
__floatsixf (int l) __floatsixf (long l)
{ {
double foo = __floatsidf (l); double foo = __floatsidf (l);
return foo; return foo;
} }
/* convert a long double to an int */ /* convert a long double to an int */
int long
__fixxfsi (long double ld) __fixxfsi (long double ld)
{ {
int foo = __fixdfsi ((double) ld); long foo = __fixdfsi ((double) ld);
return foo; return foo;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment