*** empty log message ***

From-SVN: r1503
This commit is contained in:
Richard Stallman 1992-07-07 19:46:10 +00:00
parent 1814cfd91d
commit ab49538861

View file

@ -38,35 +38,59 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#undef abort #undef abort
#endif #endif
/* Need to undef this because LONG_TYPE_SIZE may rely upon GCC's /* In the first part of this file, we are interfacing to calls generated
internal `target_flags' variable. */ by the compiler itself. These calls pass values into these routines
#undef LONG_TYPE_SIZE which have very specific modes (rather than very specific types), and
these compiler-generated calls also expect any return values to have
very specific modes (rather than very specific types). Thus, we need
to avoid using regular C language type names in this part of the file
because the sizes for those types can be configured to be anything.
Instead we use the following special type names. */
#define LONG_TYPE_SIZE (sizeof (long) * BITS_PER_UNIT) typedef unsigned int UQItype __attribute__ ((mode (QI)));
typedef int SItype __attribute__ ((mode (SI)));
typedef unsigned int USItype __attribute__ ((mode (SI)));
typedef int DItype __attribute__ ((mode (DI)));
typedef unsigned int UDItype __attribute__ ((mode (DI)));
typedef float SFtype __attribute__ ((mode (SF)));
typedef float DFtype __attribute__ ((mode (DF)));
typedef float XFtype __attribute__ ((mode (XF)));
typedef float TFtype __attribute__ ((mode (TF)));
#ifndef SItype /* Make sure that we don't accidentaly use any normal C language built-in
#define SItype long int type names in the first part of this file. Instead we want to use *only*
#endif the type names defined above. The following macro definitions insure
that if we *do* accidently use soem normal C language built-in type name,
we will get a syntax error. */
/* long long ints are pairs of long ints in the order determined by #define char bogus_type
#define short bogus_type
#define int bogus_type
#define long bogus_type
#define unsigned bogus_type
#define float bogus_type
#define double bogus_type
#define SI_TYPE_SIZE (sizeof (SItype) * BITS_PER_UNIT)
/* DIstructs are pairs of SItype values in the order determined by
WORDS_BIG_ENDIAN. */ WORDS_BIG_ENDIAN. */
#if WORDS_BIG_ENDIAN #if WORDS_BIG_ENDIAN
struct longlong {long high, low;}; struct DIstruct {SItype high, low;};
#else #else
struct longlong {long low, high;}; struct DIstruct {SItype low, high;};
#endif #endif
/* We need this union to unpack/pack longlongs, since we don't have /* We need this union to unpack/pack DImode values, since we don't have
any arithmetic yet. Incoming long long parameters are stored any arithmetic yet. Incoming DImode parameters are stored into the
into the `ll' field, and the unpacked result is read from the struct `ll' field, and the unpacked result is read from the struct `s'. */
longlong. */
typedef union typedef union
{ {
struct longlong s; struct DIstruct s;
long long ll; DItype ll;
} long_long; } DIunion;
#if defined (L_udivmoddi4) || defined (L_muldi3) #if defined (L_udivmoddi4) || defined (L_muldi3)
@ -74,55 +98,55 @@ typedef union
#endif /* udiv or mul */ #endif /* udiv or mul */
extern long long __fixunssfdi (float a); extern DItype __fixunssfdi (SFtype a);
extern long long __fixunsdfdi (double a); extern DItype __fixunsdfdi (DFtype a);
#if defined (L_negdi2) || defined (L_divdi3) || defined (L_moddi3) #if defined (L_negdi2) || defined (L_divdi3) || defined (L_moddi3)
#if defined (L_divdi3) || defined (L_moddi3) #if defined (L_divdi3) || defined (L_moddi3)
static inline static inline
#endif #endif
long long DItype
__negdi2 (u) __negdi2 (u)
long long u; DItype u;
{ {
long_long w; DIunion w;
long_long uu; DIunion uu;
uu.ll = u; uu.ll = u;
w.s.low = -uu.s.low; w.s.low = -uu.s.low;
w.s.high = -uu.s.high - ((unsigned long) w.s.low > 0); w.s.high = -uu.s.high - ((USItype) w.s.low > 0);
return w.ll; return w.ll;
} }
#endif #endif
#ifdef L_lshldi3 #ifdef L_lshldi3
long long DItype
__lshldi3 (u, b) __lshldi3 (u, b)
long long u; DItype u;
int b; SItype b;
{ {
long_long w; DIunion w;
long bm; SItype bm;
long_long uu; DIunion uu;
if (b == 0) if (b == 0)
return u; return u;
uu.ll = u; uu.ll = u;
bm = (sizeof (long) * BITS_PER_UNIT) - b; bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
if (bm <= 0) if (bm <= 0)
{ {
w.s.low = 0; w.s.low = 0;
w.s.high = (unsigned long)uu.s.low << -bm; w.s.high = (USItype)uu.s.low << -bm;
} }
else else
{ {
unsigned long carries = (unsigned long)uu.s.low >> bm; USItype carries = (USItype)uu.s.low >> bm;
w.s.low = (unsigned long)uu.s.low << b; w.s.low = (USItype)uu.s.low << b;
w.s.high = ((unsigned long)uu.s.high << b) | carries; w.s.high = ((USItype)uu.s.high << b) | carries;
} }
return w.ll; return w.ll;
@ -130,31 +154,31 @@ __lshldi3 (u, b)
#endif #endif
#ifdef L_lshrdi3 #ifdef L_lshrdi3
long long DItype
__lshrdi3 (u, b) __lshrdi3 (u, b)
long long u; DItype u;
int b; SItype b;
{ {
long_long w; DIunion w;
long bm; SItype bm;
long_long uu; DIunion uu;
if (b == 0) if (b == 0)
return u; return u;
uu.ll = u; uu.ll = u;
bm = (sizeof (long) * BITS_PER_UNIT) - b; bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
if (bm <= 0) if (bm <= 0)
{ {
w.s.high = 0; w.s.high = 0;
w.s.low = (unsigned long)uu.s.high >> -bm; w.s.low = (USItype)uu.s.high >> -bm;
} }
else else
{ {
unsigned long carries = (unsigned long)uu.s.high << bm; USItype carries = (USItype)uu.s.high << bm;
w.s.high = (unsigned long)uu.s.high >> b; w.s.high = (USItype)uu.s.high >> b;
w.s.low = ((unsigned long)uu.s.low >> b) | carries; w.s.low = ((USItype)uu.s.low >> b) | carries;
} }
return w.ll; return w.ll;
@ -162,31 +186,31 @@ __lshrdi3 (u, b)
#endif #endif
#ifdef L_ashldi3 #ifdef L_ashldi3
long long DItype
__ashldi3 (u, b) __ashldi3 (u, b)
long long u; DItype u;
int b; SItype b;
{ {
long_long w; DIunion w;
long bm; SItype bm;
long_long uu; DIunion uu;
if (b == 0) if (b == 0)
return u; return u;
uu.ll = u; uu.ll = u;
bm = (sizeof (long) * BITS_PER_UNIT) - b; bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
if (bm <= 0) if (bm <= 0)
{ {
w.s.low = 0; w.s.low = 0;
w.s.high = (unsigned long)uu.s.low << -bm; w.s.high = (USItype)uu.s.low << -bm;
} }
else else
{ {
unsigned long carries = (unsigned long)uu.s.low >> bm; USItype carries = (USItype)uu.s.low >> bm;
w.s.low = (unsigned long)uu.s.low << b; w.s.low = (USItype)uu.s.low << b;
w.s.high = ((unsigned long)uu.s.high << b) | carries; w.s.high = ((USItype)uu.s.high << b) | carries;
} }
return w.ll; return w.ll;
@ -194,32 +218,32 @@ __ashldi3 (u, b)
#endif #endif
#ifdef L_ashrdi3 #ifdef L_ashrdi3
long long DItype
__ashrdi3 (u, b) __ashrdi3 (u, b)
long long u; DItype u;
int b; SItype b;
{ {
long_long w; DIunion w;
long bm; SItype bm;
long_long uu; DIunion uu;
if (b == 0) if (b == 0)
return u; return u;
uu.ll = u; uu.ll = u;
bm = (sizeof (long) * BITS_PER_UNIT) - b; bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
if (bm <= 0) if (bm <= 0)
{ {
/* w.s.high = 1..1 or 0..0 */ /* w.s.high = 1..1 or 0..0 */
w.s.high = uu.s.high >> (sizeof (long) * BITS_PER_UNIT - 1); w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
w.s.low = uu.s.high >> -bm; w.s.low = uu.s.high >> -bm;
} }
else else
{ {
unsigned long carries = (unsigned long)uu.s.high << bm; USItype carries = (USItype)uu.s.high << bm;
w.s.high = uu.s.high >> b; w.s.high = uu.s.high >> b;
w.s.low = ((unsigned long)uu.s.low >> b) | carries; w.s.low = ((USItype)uu.s.low >> b) | carries;
} }
return w.ll; return w.ll;
@ -227,26 +251,26 @@ __ashrdi3 (u, b)
#endif #endif
#ifdef L_muldi3 #ifdef L_muldi3
long long DItype
__muldi3 (u, v) __muldi3 (u, v)
long long u, v; DItype u, v;
{ {
long_long w; DIunion w;
long_long uu, vv; DIunion uu, vv;
uu.ll = u, uu.ll = u,
vv.ll = v; vv.ll = v;
w.ll = __umulsidi3 (uu.s.low, vv.s.low); w.ll = __umulsidi3 (uu.s.low, vv.s.low);
w.s.high += ((unsigned long) uu.s.low * (unsigned long) vv.s.high w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
+ (unsigned long) uu.s.high * (unsigned long) vv.s.low); + (USItype) uu.s.high * (USItype) vv.s.low);
return w.ll; return w.ll;
} }
#endif #endif
#ifdef L_udivmoddi4 #ifdef L_udivmoddi4
static const unsigned char __clz_tab[] = static const UQItype __clz_tab[] =
{ {
0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
@ -258,17 +282,17 @@ static const unsigned char __clz_tab[] =
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
}; };
unsigned long long UDItype
__udivmoddi4 (n, d, rp) __udivmoddi4 (n, d, rp)
unsigned long long n, d; UDItype n, d;
unsigned long long int *rp; UDItype *rp;
{ {
long_long ww; DIunion ww;
long_long nn, dd; DIunion nn, dd;
long_long rr; DIunion rr;
unsigned long d0, d1, n0, n1, n2; USItype d0, d1, n0, n1, n2;
unsigned long q0, q1; USItype q0, q1;
unsigned b, bm; USItype b, bm;
nn.ll = n; nn.ll = n;
dd.ll = d; dd.ll = d;
@ -327,7 +351,7 @@ __udivmoddi4 (n, d, rp)
denominator set. */ denominator set. */
d0 = d0 << bm; d0 = d0 << bm;
n1 = (n1 << bm) | (n0 >> (LONG_TYPE_SIZE - bm)); n1 = (n1 << bm) | (n0 >> (SI_TYPE_SIZE - bm));
n0 = n0 << bm; n0 = n0 << bm;
} }
@ -352,7 +376,7 @@ __udivmoddi4 (n, d, rp)
leading quotient digit q1 = 1). leading quotient digit q1 = 1).
This special case is necessary, not an optimization. This special case is necessary, not an optimization.
(Shifts counts of LONG_TYPE_SIZE are undefined.) */ (Shifts counts of SI_TYPE_SIZE are undefined.) */
n1 -= d0; n1 -= d0;
q1 = 1; q1 = 1;
@ -361,7 +385,7 @@ __udivmoddi4 (n, d, rp)
{ {
/* Normalize. */ /* Normalize. */
b = LONG_TYPE_SIZE - bm; b = SI_TYPE_SIZE - bm;
d0 = d0 << bm; d0 = d0 << bm;
n2 = n1 >> b; n2 = n1 >> b;
@ -438,10 +462,10 @@ __udivmoddi4 (n, d, rp)
} }
else else
{ {
unsigned long m1, m0; USItype m1, m0;
/* Normalize. */ /* Normalize. */
b = LONG_TYPE_SIZE - bm; b = SI_TYPE_SIZE - bm;
d1 = (d1 << bm) | (d0 >> b); d1 = (d1 << bm) | (d0 >> b);
d0 = d0 << bm; d0 = d0 << bm;
@ -479,14 +503,14 @@ __udivmoddi4 (n, d, rp)
#endif #endif
#ifdef L_divdi3 #ifdef L_divdi3
unsigned long long __udivmoddi4 (); UDItype __udivmoddi4 ();
long long DItype
__divdi3 (u, v) __divdi3 (u, v)
long long u, v; DItype u, v;
{ {
int c = 0; SItype c = 0;
long_long uu, vv; DIunion uu, vv;
long long w; DItype w;
uu.ll = u; uu.ll = u;
vv.ll = v; vv.ll = v;
@ -498,7 +522,7 @@ __divdi3 (u, v)
c = ~c, c = ~c,
vv.ll = __negdi2 (vv.ll); vv.ll = __negdi2 (vv.ll);
w = __udivmoddi4 (uu.ll, vv.ll, (unsigned long long *) 0); w = __udivmoddi4 (uu.ll, vv.ll, (UDItype *) 0);
if (c) if (c)
w = __negdi2 (w); w = __negdi2 (w);
@ -507,14 +531,14 @@ __divdi3 (u, v)
#endif #endif
#ifdef L_moddi3 #ifdef L_moddi3
unsigned long long __udivmoddi4 (); UDItype __udivmoddi4 ();
long long DItype
__moddi3 (u, v) __moddi3 (u, v)
long long u, v; DItype u, v;
{ {
int c = 0; SItype c = 0;
long_long uu, vv; DIunion uu, vv;
long long w; DItype w;
uu.ll = u; uu.ll = u;
vv.ll = v; vv.ll = v;
@ -534,12 +558,12 @@ __moddi3 (u, v)
#endif #endif
#ifdef L_umoddi3 #ifdef L_umoddi3
unsigned long long __udivmoddi4 (); UDItype __udivmoddi4 ();
unsigned long long UDItype
__umoddi3 (u, v) __umoddi3 (u, v)
unsigned long long u, v; UDItype u, v;
{ {
long long w; DItype w;
(void) __udivmoddi4 (u, v, &w); (void) __udivmoddi4 (u, v, &w);
@ -548,21 +572,21 @@ __umoddi3 (u, v)
#endif #endif
#ifdef L_udivdi3 #ifdef L_udivdi3
unsigned long long __udivmoddi4 (); UDItype __udivmoddi4 ();
unsigned long long UDItype
__udivdi3 (n, d) __udivdi3 (n, d)
unsigned long long n, d; UDItype n, d;
{ {
return __udivmoddi4 (n, d, (unsigned long long *) 0); return __udivmoddi4 (n, d, (UDItype *) 0);
} }
#endif #endif
#ifdef L_cmpdi2 #ifdef L_cmpdi2
SItype SItype
__cmpdi2 (a, b) __cmpdi2 (a, b)
long long a, b; DItype a, b;
{ {
long_long au, bu; DIunion au, bu;
au.ll = a, bu.ll = b; au.ll = a, bu.ll = b;
@ -570,9 +594,9 @@ __cmpdi2 (a, b)
return 0; return 0;
else if (au.s.high > bu.s.high) else if (au.s.high > bu.s.high)
return 2; return 2;
if ((unsigned long) au.s.low < (unsigned long) bu.s.low) if ((USItype) au.s.low < (USItype) bu.s.low)
return 0; return 0;
else if ((unsigned long) au.s.low > (unsigned long) bu.s.low) else if ((USItype) au.s.low > (USItype) bu.s.low)
return 2; return 2;
return 1; return 1;
} }
@ -581,61 +605,105 @@ __cmpdi2 (a, b)
#ifdef L_ucmpdi2 #ifdef L_ucmpdi2
SItype SItype
__ucmpdi2 (a, b) __ucmpdi2 (a, b)
long long a, b; DItype a, b;
{ {
long_long au, bu; DIunion au, bu;
au.ll = a, bu.ll = b; au.ll = a, bu.ll = b;
if ((unsigned long) au.s.high < (unsigned long) bu.s.high) if ((USItype) au.s.high < (USItype) bu.s.high)
return 0; return 0;
else if ((unsigned long) au.s.high > (unsigned long) bu.s.high) else if ((USItype) au.s.high > (USItype) bu.s.high)
return 2; return 2;
if ((unsigned long) au.s.low < (unsigned long) bu.s.low) if ((USItype) au.s.low < (USItype) bu.s.low)
return 0; return 0;
else if ((unsigned long) au.s.low > (unsigned long) bu.s.low) else if ((USItype) au.s.low > (USItype) bu.s.low)
return 2; return 2;
return 1; return 1;
} }
#endif #endif
#ifdef L_fixunsdfdi #if defined(L_fixunstfdi) && (LONG_DOUBLE_TYPE_SIZE == 128)
#define WORD_SIZE (sizeof (long) * BITS_PER_UNIT) #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
#define HIGH_WORD_COEFF (((long long) 1) << WORD_SIZE) #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
long long DItype
__fixunsdfdi (a) __fixunstfdi (a)
double a; TFtype a;
{ {
double b; TFtype b;
unsigned long long v; UDItype v;
if (a < 0) if (a < 0)
return 0; return 0;
/* Compute high word of result, as a flonum. */ /* Compute high word of result, as a flonum. */
b = (a / HIGH_WORD_COEFF); b = (a / HIGH_WORD_COEFF);
/* Convert that to fixed (but not to long long!), /* Convert that to fixed (but not to DItype!),
and shift it into the high word. */ and shift it into the high word. */
v = (unsigned long int) b; v = (USItype) b;
v <<= WORD_SIZE; v <<= WORD_SIZE;
/* Remove high part from the double, leaving the low part as flonum. */ /* Remove high part from the TFtype, leaving the low part as flonum. */
a -= (double)v; a -= (TFtype)v;
/* Convert that to fixed (but not to long long!) and add it in. /* Convert that to fixed (but not to DItype!) and add it in.
Sometimes A comes out negative. This is significant, since Sometimes A comes out negative. This is significant, since
A has more bits than a long int does. */ A has more bits than a long int does. */
if (a < 0) if (a < 0)
v -= (unsigned long int) (- a); v -= (USItype) (- a);
else else
v += (unsigned long int) a; v += (USItype) a;
return v;
}
#endif
#if defined(L_fixtfdi) && (LONG_DOUBLE_TYPE_SIZE == 128)
DItype
__fixtfdi (a)
TFtype a;
{
if (a < 0)
return - __fixunstfdi (-a);
return __fixunstfdi (a);
}
#endif
#ifdef L_fixunsdfdi
#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
DItype
__fixunsdfdi (a)
DFtype a;
{
DFtype b;
UDItype v;
if (a < 0)
return 0;
/* Compute high word of result, as a flonum. */
b = (a / HIGH_WORD_COEFF);
/* Convert that to fixed (but not to DItype!),
and shift it into the high word. */
v = (USItype) b;
v <<= WORD_SIZE;
/* Remove high part from the DFtype, leaving the low part as flonum. */
a -= (DFtype)v;
/* Convert that to fixed (but not to DItype!) and add it in.
Sometimes A comes out negative. This is significant, since
A has more bits than a long int does. */
if (a < 0)
v -= (USItype) (- a);
else
v += (USItype) a;
return v; return v;
} }
#endif #endif
#ifdef L_fixdfdi #ifdef L_fixdfdi
long long DItype
__fixdfdi (a) __fixdfdi (a)
double a; DFtype a;
{ {
if (a < 0) if (a < 0)
return - __fixunsdfdi (-a); return - __fixunsdfdi (-a);
@ -644,44 +712,44 @@ __fixdfdi (a)
#endif #endif
#ifdef L_fixunssfdi #ifdef L_fixunssfdi
#define WORD_SIZE (sizeof (long) * BITS_PER_UNIT) #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
#define HIGH_WORD_COEFF (((long long) 1) << WORD_SIZE) #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
long long DItype
__fixunssfdi (float original_a) __fixunssfdi (SFtype original_a)
{ {
/* Convert the float to a double, because that is surely not going /* Convert the SFtype to a DFtype, because that is surely not going
to lose any bits. Some day someone else can write a faster version to lose any bits. Some day someone else can write a faster version
that avoids converting to double, and verify it really works right. */ that avoids converting to DFtype, and verify it really works right. */
double a = original_a; DFtype a = original_a;
double b; DFtype b;
unsigned long long v; UDItype v;
if (a < 0) if (a < 0)
return 0; return 0;
/* Compute high word of result, as a flonum. */ /* Compute high word of result, as a flonum. */
b = (a / HIGH_WORD_COEFF); b = (a / HIGH_WORD_COEFF);
/* Convert that to fixed (but not to long long!), /* Convert that to fixed (but not to DItype!),
and shift it into the high word. */ and shift it into the high word. */
v = (unsigned long int) b; v = (USItype) b;
v <<= WORD_SIZE; v <<= WORD_SIZE;
/* Remove high part from the double, leaving the low part as flonum. */ /* Remove high part from the DFtype, leaving the low part as flonum. */
a -= (double)v; a -= (DFtype)v;
/* Convert that to fixed (but not to long long!) and add it in. /* Convert that to fixed (but not to DItype!) and add it in.
Sometimes A comes out negative. This is significant, since Sometimes A comes out negative. This is significant, since
A has more bits than a long int does. */ A has more bits than a long int does. */
if (a < 0) if (a < 0)
v -= (unsigned long int) (- a); v -= (USItype) (- a);
else else
v += (unsigned long int) a; v += (USItype) a;
return v; return v;
} }
#endif #endif
#ifdef L_fixsfdi #ifdef L_fixsfdi
long long DItype
__fixsfdi (float a) __fixsfdi (SFtype a)
{ {
if (a < 0) if (a < 0)
return - __fixunssfdi (-a); return - __fixunssfdi (-a);
@ -689,49 +757,73 @@ __fixsfdi (float a)
} }
#endif #endif
#ifdef L_floatdidf #if defined(L_floatditf) && (LONG_DOUBLE_TYPE_SIZE == 128)
#define WORD_SIZE (sizeof (long) * BITS_PER_UNIT) #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
#define HIGH_HALFWORD_COEFF (((long long) 1) << (WORD_SIZE / 2)) #define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
#define HIGH_WORD_COEFF (((long long) 1) << WORD_SIZE) #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
double TFtype
__floatdidf (u) __floatditf (u)
long long u; DItype u;
{ {
double d; TFtype d;
int negate = 0; SItype negate = 0;
if (u < 0) if (u < 0)
u = -u, negate = 1; u = -u, negate = 1;
d = (unsigned int) (u >> WORD_SIZE); d = (USItype) (u >> WORD_SIZE);
d *= HIGH_HALFWORD_COEFF; d *= HIGH_HALFWORD_COEFF;
d *= HIGH_HALFWORD_COEFF; d *= HIGH_HALFWORD_COEFF;
d += (unsigned int) (u & (HIGH_WORD_COEFF - 1)); d += (USItype) (u & (HIGH_WORD_COEFF - 1));
return (negate ? -d : d);
}
#endif
#ifdef L_floatdidf
#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
#define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
#define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
DFtype
__floatdidf (u)
DItype u;
{
DFtype d;
SItype negate = 0;
if (u < 0)
u = -u, negate = 1;
d = (USItype) (u >> WORD_SIZE);
d *= HIGH_HALFWORD_COEFF;
d *= HIGH_HALFWORD_COEFF;
d += (USItype) (u & (HIGH_WORD_COEFF - 1));
return (negate ? -d : d); return (negate ? -d : d);
} }
#endif #endif
#ifdef L_floatdisf #ifdef L_floatdisf
#define WORD_SIZE (sizeof (long) * BITS_PER_UNIT) #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
#define HIGH_HALFWORD_COEFF (((long long) 1) << (WORD_SIZE / 2)) #define HIGH_HALFWORD_COEFF (((UDItype) 1) << (WORD_SIZE / 2))
#define HIGH_WORD_COEFF (((long long) 1) << WORD_SIZE) #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
float SFtype
__floatdisf (u) __floatdisf (u)
long long u; DItype u;
{ {
float f; SFtype f;
int negate = 0; SItype negate = 0;
if (u < 0) if (u < 0)
u = -u, negate = 1; u = -u, negate = 1;
f = (unsigned int) (u >> WORD_SIZE); f = (USItype) (u >> WORD_SIZE);
f *= HIGH_HALFWORD_COEFF; f *= HIGH_HALFWORD_COEFF;
f *= HIGH_HALFWORD_COEFF; f *= HIGH_HALFWORD_COEFF;
f += (unsigned int) (u & (HIGH_WORD_COEFF - 1)); f += (USItype) (u & (HIGH_WORD_COEFF - 1));
return (negate ? -f : f); return (negate ? -f : f);
} }
@ -740,11 +832,11 @@ __floatdisf (u)
#ifdef L_fixunsdfsi #ifdef L_fixunsdfsi
#include "limits.h" #include "limits.h"
unsigned SItype USItype
__fixunsdfsi (a) __fixunsdfsi (a)
double a; DFtype a;
{ {
if (a >= - (double) LONG_MIN) if (a >= - (DFtype) LONG_MIN)
return (SItype) (a + LONG_MIN) - LONG_MIN; return (SItype) (a + LONG_MIN) - LONG_MIN;
return (SItype) a; return (SItype) a;
} }
@ -753,15 +845,32 @@ __fixunsdfsi (a)
#ifdef L_fixunssfsi #ifdef L_fixunssfsi
#include "limits.h" #include "limits.h"
unsigned SItype USItype
__fixunssfsi (float a) __fixunssfsi (SFtype a)
{ {
if (a >= - (float) LONG_MIN) if (a >= - (SFtype) LONG_MIN)
return (SItype) (a + LONG_MIN) - LONG_MIN; return (SItype) (a + LONG_MIN) - LONG_MIN;
return (SItype) a; return (SItype) a;
} }
#endif #endif
/* From here on down, the routines use normal data types. */
#define SItype bogus_type
#define USItype bogus_type
#define DItype bogus_type
#define UDItype bogus_type
#define SFtype bogus_type
#define DFtype bogus_type
#undef char
#undef short
#undef int
#undef long
#undef unsigned
#undef float
#undef double
#ifdef L_varargs #ifdef L_varargs
#ifdef __i860__ #ifdef __i860__
#if defined(__svr4__) || defined(__alliant__) #if defined(__svr4__) || defined(__alliant__)