This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: libgcc2.c/longlong.h (2/2)
! v = (UWtype) b;
v <<= WORD_SIZE;
/* Remove high part from the TFtype, leaving the low part as flonum. */
a -= (TFtype)v;
! /* Convert that to fixed (but not to DWtype!) 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 -= (UWtype) (- a);
else
! v += (UWtype) a;
return v;
}
#endif
#if defined(L_fixtfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
! extern DWtype __fixunstfdi (TFtype a);
!
! DWtype
__fixtfdi (TFtype a)
{
if (a < 0)
*************** __fixtfdi (TFtype a)
*** 828,866 ****
#endif
#if defined(L_fixunsxfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96)
! #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
! #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
! DItype
__fixunsxfdi (XFtype a)
{
XFtype 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 XFtype, leaving the low part as flonum. */
a -= (XFtype)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;
}
#endif
#if defined(L_fixxfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96)
! DItype
__fixxfdi (XFtype a)
{
if (a < 0)
--- 906,946 ----
#endif
#if defined(L_fixunsxfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96)
! #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
! #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
! DWtype
__fixunsxfdi (XFtype a)
{
XFtype b;
! UDWtype 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 DWtype!),
and shift it into the high word. */
! v = (UWtype) b;
v <<= WORD_SIZE;
/* Remove high part from the XFtype, leaving the low part as flonum. */
a -= (XFtype)v;
! /* Convert that to fixed (but not to DWtype!) 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 -= (UWtype) (- a);
else
! v += (UWtype) a;
return v;
}
#endif
#if defined(L_fixxfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96)
! extern DWtype __fixunsxfdi (XFtype a);
!
! DWtype
__fixxfdi (XFtype a)
{
if (a < 0)
*************** __fixxfdi (XFtype a)
*** 870,908 ****
#endif
#ifdef L_fixunsdfdi
! #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
! #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
! DItype
__fixunsdfdi (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;
}
#endif
#ifdef L_fixdfdi
! DItype
__fixdfdi (DFtype a)
{
if (a < 0)
--- 950,990 ----
#endif
#ifdef L_fixunsdfdi
! #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
! #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
! DWtype
__fixunsdfdi (DFtype a)
{
DFtype b;
! UDWtype 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 DWtype!),
and shift it into the high word. */
! v = (UWtype) 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 DWtype!) 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 -= (UWtype) (- a);
else
! v += (UWtype) a;
return v;
}
#endif
#ifdef L_fixdfdi
! extern DWtype __fixunsdfdi (DFtype a);
!
! DWtype
__fixdfdi (DFtype a)
{
if (a < 0)
*************** __fixdfdi (DFtype a)
*** 912,921 ****
#endif
#ifdef L_fixunssfdi
! #define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
! #define HIGH_WORD_COEFF (((UDItype) 1) << WORD_SIZE)
! DItype
__fixunssfdi (SFtype original_a)
{
/* Convert the SFtype to a DFtype, because that is surely not going
--- 994,1003 ----
#endif
#ifdef L_fixunssfdi
! #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
! #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
! DWtype
__fixunssfdi (SFtype original_a)
{
/* Convert the SFtype to a DFtype, because that is surely not going
*************** __fixunssfdi (SFtype original_a)
*** 923,954 ****
that avoids converting to DFtype, and verify it really works right. */
DFtype a = original_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;
}
#endif
#ifdef L_fixsfdi
! DItype
__fixsfdi (SFtype a)
{
if (a < 0)
--- 1005,1038 ----
that avoids converting to DFtype, and verify it really works right. */
DFtype a = original_a;
DFtype b;
! UDWtype 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 DWtype!),
and shift it into the high word. */
! v = (UWtype) 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 DWtype!) 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 -= (UWtype) (- a);
else
! v += (UWtype) a;
return v;
}
#endif
#ifdef L_fixsfdi
! extern DWtype __fixunssfdi (SFtype a);
!
! DWtype
__fixsfdi (SFtype a)
{
if (a < 0)
*************** __fixsfdi (SFtype a)
*** 958,1024 ****
#endif
#if defined(L_floatdixf) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96)
! #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)
XFtype
! __floatdixf (DItype u)
{
XFtype d;
! d = (SItype) (u >> WORD_SIZE);
d *= HIGH_HALFWORD_COEFF;
d *= HIGH_HALFWORD_COEFF;
! d += (USItype) (u & (HIGH_WORD_COEFF - 1));
return d;
}
#endif
#if defined(L_floatditf) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
! #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)
TFtype
! __floatditf (DItype u)
{
TFtype d;
! d = (SItype) (u >> WORD_SIZE);
d *= HIGH_HALFWORD_COEFF;
d *= HIGH_HALFWORD_COEFF;
! d += (USItype) (u & (HIGH_WORD_COEFF - 1));
return 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 (DItype u)
{
DFtype d;
! d = (SItype) (u >> WORD_SIZE);
d *= HIGH_HALFWORD_COEFF;
d *= HIGH_HALFWORD_COEFF;
! d += (USItype) (u & (HIGH_WORD_COEFF - 1));
return d;
}
#endif
#ifdef L_floatdisf
! #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)
! #define DI_SIZE (sizeof (DItype) * BITS_PER_UNIT)
/* Define codes for all the float formats that we know of. Note
that this is copied from real.h. */
--- 1042,1108 ----
#endif
#if defined(L_floatdixf) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96)
! #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
! #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2))
! #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
XFtype
! __floatdixf (DWtype u)
{
XFtype d;
! d = (Wtype) (u >> WORD_SIZE);
d *= HIGH_HALFWORD_COEFF;
d *= HIGH_HALFWORD_COEFF;
! d += (UWtype) (u & (HIGH_WORD_COEFF - 1));
return d;
}
#endif
#if defined(L_floatditf) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
! #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
! #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2))
! #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
TFtype
! __floatditf (DWtype u)
{
TFtype d;
! d = (Wtype) (u >> WORD_SIZE);
d *= HIGH_HALFWORD_COEFF;
d *= HIGH_HALFWORD_COEFF;
! d += (UWtype) (u & (HIGH_WORD_COEFF - 1));
return d;
}
#endif
#ifdef L_floatdidf
! #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
! #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2))
! #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
DFtype
! __floatdidf (DWtype u)
{
DFtype d;
! d = (Wtype) (u >> WORD_SIZE);
d *= HIGH_HALFWORD_COEFF;
d *= HIGH_HALFWORD_COEFF;
! d += (UWtype) (u & (HIGH_WORD_COEFF - 1));
return d;
}
#endif
#ifdef L_floatdisf
! #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
! #define HIGH_HALFWORD_COEFF (((UDWtype) 1) << (WORD_SIZE / 2))
! #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
! #define DI_SIZE (sizeof (DWtype) * BITS_PER_UNIT)
/* Define codes for all the float formats that we know of. Note
that this is copied from real.h. */
*************** __floatdidf (DItype u)
*** 1049,1055 ****
#endif
SFtype
! __floatdisf (DItype u)
{
/* Do the calculation in DFmode
so that we don't lose any of the precision of the high word
--- 1133,1139 ----
#endif
SFtype
! __floatdisf (DWtype u)
{
/* Do the calculation in DFmode
so that we don't lose any of the precision of the high word
*************** __floatdisf (DItype u)
*** 1065,1082 ****
if (DF_SIZE < DI_SIZE
&& DF_SIZE > (DI_SIZE - DF_SIZE + SF_SIZE))
{
! #define REP_BIT ((USItype) 1 << (DI_SIZE - DF_SIZE))
! if (! (- ((DItype) 1 << DF_SIZE) < u
! && u < ((DItype) 1 << DF_SIZE)))
{
! if ((USItype) u & (REP_BIT - 1))
u |= REP_BIT;
}
}
! f = (SItype) (u >> WORD_SIZE);
f *= HIGH_HALFWORD_COEFF;
f *= HIGH_HALFWORD_COEFF;
! f += (USItype) (u & (HIGH_WORD_COEFF - 1));
return (SFtype) f;
}
--- 1149,1166 ----
if (DF_SIZE < DI_SIZE
&& DF_SIZE > (DI_SIZE - DF_SIZE + SF_SIZE))
{
! #define REP_BIT ((UWtype) 1 << (DI_SIZE - DF_SIZE))
! if (! (- ((DWtype) 1 << DF_SIZE) < u
! && u < ((DWtype) 1 << DF_SIZE)))
{
! if ((UWtype) u & (REP_BIT - 1))
u |= REP_BIT;
}
}
! f = (Wtype) (u >> WORD_SIZE);
f *= HIGH_HALFWORD_COEFF;
f *= HIGH_HALFWORD_COEFF;
! f += (UWtype) (u & (HIGH_WORD_COEFF - 1));
return (SFtype) f;
}
*************** __floatdisf (DItype u)
*** 1095,1106 ****
#undef MAX
#include <limits.h>
! USItype
__fixunsxfsi (XFtype a)
{
if (a >= - (DFtype) LONG_MIN)
! return (SItype) (a + LONG_MIN) - LONG_MIN;
! return (SItype) a;
}
#endif
--- 1179,1190 ----
#undef MAX
#include <limits.h>
! UWtype
__fixunsxfsi (XFtype a)
{
if (a >= - (DFtype) LONG_MIN)
! return (Wtype) (a + LONG_MIN) - LONG_MIN;
! return (Wtype) a;
}
#endif
*************** __fixunsxfsi (XFtype a)
*** 1117,1128 ****
#undef MAX
#include <limits.h>
! USItype
__fixunsdfsi (DFtype a)
{
if (a >= - (DFtype) LONG_MIN)
! return (SItype) (a + LONG_MIN) - LONG_MIN;
! return (SItype) a;
}
#endif
--- 1201,1212 ----
#undef MAX
#include <limits.h>
! UWtype
__fixunsdfsi (DFtype a)
{
if (a >= - (DFtype) LONG_MIN)
! return (Wtype) (a + LONG_MIN) - LONG_MIN;
! return (Wtype) a;
}
#endif
*************** __fixunsdfsi (DFtype a)
*** 1139,1150 ****
#undef MAX
#include <limits.h>
! USItype
__fixunssfsi (SFtype a)
{
if (a >= - (SFtype) LONG_MIN)
! return (SItype) (a + LONG_MIN) - LONG_MIN;
! return (SItype) a;
}
#endif
--- 1223,1234 ----
#undef MAX
#include <limits.h>
! UWtype
__fixunssfsi (SFtype a)
{
if (a >= - (SFtype) LONG_MIN)
! return (Wtype) (a + LONG_MIN) - LONG_MIN;
! return (Wtype) a;
}
#endif
*************** __fixunssfsi (SFtype a)
*** 1156,1161 ****
--- 1240,1251 ----
#define UDItype bogus_type
#define SFtype bogus_type
#define DFtype bogus_type
+ #undef Wtype
+ #undef UWtype
+ #undef HWtype
+ #undef UHWtype
+ #undef DWtype
+ #undef UDWtype
#undef char
#undef short
Index: longlong.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/longlong.h,v
retrieving revision 1.12
diff -c -3 -p -r1.12 longlong.h
*** longlong.h 1999/12/14 12:53:39 1.12
--- longlong.h 1999/12/16 23:12:42
*************** extern UDItype __udiv_qrnnd __P ((UDItyp
*** 195,201 ****
/* Call libgcc1 routine. */
#define umul_ppmm(w1, w0, u, v) \
do { \
! DIunion __w; \
__w.ll = __umulsidi3 (u, v); \
w1 = __w.s.high; \
w0 = __w.s.low; \
--- 195,201 ----
/* Call libgcc1 routine. */
#define umul_ppmm(w1, w0, u, v) \
do { \
! DWunion __w; \
__w.ll = __umulsidi3 (u, v); \
w1 = __w.s.high; \
w0 = __w.s.low; \
*************** UDItype __umulsidi3 (USItype, USItype);
*** 1381,1387 ****
#if !defined (__umulsidi3)
#define __umulsidi3(u, v) \
! ({DIunion __w; \
umul_ppmm (__w.s.high, __w.s.low, u, v); \
__w.ll; })
#endif
--- 1381,1387 ----
#if !defined (__umulsidi3)
#define __umulsidi3(u, v) \
! ({DWunion __w; \
umul_ppmm (__w.s.high, __w.s.low, u, v); \
__w.ll; })
#endif