Deleted Added
full compact
4c4
< 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
---
> 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
29,30c29,30
< Software Foundation, 59 Temple Place - Suite 330, Boston, MA
< 02111-1307, USA. */
---
> Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
> 02110-1301, USA. */
32,39d31
<
< /* We include auto-host.h here to get HAVE_GAS_HIDDEN. This is
< supposedly valid even though this is a "target" file. */
< #include "auto-host.h"
<
< /* It is incorrect to include config.h here, because this file is being
< compiled for the target, and hence definitions concerning only the host
< do not apply. */
45,49d36
< /* Don't use `fancy_abort' here even if config.h says to use it. */
< #ifdef abort
< #undef abort
< #endif
<
55a43,64
> #ifndef MIN_UNITS_PER_WORD
> #define MIN_UNITS_PER_WORD UNITS_PER_WORD
> #endif
>
> /* Work out the largest "word" size that we can deal with on this target. */
> #if MIN_UNITS_PER_WORD > 4
> # define LIBGCC2_MAX_UNITS_PER_WORD 8
> #elif (MIN_UNITS_PER_WORD > 2 \
> || (MIN_UNITS_PER_WORD > 1 && LONG_LONG_TYPE_SIZE > 32))
> # define LIBGCC2_MAX_UNITS_PER_WORD 4
> #else
> # define LIBGCC2_MAX_UNITS_PER_WORD MIN_UNITS_PER_WORD
> #endif
>
> /* Work out what word size we are using for this compilation.
> The value can be set on the command line. */
> #ifndef LIBGCC2_UNITS_PER_WORD
> #define LIBGCC2_UNITS_PER_WORD LIBGCC2_MAX_UNITS_PER_WORD
> #endif
>
> #if LIBGCC2_UNITS_PER_WORD <= LIBGCC2_MAX_UNITS_PER_WORD
>
151d159
< #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
157c165
< if ((Wtype) (w >> WORD_SIZE) != (Wtype) w >> (WORD_SIZE - 1))
---
> if ((Wtype) (w >> W_TYPE_SIZE) != (Wtype) w >> (W_TYPE_SIZE - 1))
276d283
< #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
285c292
< if (__builtin_expect (uu.s.high == uu.s.low >> (WORD_SIZE - 1), 1))
---
> if (__builtin_expect (uu.s.high == uu.s.low >> (W_TYPE_SIZE - 1), 1))
288c295
< if (__builtin_expect (vv.s.high == vv.s.low >> (WORD_SIZE - 1), 1))
---
> if (__builtin_expect (vv.s.high == vv.s.low >> (W_TYPE_SIZE - 1), 1))
307c314
< if (__builtin_expect (w1.s.high == w1.s.low >> (WORD_SIZE - 1), 1))
---
> if (__builtin_expect (w1.s.high == w1.s.low >> (W_TYPE_SIZE - 1), 1))
316c323
< if (__builtin_expect (vv.s.high == vv.s.low >> (WORD_SIZE - 1), 1))
---
> if (__builtin_expect (vv.s.high == vv.s.low >> (W_TYPE_SIZE - 1), 1))
330c337
< if (__builtin_expect (w1.s.high == w1.s.low >> (WORD_SIZE - 1), 1))
---
> if (__builtin_expect (w1.s.high == w1.s.low >> (W_TYPE_SIZE - 1), 1))
490d496
< extern int __ffsSI2 (UWtype u);
506d511
< extern int __ffsDI2 (DWtype u);
563c568
< /* dividend, divisor, and quotient are nonnegative */
---
> /* Dividend, divisor, and quotient are nonnegative. */
568c573
< /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */
---
> /* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d. */
570c575
< /* Divide (c1*2^32 + c0) by d */
---
> /* Divide (c1*2^32 + c0) by d. */
572c577
< /* Add 2^31 to quotient */
---
> /* Add 2^31 to quotient. */
668c673
< const UQItype __clz_tab[] =
---
> const UQItype __clz_tab[256] =
677c682
< 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
683d687
< extern int __clzSI2 (UWtype x);
697d700
< extern int __clzDI2 (UDWtype x);
717d719
< extern int __ctzSI2 (UWtype x);
731d732
< extern int __ctzDI2 (UDWtype x);
749,753d749
< #if (defined (L_popcountsi2) || defined (L_popcountdi2) \
< || defined (L_popcount_tab))
< extern const UQItype __popcount_tab[] ATTRIBUTE_HIDDEN;
< #endif
<
755c751
< const UQItype __popcount_tab[] =
---
> const UQItype __popcount_tab[256] =
764c760
< 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8,
---
> 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8
770d765
< extern int __popcountSI2 (UWtype x);
774c769
< UWtype i, ret = 0;
---
> int i, ret = 0;
785d779
< extern int __popcountDI2 (UDWtype x);
789c783
< UWtype i, ret = 0;
---
> int i, ret = 0;
800d793
< extern int __paritySI2 (UWtype x);
822d814
< extern int __parityDI2 (UDWtype x);
1104c1096
< (void) __udivmoddi4 (uu.ll, vv.ll, &w);
---
> (void) __udivmoddi4 (uu.ll, vv.ll, (UDWtype*)&w);
1170,1173c1162
< #if defined(L_fixunstfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
< #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
< #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
<
---
> #if defined(L_fixunstfdi) && LIBGCC2_HAS_TF_MODE
1181c1170
< const TFtype b = (a / HIGH_WORD_COEFF);
---
> const TFtype b = (a / Wtype_MAXp1_F);
1185c1174
< v <<= WORD_SIZE;
---
> v <<= W_TYPE_SIZE;
1199c1188
< #if defined(L_fixtfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
---
> #if defined(L_fixtfdi) && LIBGCC2_HAS_TF_MODE
1209,1212c1198
< #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)
<
---
> #if defined(L_fixunsxfdi) && LIBGCC2_HAS_XF_MODE
1220c1206
< const XFtype b = (a / HIGH_WORD_COEFF);
---
> const XFtype b = (a / Wtype_MAXp1_F);
1224c1210
< v <<= WORD_SIZE;
---
> v <<= W_TYPE_SIZE;
1238c1224
< #if defined(L_fixxfdi) && (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96)
---
> #if defined(L_fixxfdi) && LIBGCC2_HAS_XF_MODE
1248,1251c1234
< #ifdef L_fixunsdfdi
< #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
< #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
<
---
> #if defined(L_fixunsdfdi) && LIBGCC2_HAS_DF_MODE
1258c1241
< const UWtype hi = a / HIGH_WORD_COEFF;
---
> const UWtype hi = a / Wtype_MAXp1_F;
1263c1246
< const UWtype lo = (a - ((DFtype) hi) * HIGH_WORD_COEFF);
---
> const UWtype lo = a - (DFtype) hi * Wtype_MAXp1_F;
1266c1249
< return ((UDWtype) hi << WORD_SIZE) | lo;
---
> return ((UDWtype) hi << W_TYPE_SIZE) | lo;
1270c1253
< #ifdef L_fixdfdi
---
> #if defined(L_fixdfdi) && LIBGCC2_HAS_DF_MODE
1280,1283c1263
< #ifdef L_fixunssfdi
< #define WORD_SIZE (sizeof (Wtype) * BITS_PER_UNIT)
< #define HIGH_WORD_COEFF (((UDWtype) 1) << WORD_SIZE)
<
---
> #if defined(L_fixunssfdi) && LIBGCC2_HAS_SF_MODE
1285c1265
< __fixunssfDI (SFtype original_a)
---
> __fixunssfDI (SFtype a)
1286a1267
> #if LIBGCC2_HAS_DF_MODE
1290c1271
< const DFtype a = original_a;
---
> const DFtype dfa = a;
1295c1276
< const UWtype hi = a / HIGH_WORD_COEFF;
---
> const UWtype hi = dfa / Wtype_MAXp1_F;
1300c1281
< const UWtype lo = (a - ((DFtype) hi) * HIGH_WORD_COEFF);
---
> const UWtype lo = dfa - (DFtype) hi * Wtype_MAXp1_F;
1303c1284,1323
< return ((UDWtype) hi << WORD_SIZE) | lo;
---
> return ((UDWtype) hi << W_TYPE_SIZE) | lo;
> #elif FLT_MANT_DIG < W_TYPE_SIZE
> if (a < 1)
> return 0;
> if (a < Wtype_MAXp1_F)
> return (UWtype)a;
> if (a < Wtype_MAXp1_F * Wtype_MAXp1_F)
> {
> /* Since we know that there are fewer significant bits in the SFmode
> quantity than in a word, we know that we can convert out all the
> significant bits in one step, and thus avoid losing bits. */
>
> /* ??? This following loop essentially performs frexpf. If we could
> use the real libm function, or poke at the actual bits of the fp
> format, it would be significantly faster. */
>
> UWtype shift = 0, counter;
> SFtype msb;
>
> a /= Wtype_MAXp1_F;
> for (counter = W_TYPE_SIZE / 2; counter != 0; counter >>= 1)
> {
> SFtype counterf = (UWtype)1 << counter;
> if (a >= counterf)
> {
> shift |= counter;
> a /= counterf;
> }
> }
>
> /* Rescale into the range of one word, extract the bits of that
> one word, and shift the result into position. */
> a *= Wtype_MAXp1_F;
> counter = a;
> return (DWtype)counter << shift;
> }
> return -1;
> #else
> # error
> #endif
1307c1327
< #ifdef L_fixsfdi
---
> #if defined(L_fixsfdi) && LIBGCC2_HAS_SF_MODE
1317,1321c1337
< #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)
<
---
> #if defined(L_floatdixf) && LIBGCC2_HAS_XF_MODE
1325,1328c1341,1349
< XFtype d = (Wtype) (u >> WORD_SIZE);
< d *= HIGH_HALFWORD_COEFF;
< d *= HIGH_HALFWORD_COEFF;
< d += (UWtype) (u & (HIGH_WORD_COEFF - 1));
---
> #if W_TYPE_SIZE > XF_SIZE
> # error
> #endif
> XFtype d = (Wtype) (u >> W_TYPE_SIZE);
> d *= Wtype_MAXp1_F;
> d += (UWtype)u;
> return d;
> }
> #endif
1329a1351,1360
> #if defined(L_floatundixf) && LIBGCC2_HAS_XF_MODE
> XFtype
> __floatundixf (UDWtype u)
> {
> #if W_TYPE_SIZE > XF_SIZE
> # error
> #endif
> XFtype d = (UWtype) (u >> W_TYPE_SIZE);
> d *= Wtype_MAXp1_F;
> d += (UWtype)u;
1334,1338c1365
< #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)
<
---
> #if defined(L_floatditf) && LIBGCC2_HAS_TF_MODE
1342,1345c1369,1377
< TFtype d = (Wtype) (u >> WORD_SIZE);
< d *= HIGH_HALFWORD_COEFF;
< d *= HIGH_HALFWORD_COEFF;
< d += (UWtype) (u & (HIGH_WORD_COEFF - 1));
---
> #if W_TYPE_SIZE > TF_SIZE
> # error
> #endif
> TFtype d = (Wtype) (u >> W_TYPE_SIZE);
> d *= Wtype_MAXp1_F;
> d += (UWtype)u;
> return d;
> }
> #endif
1346a1379,1388
> #if defined(L_floatunditf) && LIBGCC2_HAS_TF_MODE
> TFtype
> __floatunditf (UDWtype u)
> {
> #if W_TYPE_SIZE > TF_SIZE
> # error
> #endif
> TFtype d = (UWtype) (u >> W_TYPE_SIZE);
> d *= Wtype_MAXp1_F;
> d += (UWtype)u;
1351,1354c1393,1412
< #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)
---
> #if (defined(L_floatdisf) && LIBGCC2_HAS_SF_MODE) \
> || (defined(L_floatdidf) && LIBGCC2_HAS_DF_MODE)
> #define DI_SIZE (W_TYPE_SIZE * 2)
> #define F_MODE_OK(SIZE) \
> (SIZE < DI_SIZE \
> && SIZE > (DI_SIZE - SIZE + FSSIZE) \
> /* Don't use IBM Extended Double TFmode for TI->SF calculations. \
> The conversion from long double to float suffers from double \
> rounding, because we convert via double. In any case, the \
> fallback code is faster. */ \
> && !IS_IBM_EXTENDED (SIZE))
> #if defined(L_floatdisf)
> #define FUNC __floatdisf
> #define FSTYPE SFtype
> #define FSSIZE SF_SIZE
> #else
> #define FUNC __floatdidf
> #define FSTYPE DFtype
> #define FSSIZE DF_SIZE
> #endif
1356,1357c1414,1415
< DFtype
< __floatdidf (DWtype u)
---
> FSTYPE
> FUNC (DWtype u)
1359,1362c1417,1425
< DFtype d = (Wtype) (u >> WORD_SIZE);
< d *= HIGH_HALFWORD_COEFF;
< d *= HIGH_HALFWORD_COEFF;
< d += (UWtype) (u & (HIGH_WORD_COEFF - 1));
---
> #if FSSIZE >= W_TYPE_SIZE
> /* When the word size is small, we never get any rounding error. */
> FSTYPE f = (Wtype) (u >> W_TYPE_SIZE);
> f *= Wtype_MAXp1_F;
> f += (UWtype)u;
> return f;
> #elif (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE)) \
> || (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE)) \
> || (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
1364,1365c1427,1437
< return d;
< }
---
> #if (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE))
> # define FSIZE DF_SIZE
> # define FTYPE DFtype
> #elif (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE))
> # define FSIZE XF_SIZE
> # define FTYPE XFtype
> #elif (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
> # define FSIZE TF_SIZE
> # define FTYPE TFtype
> #else
> # error
1368,1371c1440
< #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 REP_BIT ((UDWtype) 1 << (DI_SIZE - FSIZE))
1373,1375c1442,1455
< #define DI_SIZE (sizeof (DWtype) * BITS_PER_UNIT)
< #define DF_SIZE DBL_MANT_DIG
< #define SF_SIZE FLT_MANT_DIG
---
> /* Protect against double-rounding error.
> Represent any low-order bits, that might be truncated by a bit that
> won't be lost. The bit can go in anywhere below the rounding position
> of the FSTYPE. A fixed mask and bit position handles all usual
> configurations. */
> if (! (- ((DWtype) 1 << FSIZE) < u
> && u < ((DWtype) 1 << FSIZE)))
> {
> if ((UDWtype) u & (REP_BIT - 1))
> {
> u &= ~ (REP_BIT - 1);
> u |= REP_BIT;
> }
> }
1377,1378c1457,1527
< SFtype
< __floatdisf (DWtype u)
---
> /* Do the calculation in a wider type so that we don't lose any of
> the precision of the high word while multiplying it. */
> FTYPE f = (Wtype) (u >> W_TYPE_SIZE);
> f *= Wtype_MAXp1_F;
> f += (UWtype)u;
> return (FSTYPE) f;
> #else
> #if FSSIZE >= W_TYPE_SIZE - 2
> # error
> #endif
> /* Finally, the word size is larger than the number of bits in the
> required FSTYPE, and we've got no suitable wider type. The only
> way to avoid double rounding is to special case the
> extraction. */
>
> /* If there are no high bits set, fall back to one conversion. */
> if ((Wtype)u == u)
> return (FSTYPE)(Wtype)u;
>
> /* Otherwise, find the power of two. */
> Wtype hi = u >> W_TYPE_SIZE;
> if (hi < 0)
> hi = -hi;
>
> UWtype count, shift;
> count_leading_zeros (count, hi);
>
> /* No leading bits means u == minimum. */
> if (count == 0)
> return -(Wtype_MAXp1_F * (Wtype_MAXp1_F / 2));
>
> shift = 1 + W_TYPE_SIZE - count;
>
> /* Shift down the most significant bits. */
> hi = u >> shift;
>
> /* If we lost any nonzero bits, set the lsb to ensure correct rounding. */
> if (u & (((DWtype)1 << shift) - 1))
> hi |= 1;
>
> /* Convert the one word of data, and rescale. */
> FSTYPE f = hi;
> f *= (UDWtype)1 << shift;
> return f;
> #endif
> }
> #endif
>
> #if (defined(L_floatundisf) && LIBGCC2_HAS_SF_MODE) \
> || (defined(L_floatundidf) && LIBGCC2_HAS_DF_MODE)
> #define DI_SIZE (W_TYPE_SIZE * 2)
> #define F_MODE_OK(SIZE) \
> (SIZE < DI_SIZE \
> && SIZE > (DI_SIZE - SIZE + FSSIZE) \
> /* Don't use IBM Extended Double TFmode for TI->SF calculations. \
> The conversion from long double to float suffers from double \
> rounding, because we convert via double. In any case, the \
> fallback code is faster. */ \
> && !IS_IBM_EXTENDED (SIZE))
> #if defined(L_floatundisf)
> #define FUNC __floatundisf
> #define FSTYPE SFtype
> #define FSSIZE SF_SIZE
> #else
> #define FUNC __floatundidf
> #define FSTYPE DFtype
> #define FSSIZE DF_SIZE
> #endif
>
> FSTYPE
> FUNC (UDWtype u)
1379a1529,1553
> #if FSSIZE >= W_TYPE_SIZE
> /* When the word size is small, we never get any rounding error. */
> FSTYPE f = (UWtype) (u >> W_TYPE_SIZE);
> f *= Wtype_MAXp1_F;
> f += (UWtype)u;
> return f;
> #elif (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE)) \
> || (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE)) \
> || (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
>
> #if (LIBGCC2_HAS_DF_MODE && F_MODE_OK (DF_SIZE))
> # define FSIZE DF_SIZE
> # define FTYPE DFtype
> #elif (LIBGCC2_HAS_XF_MODE && F_MODE_OK (XF_SIZE))
> # define FSIZE XF_SIZE
> # define FTYPE XFtype
> #elif (LIBGCC2_HAS_TF_MODE && F_MODE_OK (TF_SIZE))
> # define FSIZE TF_SIZE
> # define FTYPE TFtype
> #else
> # error
> #endif
>
> #define REP_BIT ((UDWtype) 1 << (DI_SIZE - FSIZE))
>
1381,1387c1555,1559
< Represent any low-order bits, that might be truncated in DFmode,
< by a bit that won't be lost. The bit can go in anywhere below the
< rounding position of the SFmode. A fixed mask and bit position
< handles all usual configurations. It doesn't handle the case
< of 128-bit DImode, however. */
< if (DF_SIZE < DI_SIZE
< && DF_SIZE > (DI_SIZE - DF_SIZE + SF_SIZE))
---
> Represent any low-order bits, that might be truncated by a bit that
> won't be lost. The bit can go in anywhere below the rounding position
> of the FSTYPE. A fixed mask and bit position handles all usual
> configurations. */
> if (u >= ((UDWtype) 1 << FSIZE))
1389,1391c1561
< #define REP_BIT ((UDWtype) 1 << (DI_SIZE - DF_SIZE))
< if (! (- ((DWtype) 1 << DF_SIZE) < u
< && u < ((DWtype) 1 << DF_SIZE)))
---
> if ((UDWtype) u & (REP_BIT - 1))
1393,1397c1563,1564
< if ((UDWtype) u & (REP_BIT - 1))
< {
< u &= ~ (REP_BIT - 1);
< u |= REP_BIT;
< }
---
> u &= ~ (REP_BIT - 1);
> u |= REP_BIT;
1400,1406d1566
< /* Do the calculation in DFmode
< so that we don't lose any of the precision of the high word
< while multiplying it. */
< DFtype f = (Wtype) (u >> WORD_SIZE);
< f *= HIGH_HALFWORD_COEFF;
< f *= HIGH_HALFWORD_COEFF;
< f += (UWtype) (u & (HIGH_WORD_COEFF - 1));
1408c1568,1606
< return (SFtype) f;
---
> /* Do the calculation in a wider type so that we don't lose any of
> the precision of the high word while multiplying it. */
> FTYPE f = (UWtype) (u >> W_TYPE_SIZE);
> f *= Wtype_MAXp1_F;
> f += (UWtype)u;
> return (FSTYPE) f;
> #else
> #if FSSIZE == W_TYPE_SIZE - 1
> # error
> #endif
> /* Finally, the word size is larger than the number of bits in the
> required FSTYPE, and we've got no suitable wider type. The only
> way to avoid double rounding is to special case the
> extraction. */
>
> /* If there are no high bits set, fall back to one conversion. */
> if ((UWtype)u == u)
> return (FSTYPE)(UWtype)u;
>
> /* Otherwise, find the power of two. */
> UWtype hi = u >> W_TYPE_SIZE;
>
> UWtype count, shift;
> count_leading_zeros (count, hi);
>
> shift = W_TYPE_SIZE - count;
>
> /* Shift down the most significant bits. */
> hi = u >> shift;
>
> /* If we lost any nonzero bits, set the lsb to ensure correct rounding. */
> if (u & (((UDWtype)1 << shift) - 1))
> hi |= 1;
>
> /* Convert the one word of data, and rescale. */
> FSTYPE f = hi;
> f *= (UDWtype)1 << shift;
> return f;
> #endif
1412c1610
< #if defined(L_fixunsxfsi) && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
---
> #if defined(L_fixunsxfsi) && LIBGCC2_HAS_XF_MODE
1434c1632
< #ifdef L_fixunsdfsi
---
> #if defined(L_fixunsdfsi) && LIBGCC2_HAS_DF_MODE
1456c1654
< #ifdef L_fixunssfsi
---
> #if defined(L_fixunssfsi) && LIBGCC2_HAS_SF_MODE
1477a1676,1914
> /* Integer power helper used from __builtin_powi for non-constant
> exponents. */
>
> #if (defined(L_powisf2) && LIBGCC2_HAS_SF_MODE) \
> || (defined(L_powidf2) && LIBGCC2_HAS_DF_MODE) \
> || (defined(L_powixf2) && LIBGCC2_HAS_XF_MODE) \
> || (defined(L_powitf2) && LIBGCC2_HAS_TF_MODE)
> # if defined(L_powisf2)
> # define TYPE SFtype
> # define NAME __powisf2
> # elif defined(L_powidf2)
> # define TYPE DFtype
> # define NAME __powidf2
> # elif defined(L_powixf2)
> # define TYPE XFtype
> # define NAME __powixf2
> # elif defined(L_powitf2)
> # define TYPE TFtype
> # define NAME __powitf2
> # endif
>
> #undef int
> #undef unsigned
> TYPE
> NAME (TYPE x, int m)
> {
> unsigned int n = m < 0 ? -m : m;
> TYPE y = n % 2 ? x : 1;
> while (n >>= 1)
> {
> x = x * x;
> if (n % 2)
> y = y * x;
> }
> return m < 0 ? 1/y : y;
> }
>
> #endif
>
> #if ((defined(L_mulsc3) || defined(L_divsc3)) && LIBGCC2_HAS_SF_MODE) \
> || ((defined(L_muldc3) || defined(L_divdc3)) && LIBGCC2_HAS_DF_MODE) \
> || ((defined(L_mulxc3) || defined(L_divxc3)) && LIBGCC2_HAS_XF_MODE) \
> || ((defined(L_multc3) || defined(L_divtc3)) && LIBGCC2_HAS_TF_MODE)
>
> #undef float
> #undef double
> #undef long
>
> #if defined(L_mulsc3) || defined(L_divsc3)
> # define MTYPE SFtype
> # define CTYPE SCtype
> # define MODE sc
> # define CEXT f
> # define NOTRUNC __FLT_EVAL_METHOD__ == 0
> #elif defined(L_muldc3) || defined(L_divdc3)
> # define MTYPE DFtype
> # define CTYPE DCtype
> # define MODE dc
> # if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64
> # define CEXT l
> # define NOTRUNC 1
> # else
> # define CEXT
> # define NOTRUNC __FLT_EVAL_METHOD__ == 0 || __FLT_EVAL_METHOD__ == 1
> # endif
> #elif defined(L_mulxc3) || defined(L_divxc3)
> # define MTYPE XFtype
> # define CTYPE XCtype
> # define MODE xc
> # define CEXT l
> # define NOTRUNC 1
> #elif defined(L_multc3) || defined(L_divtc3)
> # define MTYPE TFtype
> # define CTYPE TCtype
> # define MODE tc
> # define CEXT l
> # define NOTRUNC 1
> #else
> # error
> #endif
>
> #define CONCAT3(A,B,C) _CONCAT3(A,B,C)
> #define _CONCAT3(A,B,C) A##B##C
>
> #define CONCAT2(A,B) _CONCAT2(A,B)
> #define _CONCAT2(A,B) A##B
>
> /* All of these would be present in a full C99 implementation of <math.h>
> and <complex.h>. Our problem is that only a few systems have such full
> implementations. Further, libgcc_s.so isn't currently linked against
> libm.so, and even for systems that do provide full C99, the extra overhead
> of all programs using libgcc having to link against libm. So avoid it. */
>
> #define isnan(x) __builtin_expect ((x) != (x), 0)
> #define isfinite(x) __builtin_expect (!isnan((x) - (x)), 1)
> #define isinf(x) __builtin_expect (!isnan(x) & !isfinite(x), 0)
>
> #define INFINITY CONCAT2(__builtin_inf, CEXT) ()
> #define I 1i
>
> /* Helpers to make the following code slightly less gross. */
> #define COPYSIGN CONCAT2(__builtin_copysign, CEXT)
> #define FABS CONCAT2(__builtin_fabs, CEXT)
>
> /* Verify that MTYPE matches up with CEXT. */
> extern void *compile_type_assert[sizeof(INFINITY) == sizeof(MTYPE) ? 1 : -1];
>
> /* Ensure that we've lost any extra precision. */
> #if NOTRUNC
> # define TRUNC(x)
> #else
> # define TRUNC(x) __asm__ ("" : "=m"(x) : "m"(x))
> #endif
>
> #if defined(L_mulsc3) || defined(L_muldc3) \
> || defined(L_mulxc3) || defined(L_multc3)
>
> CTYPE
> CONCAT3(__mul,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d)
> {
> MTYPE ac, bd, ad, bc, x, y;
>
> ac = a * c;
> bd = b * d;
> ad = a * d;
> bc = b * c;
>
> TRUNC (ac);
> TRUNC (bd);
> TRUNC (ad);
> TRUNC (bc);
>
> x = ac - bd;
> y = ad + bc;
>
> if (isnan (x) && isnan (y))
> {
> /* Recover infinities that computed as NaN + iNaN. */
> _Bool recalc = 0;
> if (isinf (a) || isinf (b))
> {
> /* z is infinite. "Box" the infinity and change NaNs in
> the other factor to 0. */
> a = COPYSIGN (isinf (a) ? 1 : 0, a);
> b = COPYSIGN (isinf (b) ? 1 : 0, b);
> if (isnan (c)) c = COPYSIGN (0, c);
> if (isnan (d)) d = COPYSIGN (0, d);
> recalc = 1;
> }
> if (isinf (c) || isinf (d))
> {
> /* w is infinite. "Box" the infinity and change NaNs in
> the other factor to 0. */
> c = COPYSIGN (isinf (c) ? 1 : 0, c);
> d = COPYSIGN (isinf (d) ? 1 : 0, d);
> if (isnan (a)) a = COPYSIGN (0, a);
> if (isnan (b)) b = COPYSIGN (0, b);
> recalc = 1;
> }
> if (!recalc
> && (isinf (ac) || isinf (bd)
> || isinf (ad) || isinf (bc)))
> {
> /* Recover infinities from overflow by changing NaNs to 0. */
> if (isnan (a)) a = COPYSIGN (0, a);
> if (isnan (b)) b = COPYSIGN (0, b);
> if (isnan (c)) c = COPYSIGN (0, c);
> if (isnan (d)) d = COPYSIGN (0, d);
> recalc = 1;
> }
> if (recalc)
> {
> x = INFINITY * (a * c - b * d);
> y = INFINITY * (a * d + b * c);
> }
> }
>
> return x + I * y;
> }
> #endif /* complex multiply */
>
> #if defined(L_divsc3) || defined(L_divdc3) \
> || defined(L_divxc3) || defined(L_divtc3)
>
> CTYPE
> CONCAT3(__div,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d)
> {
> MTYPE denom, ratio, x, y;
>
> /* ??? We can get better behavior from logarithmic scaling instead of
> the division. But that would mean starting to link libgcc against
> libm. We could implement something akin to ldexp/frexp as gcc builtins
> fairly easily... */
> if (FABS (c) < FABS (d))
> {
> ratio = c / d;
> denom = (c * ratio) + d;
> x = ((a * ratio) + b) / denom;
> y = ((b * ratio) - a) / denom;
> }
> else
> {
> ratio = d / c;
> denom = (d * ratio) + c;
> x = ((b * ratio) + a) / denom;
> y = (b - (a * ratio)) / denom;
> }
>
> /* Recover infinities and zeros that computed as NaN+iNaN; the only cases
> are nonzero/zero, infinite/finite, and finite/infinite. */
> if (isnan (x) && isnan (y))
> {
> if (c == 0.0 && d == 0.0 && (!isnan (a) || !isnan (b)))
> {
> x = COPYSIGN (INFINITY, c) * a;
> y = COPYSIGN (INFINITY, c) * b;
> }
> else if ((isinf (a) || isinf (b)) && isfinite (c) && isfinite (d))
> {
> a = COPYSIGN (isinf (a) ? 1 : 0, a);
> b = COPYSIGN (isinf (b) ? 1 : 0, b);
> x = INFINITY * (a * c + b * d);
> y = INFINITY * (b * c - a * d);
> }
> else if ((isinf (c) || isinf (d)) && isfinite (a) && isfinite (b))
> {
> c = COPYSIGN (isinf (c) ? 1 : 0, c);
> d = COPYSIGN (isinf (d) ? 1 : 0, d);
> x = 0.0 * (a * c + b * d);
> y = 0.0 * (b * c - a * d);
> }
> }
>
> return x + I * y;
> }
> #endif /* complex divide */
>
> #endif /* all complex float routines */
>
1578c2015
< long
---
> int
1626a2064
>
1636c2074
< #ifdef INIT_SECTION_ASM_OP
---
> #if defined (INIT_SECTION_ASM_OP) || defined (INIT_ARRAY_SECTION_ASM_OP)
1749c2187
<
---
> #endif /* LIBGCC2_UNITS_PER_WORD <= MIN_UNITS_PER_WORD */