Message ID | 1299458053-69428-7-git-send-email-andreas.faerber@web.de |
---|---|
State | New |
Headers | show |
On Mon, Mar 07, 2011 at 01:34:10AM +0100, Andreas Färber wrote: > v5: > * Initial. > > Cc: Peter Maydell <peter.maydell@linaro.org> > Signed-off-by: Andreas Färber <andreas.faerber@web.de> > --- > fpu/softfloat.c | 132 +++++++++++++++++++++++++++--------------------------- > fpu/softfloat.h | 34 +++++++-------- > 2 files changed, 82 insertions(+), 84 deletions(-) > > diff --git a/fpu/softfloat.c b/fpu/softfloat.c > index e6ecf6c..7f0f603 100644 > --- a/fpu/softfloat.c > +++ b/fpu/softfloat.c > @@ -109,12 +109,12 @@ INLINE flag extractFloat16Sign(float16 a) > | positive or negative integer is returned. > *----------------------------------------------------------------------------*/ > > -static int32 roundAndPackInt32( flag zSign, uint64_t absZ STATUS_PARAM) > +static int_fast32_t roundAndPackInt32( flag zSign, uint64_t absZ STATUS_PARAM) > { > int_fast8_t roundingMode; > flag roundNearestEven; > int_fast8_t roundIncrement, roundBits; > - int32 z; > + int_fast32_t z; > > roundingMode = STATUS(float_rounding_mode); > roundNearestEven = ( roundingMode == float_round_nearest_even ); > @@ -577,7 +577,7 @@ INLINE uint64_t extractFloatx80Frac( floatx80 a ) > | value `a'. > *----------------------------------------------------------------------------*/ > > -INLINE int32 extractFloatx80Exp( floatx80 a ) > +INLINE int_fast32_t extractFloatx80Exp( floatx80 a ) > { > > return a.high & 0x7FFF; > @@ -604,7 +604,7 @@ INLINE flag extractFloatx80Sign( floatx80 a ) > *----------------------------------------------------------------------------*/ > > static void > - normalizeFloatx80Subnormal( uint64_t aSig, int32 *zExpPtr, uint64_t *zSigPtr ) > + normalizeFloatx80Subnormal( uint64_t aSig, int_fast32_t *zExpPtr, uint64_t *zSigPtr ) > { > int_fast8_t shiftCount; > > @@ -619,7 +619,7 @@ static void > | extended double-precision floating-point value, returning the result. > *----------------------------------------------------------------------------*/ > > -INLINE floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig ) > +INLINE floatx80 packFloatx80( flag zSign, int_fast32_t zExp, uint64_t zSig ) > { > floatx80 z; > > @@ -655,7 +655,7 @@ INLINE floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig ) > > static floatx80 > roundAndPackFloatx80( > - int_fast8_t roundingPrecision, flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 > + int_fast8_t roundingPrecision, flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1 > STATUS_PARAM) > { > int_fast8_t roundingMode; > @@ -824,7 +824,7 @@ static floatx80 > > static floatx80 > normalizeRoundAndPackFloatx80( > - int_fast8_t roundingPrecision, flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 > + int_fast8_t roundingPrecision, flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1 > STATUS_PARAM) > { > int_fast8_t shiftCount; > @@ -875,7 +875,7 @@ INLINE uint64_t extractFloat128Frac0( float128 a ) > | `a'. > *----------------------------------------------------------------------------*/ > > -INLINE int32 extractFloat128Exp( float128 a ) > +INLINE int_fast32_t extractFloat128Exp( float128 a ) > { > > return ( a.high>>48 ) & 0x7FFF; > @@ -907,7 +907,7 @@ static void > normalizeFloat128Subnormal( > uint64_t aSig0, > uint64_t aSig1, > - int32 *zExpPtr, > + int_fast32_t *zExpPtr, > uint64_t *zSig0Ptr, > uint64_t *zSig1Ptr > ) > @@ -948,7 +948,7 @@ static void > *----------------------------------------------------------------------------*/ > > INLINE float128 > - packFloat128( flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 ) > + packFloat128( flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1 ) > { > float128 z; > > @@ -981,7 +981,7 @@ INLINE float128 > > static float128 > roundAndPackFloat128( > - flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2 STATUS_PARAM) > + flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2 STATUS_PARAM) > { > int_fast8_t roundingMode; > flag roundNearestEven, increment, isTiny; > @@ -1082,7 +1082,7 @@ static float128 > > static float128 > normalizeRoundAndPackFloat128( > - flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 STATUS_PARAM) > + flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1 STATUS_PARAM) > { > int_fast8_t shiftCount; > uint64_t zSig2; > @@ -1114,7 +1114,7 @@ static float128 > | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic. > *----------------------------------------------------------------------------*/ > > -float32 int32_to_float32( int32 a STATUS_PARAM ) > +float32 int32_to_float32( int_fast32_t a STATUS_PARAM ) > { > flag zSign; > > @@ -1131,10 +1131,10 @@ float32 int32_to_float32( int32 a STATUS_PARAM ) > | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic. > *----------------------------------------------------------------------------*/ > > -float64 int32_to_float64( int32 a STATUS_PARAM ) > +float64 int32_to_float64( int_fast32_t a STATUS_PARAM ) > { > flag zSign; > - uint32 absA; > + uint_fast32_t absA; > int_fast8_t shiftCount; > uint64_t zSig; > > @@ -1156,10 +1156,10 @@ float64 int32_to_float64( int32 a STATUS_PARAM ) > | Arithmetic. > *----------------------------------------------------------------------------*/ > > -floatx80 int32_to_floatx80( int32 a STATUS_PARAM ) > +floatx80 int32_to_floatx80( int_fast32_t a STATUS_PARAM ) > { > flag zSign; > - uint32 absA; > + uint_fast32_t absA; > int_fast8_t shiftCount; > uint64_t zSig; > > @@ -1182,10 +1182,10 @@ floatx80 int32_to_floatx80( int32 a STATUS_PARAM ) > | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic. > *----------------------------------------------------------------------------*/ > > -float128 int32_to_float128( int32 a STATUS_PARAM ) > +float128 int32_to_float128( int_fast32_t a STATUS_PARAM ) > { > flag zSign; > - uint32 absA; > + uint_fast32_t absA; > int_fast8_t shiftCount; > uint64_t zSig0; > > @@ -1317,7 +1317,7 @@ float128 int64_to_float128( int64 a STATUS_PARAM ) > flag zSign; > uint64 absA; > int_fast8_t shiftCount; > - int32 zExp; > + int_fast32_t zExp; > uint64_t zSig0, zSig1; > > if ( a == 0 ) return packFloat128( 0, 0, 0, 0 ); > @@ -1351,7 +1351,7 @@ float128 int64_to_float128( int64 a STATUS_PARAM ) > | largest integer with the same sign as `a' is returned. > *----------------------------------------------------------------------------*/ > > -int32 float32_to_int32( float32 a STATUS_PARAM ) > +int_fast32_t float32_to_int32( float32 a STATUS_PARAM ) > { > flag aSign; > int_fast16_t aExp, shiftCount; > @@ -1382,12 +1382,12 @@ int32 float32_to_int32( float32 a STATUS_PARAM ) > | returned. > *----------------------------------------------------------------------------*/ > > -int32 float32_to_int32_round_to_zero( float32 a STATUS_PARAM ) > +int_fast32_t float32_to_int32_round_to_zero( float32 a STATUS_PARAM ) > { > flag aSign; > int_fast16_t aExp, shiftCount; > uint32_t aSig; > - int32 z; > + int_fast32_t z; > a = float32_squash_input_denormal(a STATUS_VAR); > > aSig = extractFloat32Frac( a ); > @@ -1430,7 +1430,7 @@ int_fast16_t float32_to_int16_round_to_zero( float32 a STATUS_PARAM ) > flag aSign; > int_fast16_t aExp, shiftCount; > uint32_t aSig; > - int32 z; > + int_fast32_t z; > > aSig = extractFloat32Frac( a ); > aExp = extractFloat32Exp( a ); > @@ -2490,7 +2490,7 @@ int float32_lt_quiet( float32 a, float32 b STATUS_PARAM ) > | largest integer with the same sign as `a' is returned. > *----------------------------------------------------------------------------*/ > > -int32 float64_to_int32( float64 a STATUS_PARAM ) > +int_fast32_t float64_to_int32( float64 a STATUS_PARAM ) > { > flag aSign; > int_fast16_t aExp, shiftCount; > @@ -2518,12 +2518,12 @@ int32 float64_to_int32( float64 a STATUS_PARAM ) > | returned. > *----------------------------------------------------------------------------*/ > > -int32 float64_to_int32_round_to_zero( float64 a STATUS_PARAM ) > +int_fast32_t float64_to_int32_round_to_zero( float64 a STATUS_PARAM ) > { > flag aSign; > int_fast16_t aExp, shiftCount; > uint64_t aSig, savedASig; > - int32 z; > + int_fast32_t z; > a = float64_squash_input_denormal(a STATUS_VAR); > > aSig = extractFloat64Frac( a ); > @@ -2570,7 +2570,7 @@ int_fast16_t float64_to_int16_round_to_zero( float64 a STATUS_PARAM ) > flag aSign; > int_fast16_t aExp, shiftCount; > uint64_t aSig, savedASig; > - int32 z; > + int_fast32_t z; > > aSig = extractFloat64Frac( a ); > aExp = extractFloat64Exp( a ); > @@ -3716,10 +3716,10 @@ int float64_lt_quiet( float64 a, float64 b STATUS_PARAM ) > | overflows, the largest integer with the same sign as `a' is returned. > *----------------------------------------------------------------------------*/ > > -int32 floatx80_to_int32( floatx80 a STATUS_PARAM ) > +int_fast32_t floatx80_to_int32( floatx80 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp, shiftCount; > + int_fast32_t aExp, shiftCount; > uint64_t aSig; > > aSig = extractFloatx80Frac( a ); > @@ -3743,12 +3743,12 @@ int32 floatx80_to_int32( floatx80 a STATUS_PARAM ) > | sign as `a' is returned. > *----------------------------------------------------------------------------*/ > > -int32 floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM ) > +int_fast32_t floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp, shiftCount; > + int_fast32_t aExp, shiftCount; > uint64_t aSig, savedASig; > - int32 z; > + int_fast32_t z; > > aSig = extractFloatx80Frac( a ); > aExp = extractFloatx80Exp( a ); > @@ -3791,7 +3791,7 @@ int32 floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM ) > int64 floatx80_to_int64( floatx80 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp, shiftCount; > + int_fast32_t aExp, shiftCount; > uint64_t aSig, aSigExtra; > > aSig = extractFloatx80Frac( a ); > @@ -3831,7 +3831,7 @@ int64 floatx80_to_int64( floatx80 a STATUS_PARAM ) > int64 floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp, shiftCount; > + int_fast32_t aExp, shiftCount; > uint64_t aSig; > int64 z; > > @@ -3872,7 +3872,7 @@ int64 floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM ) > float32 floatx80_to_float32( floatx80 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp; > + int_fast32_t aExp; > uint64_t aSig; > > aSig = extractFloatx80Frac( a ); > @@ -3900,7 +3900,7 @@ float32 floatx80_to_float32( floatx80 a STATUS_PARAM ) > float64 floatx80_to_float64( floatx80 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp; > + int_fast32_t aExp; > uint64_t aSig, zSig; > > aSig = extractFloatx80Frac( a ); > @@ -3956,7 +3956,7 @@ float128 floatx80_to_float128( floatx80 a STATUS_PARAM ) > floatx80 floatx80_round_to_int( floatx80 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp; > + int_fast32_t aExp; > uint64_t lastBitMask, roundBitsMask; > int_fast8_t roundingMode; > floatx80 z; > @@ -4029,9 +4029,9 @@ floatx80 floatx80_round_to_int( floatx80 a STATUS_PARAM ) > > static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM) > { > - int32 aExp, bExp, zExp; > + int_fast32_t aExp, bExp, zExp; > uint64_t aSig, bSig, zSig0, zSig1; > - int32 expDiff; > + int_fast32_t expDiff; > > aSig = extractFloatx80Frac( a ); > aExp = extractFloatx80Exp( a ); > @@ -4095,9 +4095,9 @@ static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM > > static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM ) > { > - int32 aExp, bExp, zExp; > + int_fast32_t aExp, bExp, zExp; > uint64_t aSig, bSig, zSig0, zSig1; > - int32 expDiff; > + int_fast32_t expDiff; > floatx80 z; > > aSig = extractFloatx80Frac( a ); > @@ -4204,7 +4204,7 @@ floatx80 floatx80_sub( floatx80 a, floatx80 b STATUS_PARAM ) > floatx80 floatx80_mul( floatx80 a, floatx80 b STATUS_PARAM ) > { > flag aSign, bSign, zSign; > - int32 aExp, bExp, zExp; > + int_fast32_t aExp, bExp, zExp; > uint64_t aSig, bSig, zSig0, zSig1; > floatx80 z; > > @@ -4263,7 +4263,7 @@ floatx80 floatx80_mul( floatx80 a, floatx80 b STATUS_PARAM ) > floatx80 floatx80_div( floatx80 a, floatx80 b STATUS_PARAM ) > { > flag aSign, bSign, zSign; > - int32 aExp, bExp, zExp; > + int_fast32_t aExp, bExp, zExp; > uint64_t aSig, bSig, zSig0, zSig1; > uint64_t rem0, rem1, rem2, term0, term1, term2; > floatx80 z; > @@ -4343,7 +4343,7 @@ floatx80 floatx80_div( floatx80 a, floatx80 b STATUS_PARAM ) > floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM ) > { > flag aSign, zSign; > - int32 aExp, bExp, expDiff; > + int_fast32_t aExp, bExp, expDiff; > uint64_t aSig0, aSig1, bSig; > uint64_t q, term0, term1, alternateASig0, alternateASig1; > floatx80 z; > @@ -4439,7 +4439,7 @@ floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM ) > floatx80 floatx80_sqrt( floatx80 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp, zExp; > + int_fast32_t aExp, zExp; > uint64_t aSig0, aSig1, zSig0, zSig1, doubleZSig0; > uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3; > floatx80 z; > @@ -4709,10 +4709,10 @@ int floatx80_lt_quiet( floatx80 a, floatx80 b STATUS_PARAM ) > | largest integer with the same sign as `a' is returned. > *----------------------------------------------------------------------------*/ > > -int32 float128_to_int32( float128 a STATUS_PARAM ) > +int_fast32_t float128_to_int32( float128 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp, shiftCount; > + int_fast32_t aExp, shiftCount; > uint64_t aSig0, aSig1; > > aSig1 = extractFloat128Frac1( a ); > @@ -4738,12 +4738,12 @@ int32 float128_to_int32( float128 a STATUS_PARAM ) > | returned. > *----------------------------------------------------------------------------*/ > > -int32 float128_to_int32_round_to_zero( float128 a STATUS_PARAM ) > +int_fast32_t float128_to_int32_round_to_zero( float128 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp, shiftCount; > + int_fast32_t aExp, shiftCount; > uint64_t aSig0, aSig1, savedASig; > - int32 z; > + int_fast32_t z; > > aSig1 = extractFloat128Frac1( a ); > aSig0 = extractFloat128Frac0( a ); > @@ -4789,7 +4789,7 @@ int32 float128_to_int32_round_to_zero( float128 a STATUS_PARAM ) > int64 float128_to_int64( float128 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp, shiftCount; > + int_fast32_t aExp, shiftCount; > uint64_t aSig0, aSig1; > > aSig1 = extractFloat128Frac1( a ); > @@ -4832,7 +4832,7 @@ int64 float128_to_int64( float128 a STATUS_PARAM ) > int64 float128_to_int64_round_to_zero( float128 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp, shiftCount; > + int_fast32_t aExp, shiftCount; > uint64_t aSig0, aSig1; > int64 z; > > @@ -4890,7 +4890,7 @@ int64 float128_to_int64_round_to_zero( float128 a STATUS_PARAM ) > float32 float128_to_float32( float128 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp; > + int_fast32_t aExp; > uint64_t aSig0, aSig1; > uint32_t zSig; > > @@ -4925,7 +4925,7 @@ float32 float128_to_float32( float128 a STATUS_PARAM ) > float64 float128_to_float64( float128 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp; > + int_fast32_t aExp; > uint64_t aSig0, aSig1; > > aSig1 = extractFloat128Frac1( a ); > @@ -4960,7 +4960,7 @@ float64 float128_to_float64( float128 a STATUS_PARAM ) > floatx80 float128_to_floatx80( float128 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp; > + int_fast32_t aExp; > uint64_t aSig0, aSig1; > > aSig1 = extractFloat128Frac1( a ); > @@ -4997,7 +4997,7 @@ floatx80 float128_to_floatx80( float128 a STATUS_PARAM ) > float128 float128_round_to_int( float128 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp; > + int_fast32_t aExp; > uint64_t lastBitMask, roundBitsMask; > int_fast8_t roundingMode; > float128 z; > @@ -5100,9 +5100,9 @@ float128 float128_round_to_int( float128 a STATUS_PARAM ) > > static float128 addFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM) > { > - int32 aExp, bExp, zExp; > + int_fast32_t aExp, bExp, zExp; > uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2; > - int32 expDiff; > + int_fast32_t expDiff; > > aSig1 = extractFloat128Frac1( a ); > aSig0 = extractFloat128Frac0( a ); > @@ -5181,9 +5181,9 @@ static float128 addFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM > > static float128 subFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM) > { > - int32 aExp, bExp, zExp; > + int_fast32_t aExp, bExp, zExp; > uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1; > - int32 expDiff; > + int_fast32_t expDiff; > float128 z; > > aSig1 = extractFloat128Frac1( a ); > @@ -5306,7 +5306,7 @@ float128 float128_sub( float128 a, float128 b STATUS_PARAM ) > float128 float128_mul( float128 a, float128 b STATUS_PARAM ) > { > flag aSign, bSign, zSign; > - int32 aExp, bExp, zExp; > + int_fast32_t aExp, bExp, zExp; > uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2, zSig3; > float128 z; > > @@ -5370,7 +5370,7 @@ float128 float128_mul( float128 a, float128 b STATUS_PARAM ) > float128 float128_div( float128 a, float128 b STATUS_PARAM ) > { > flag aSign, bSign, zSign; > - int32 aExp, bExp, zExp; > + int_fast32_t aExp, bExp, zExp; > uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2; > uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3; > float128 z; > @@ -5454,7 +5454,7 @@ float128 float128_div( float128 a, float128 b STATUS_PARAM ) > float128 float128_rem( float128 a, float128 b STATUS_PARAM ) > { > flag aSign, zSign; > - int32 aExp, bExp, expDiff; > + int_fast32_t aExp, bExp, expDiff; > uint64_t aSig0, aSig1, bSig0, bSig1, q, term0, term1, term2; > uint64_t allZero, alternateASig0, alternateASig1, sigMean1; > int64_t sigMean0; > @@ -5563,7 +5563,7 @@ float128 float128_rem( float128 a, float128 b STATUS_PARAM ) > float128 float128_sqrt( float128 a STATUS_PARAM ) > { > flag aSign; > - int32 aExp, zExp; > + int_fast32_t aExp, zExp; > uint64_t aSig0, aSig1, zSig0, zSig1, zSig2, doubleZSig0; > uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3; > float128 z; > @@ -6133,7 +6133,7 @@ floatx80 floatx80_scalbn( floatx80 a, int n STATUS_PARAM ) > float128 float128_scalbn( float128 a, int n STATUS_PARAM ) > { > flag aSign; > - int32 aExp; > + int_fast32_t aExp; > uint64_t aSig0, aSig1; > > aSig1 = extractFloat128Frac1( a ); > diff --git a/fpu/softfloat.h b/fpu/softfloat.h > index c599cc2..4c64d77 100644 > --- a/fpu/softfloat.h > +++ b/fpu/softfloat.h > @@ -54,8 +54,6 @@ these four paragraphs for those parts of this code that are retained. > | to the same as `int'. > *----------------------------------------------------------------------------*/ > typedef uint8_t flag; > -typedef unsigned int uint32; > -typedef signed int int32; > typedef uint64_t uint64; > typedef int64_t int64; > > @@ -234,15 +232,15 @@ void float_raise( int_fast8_t flags STATUS_PARAM); > /*---------------------------------------------------------------------------- > | Software IEC/IEEE integer-to-floating-point conversion routines. > *----------------------------------------------------------------------------*/ > -float32 int32_to_float32( int32 STATUS_PARAM ); > -float64 int32_to_float64( int32 STATUS_PARAM ); > +float32 int32_to_float32( int_fast32_t STATUS_PARAM ); > +float64 int32_to_float64( int_fast32_t STATUS_PARAM ); > float32 uint32_to_float32( unsigned int STATUS_PARAM ); > float64 uint32_to_float64( unsigned int STATUS_PARAM ); > #ifdef FLOATX80 > -floatx80 int32_to_floatx80( int32 STATUS_PARAM ); > +floatx80 int32_to_floatx80( int_fast32_t STATUS_PARAM ); > #endif > #ifdef FLOAT128 > -float128 int32_to_float128( int32 STATUS_PARAM ); > +float128 int32_to_float128( int_fast32_t STATUS_PARAM ); > #endif > float32 int64_to_float32( int64 STATUS_PARAM ); > float32 uint64_to_float32( uint64 STATUS_PARAM ); > @@ -284,10 +282,10 @@ float16 float16_maybe_silence_nan( float16 ); > *----------------------------------------------------------------------------*/ > int_fast16_t float32_to_int16_round_to_zero( float32 STATUS_PARAM ); > uint_fast16_t float32_to_uint16_round_to_zero( float32 STATUS_PARAM ); > -int32 float32_to_int32( float32 STATUS_PARAM ); > -int32 float32_to_int32_round_to_zero( float32 STATUS_PARAM ); > -uint32 float32_to_uint32( float32 STATUS_PARAM ); > -uint32 float32_to_uint32_round_to_zero( float32 STATUS_PARAM ); > +int_fast32_t float32_to_int32( float32 STATUS_PARAM ); > +int_fast32_t float32_to_int32_round_to_zero( float32 STATUS_PARAM ); > +uint_fast32_t float32_to_uint32( float32 STATUS_PARAM ); > +uint_fast32_t float32_to_uint32_round_to_zero( float32 STATUS_PARAM ); > int64 float32_to_int64( float32 STATUS_PARAM ); > int64 float32_to_int64_round_to_zero( float32 STATUS_PARAM ); > float64 float32_to_float64( float32 STATUS_PARAM ); > @@ -394,10 +392,10 @@ INLINE float32 float32_set_sign(float32 a, int sign) > *----------------------------------------------------------------------------*/ > int_fast16_t float64_to_int16_round_to_zero( float64 STATUS_PARAM ); > uint_fast16_t float64_to_uint16_round_to_zero( float64 STATUS_PARAM ); > -int32 float64_to_int32( float64 STATUS_PARAM ); > -int32 float64_to_int32_round_to_zero( float64 STATUS_PARAM ); > -uint32 float64_to_uint32( float64 STATUS_PARAM ); > -uint32 float64_to_uint32_round_to_zero( float64 STATUS_PARAM ); > +int_fast32_t float64_to_int32( float64 STATUS_PARAM ); > +int_fast32_t float64_to_int32_round_to_zero( float64 STATUS_PARAM ); > +uint_fast32_t float64_to_uint32( float64 STATUS_PARAM ); > +uint_fast32_t float64_to_uint32_round_to_zero( float64 STATUS_PARAM ); If you do such a change in the declaration, you should do the same in the code, otherwise it doesn't compile... > int64 float64_to_int64( float64 STATUS_PARAM ); > int64 float64_to_int64_round_to_zero( float64 STATUS_PARAM ); > uint64 float64_to_uint64 (float64 a STATUS_PARAM); > @@ -501,8 +499,8 @@ INLINE float64 float64_set_sign(float64 a, int sign) > /*---------------------------------------------------------------------------- > | Software IEC/IEEE extended double-precision conversion routines. > *----------------------------------------------------------------------------*/ > -int32 floatx80_to_int32( floatx80 STATUS_PARAM ); > -int32 floatx80_to_int32_round_to_zero( floatx80 STATUS_PARAM ); > +int_fast32_t floatx80_to_int32( floatx80 STATUS_PARAM ); > +int_fast32_t floatx80_to_int32_round_to_zero( floatx80 STATUS_PARAM ); > int64 floatx80_to_int64( floatx80 STATUS_PARAM ); > int64 floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM ); > float32 floatx80_to_float32( floatx80 STATUS_PARAM ); > @@ -584,8 +582,8 @@ INLINE int floatx80_is_any_nan(floatx80 a) > /*---------------------------------------------------------------------------- > | Software IEC/IEEE quadruple-precision conversion routines. > *----------------------------------------------------------------------------*/ > -int32 float128_to_int32( float128 STATUS_PARAM ); > -int32 float128_to_int32_round_to_zero( float128 STATUS_PARAM ); > +int_fast32_t float128_to_int32( float128 STATUS_PARAM ); > +int_fast32_t float128_to_int32_round_to_zero( float128 STATUS_PARAM ); > int64 float128_to_int64( float128 STATUS_PARAM ); > int64 float128_to_int64_round_to_zero( float128 STATUS_PARAM ); > float32 float128_to_float32( float128 STATUS_PARAM ); > -- > 1.7.3.4 > > >
Am 07.03.2011 um 10:56 schrieb Aurelien Jarno: > On Mon, Mar 07, 2011 at 01:34:10AM +0100, Andreas Färber wrote: >> v5: >> * Initial. >> >> Cc: Peter Maydell <peter.maydell@linaro.org> >> Signed-off-by: Andreas Färber <andreas.faerber@web.de> >> --- >> fpu/softfloat.c | 132 ++++++++++++++++++++++++++ >> +--------------------------- >> fpu/softfloat.h | 34 +++++++-------- >> 2 files changed, 82 insertions(+), 84 deletions(-) >> diff --git a/fpu/softfloat.h b/fpu/softfloat.h >> index c599cc2..4c64d77 100644 >> --- a/fpu/softfloat.h >> +++ b/fpu/softfloat.h >> @@ -394,10 +392,10 @@ INLINE float32 float32_set_sign(float32 a, >> int sign) >> *----------------------------------------------------------------------------*/ >> int_fast16_t float64_to_int16_round_to_zero( float64 STATUS_PARAM ); >> uint_fast16_t float64_to_uint16_round_to_zero( float64 >> STATUS_PARAM ); >> -int32 float64_to_int32( float64 STATUS_PARAM ); >> -int32 float64_to_int32_round_to_zero( float64 STATUS_PARAM ); >> -uint32 float64_to_uint32( float64 STATUS_PARAM ); >> -uint32 float64_to_uint32_round_to_zero( float64 STATUS_PARAM ); >> +int_fast32_t float64_to_int32( float64 STATUS_PARAM ); >> +int_fast32_t float64_to_int32_round_to_zero( float64 STATUS_PARAM ); >> +uint_fast32_t float64_to_uint32( float64 STATUS_PARAM ); >> +uint_fast32_t float64_to_uint32_round_to_zero( float64 >> STATUS_PARAM ); > > If you do such a change in the declaration, you should do the same in > the code, otherwise it doesn't compile... Hrm, are you saying this is missing in 08/10, or would you like to see that squashed into this one? It did compile at some point, at least before I reordered patches. Andreas
On Tue, Mar 08, 2011 at 12:16:49AM +0100, Andreas Färber wrote: > Am 07.03.2011 um 10:56 schrieb Aurelien Jarno: > > >On Mon, Mar 07, 2011 at 01:34:10AM +0100, Andreas Färber wrote: > >>v5: > >>* Initial. > >> > >>Cc: Peter Maydell <peter.maydell@linaro.org> > >>Signed-off-by: Andreas Färber <andreas.faerber@web.de> > >>--- > >>fpu/softfloat.c | 132 ++++++++++++++++++++++++++ > >>+--------------------------- > >>fpu/softfloat.h | 34 +++++++-------- > >>2 files changed, 82 insertions(+), 84 deletions(-) > > >>diff --git a/fpu/softfloat.h b/fpu/softfloat.h > >>index c599cc2..4c64d77 100644 > >>--- a/fpu/softfloat.h > >>+++ b/fpu/softfloat.h > > >>@@ -394,10 +392,10 @@ INLINE float32 float32_set_sign(float32 a, > >>int sign) > >>*----------------------------------------------------------------------------*/ > >>int_fast16_t float64_to_int16_round_to_zero( float64 STATUS_PARAM ); > >>uint_fast16_t float64_to_uint16_round_to_zero( float64 > >>STATUS_PARAM ); > >>-int32 float64_to_int32( float64 STATUS_PARAM ); > >>-int32 float64_to_int32_round_to_zero( float64 STATUS_PARAM ); > >>-uint32 float64_to_uint32( float64 STATUS_PARAM ); > >>-uint32 float64_to_uint32_round_to_zero( float64 STATUS_PARAM ); > >>+int_fast32_t float64_to_int32( float64 STATUS_PARAM ); > >>+int_fast32_t float64_to_int32_round_to_zero( float64 STATUS_PARAM ); > >>+uint_fast32_t float64_to_uint32( float64 STATUS_PARAM ); > >>+uint_fast32_t float64_to_uint32_round_to_zero( float64 > >>STATUS_PARAM ); > > > >If you do such a change in the declaration, you should do the same in > >the code, otherwise it doesn't compile... > > Hrm, are you saying this is missing in 08/10, or would you like to > see that squashed into this one? > It did compile at some point, at least before I reordered patches. > You should not break bisect, so if you change the declaration in a patch, you should also change the corresponding code in the same patch. My guess is that you are using a 32-bit system, so int_fast32_t is the same size as a int. On my system int_fast32_t is equivalent to int64_t so it doesn't compile. That's why I don't think it's a good idea to use fast types.
diff --git a/fpu/softfloat.c b/fpu/softfloat.c index e6ecf6c..7f0f603 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -109,12 +109,12 @@ INLINE flag extractFloat16Sign(float16 a) | positive or negative integer is returned. *----------------------------------------------------------------------------*/ -static int32 roundAndPackInt32( flag zSign, uint64_t absZ STATUS_PARAM) +static int_fast32_t roundAndPackInt32( flag zSign, uint64_t absZ STATUS_PARAM) { int_fast8_t roundingMode; flag roundNearestEven; int_fast8_t roundIncrement, roundBits; - int32 z; + int_fast32_t z; roundingMode = STATUS(float_rounding_mode); roundNearestEven = ( roundingMode == float_round_nearest_even ); @@ -577,7 +577,7 @@ INLINE uint64_t extractFloatx80Frac( floatx80 a ) | value `a'. *----------------------------------------------------------------------------*/ -INLINE int32 extractFloatx80Exp( floatx80 a ) +INLINE int_fast32_t extractFloatx80Exp( floatx80 a ) { return a.high & 0x7FFF; @@ -604,7 +604,7 @@ INLINE flag extractFloatx80Sign( floatx80 a ) *----------------------------------------------------------------------------*/ static void - normalizeFloatx80Subnormal( uint64_t aSig, int32 *zExpPtr, uint64_t *zSigPtr ) + normalizeFloatx80Subnormal( uint64_t aSig, int_fast32_t *zExpPtr, uint64_t *zSigPtr ) { int_fast8_t shiftCount; @@ -619,7 +619,7 @@ static void | extended double-precision floating-point value, returning the result. *----------------------------------------------------------------------------*/ -INLINE floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig ) +INLINE floatx80 packFloatx80( flag zSign, int_fast32_t zExp, uint64_t zSig ) { floatx80 z; @@ -655,7 +655,7 @@ INLINE floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig ) static floatx80 roundAndPackFloatx80( - int_fast8_t roundingPrecision, flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 + int_fast8_t roundingPrecision, flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1 STATUS_PARAM) { int_fast8_t roundingMode; @@ -824,7 +824,7 @@ static floatx80 static floatx80 normalizeRoundAndPackFloatx80( - int_fast8_t roundingPrecision, flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 + int_fast8_t roundingPrecision, flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1 STATUS_PARAM) { int_fast8_t shiftCount; @@ -875,7 +875,7 @@ INLINE uint64_t extractFloat128Frac0( float128 a ) | `a'. *----------------------------------------------------------------------------*/ -INLINE int32 extractFloat128Exp( float128 a ) +INLINE int_fast32_t extractFloat128Exp( float128 a ) { return ( a.high>>48 ) & 0x7FFF; @@ -907,7 +907,7 @@ static void normalizeFloat128Subnormal( uint64_t aSig0, uint64_t aSig1, - int32 *zExpPtr, + int_fast32_t *zExpPtr, uint64_t *zSig0Ptr, uint64_t *zSig1Ptr ) @@ -948,7 +948,7 @@ static void *----------------------------------------------------------------------------*/ INLINE float128 - packFloat128( flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 ) + packFloat128( flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1 ) { float128 z; @@ -981,7 +981,7 @@ INLINE float128 static float128 roundAndPackFloat128( - flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2 STATUS_PARAM) + flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2 STATUS_PARAM) { int_fast8_t roundingMode; flag roundNearestEven, increment, isTiny; @@ -1082,7 +1082,7 @@ static float128 static float128 normalizeRoundAndPackFloat128( - flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 STATUS_PARAM) + flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1 STATUS_PARAM) { int_fast8_t shiftCount; uint64_t zSig2; @@ -1114,7 +1114,7 @@ static float128 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic. *----------------------------------------------------------------------------*/ -float32 int32_to_float32( int32 a STATUS_PARAM ) +float32 int32_to_float32( int_fast32_t a STATUS_PARAM ) { flag zSign; @@ -1131,10 +1131,10 @@ float32 int32_to_float32( int32 a STATUS_PARAM ) | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic. *----------------------------------------------------------------------------*/ -float64 int32_to_float64( int32 a STATUS_PARAM ) +float64 int32_to_float64( int_fast32_t a STATUS_PARAM ) { flag zSign; - uint32 absA; + uint_fast32_t absA; int_fast8_t shiftCount; uint64_t zSig; @@ -1156,10 +1156,10 @@ float64 int32_to_float64( int32 a STATUS_PARAM ) | Arithmetic. *----------------------------------------------------------------------------*/ -floatx80 int32_to_floatx80( int32 a STATUS_PARAM ) +floatx80 int32_to_floatx80( int_fast32_t a STATUS_PARAM ) { flag zSign; - uint32 absA; + uint_fast32_t absA; int_fast8_t shiftCount; uint64_t zSig; @@ -1182,10 +1182,10 @@ floatx80 int32_to_floatx80( int32 a STATUS_PARAM ) | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic. *----------------------------------------------------------------------------*/ -float128 int32_to_float128( int32 a STATUS_PARAM ) +float128 int32_to_float128( int_fast32_t a STATUS_PARAM ) { flag zSign; - uint32 absA; + uint_fast32_t absA; int_fast8_t shiftCount; uint64_t zSig0; @@ -1317,7 +1317,7 @@ float128 int64_to_float128( int64 a STATUS_PARAM ) flag zSign; uint64 absA; int_fast8_t shiftCount; - int32 zExp; + int_fast32_t zExp; uint64_t zSig0, zSig1; if ( a == 0 ) return packFloat128( 0, 0, 0, 0 ); @@ -1351,7 +1351,7 @@ float128 int64_to_float128( int64 a STATUS_PARAM ) | largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int32 float32_to_int32( float32 a STATUS_PARAM ) +int_fast32_t float32_to_int32( float32 a STATUS_PARAM ) { flag aSign; int_fast16_t aExp, shiftCount; @@ -1382,12 +1382,12 @@ int32 float32_to_int32( float32 a STATUS_PARAM ) | returned. *----------------------------------------------------------------------------*/ -int32 float32_to_int32_round_to_zero( float32 a STATUS_PARAM ) +int_fast32_t float32_to_int32_round_to_zero( float32 a STATUS_PARAM ) { flag aSign; int_fast16_t aExp, shiftCount; uint32_t aSig; - int32 z; + int_fast32_t z; a = float32_squash_input_denormal(a STATUS_VAR); aSig = extractFloat32Frac( a ); @@ -1430,7 +1430,7 @@ int_fast16_t float32_to_int16_round_to_zero( float32 a STATUS_PARAM ) flag aSign; int_fast16_t aExp, shiftCount; uint32_t aSig; - int32 z; + int_fast32_t z; aSig = extractFloat32Frac( a ); aExp = extractFloat32Exp( a ); @@ -2490,7 +2490,7 @@ int float32_lt_quiet( float32 a, float32 b STATUS_PARAM ) | largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int32 float64_to_int32( float64 a STATUS_PARAM ) +int_fast32_t float64_to_int32( float64 a STATUS_PARAM ) { flag aSign; int_fast16_t aExp, shiftCount; @@ -2518,12 +2518,12 @@ int32 float64_to_int32( float64 a STATUS_PARAM ) | returned. *----------------------------------------------------------------------------*/ -int32 float64_to_int32_round_to_zero( float64 a STATUS_PARAM ) +int_fast32_t float64_to_int32_round_to_zero( float64 a STATUS_PARAM ) { flag aSign; int_fast16_t aExp, shiftCount; uint64_t aSig, savedASig; - int32 z; + int_fast32_t z; a = float64_squash_input_denormal(a STATUS_VAR); aSig = extractFloat64Frac( a ); @@ -2570,7 +2570,7 @@ int_fast16_t float64_to_int16_round_to_zero( float64 a STATUS_PARAM ) flag aSign; int_fast16_t aExp, shiftCount; uint64_t aSig, savedASig; - int32 z; + int_fast32_t z; aSig = extractFloat64Frac( a ); aExp = extractFloat64Exp( a ); @@ -3716,10 +3716,10 @@ int float64_lt_quiet( float64 a, float64 b STATUS_PARAM ) | overflows, the largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int32 floatx80_to_int32( floatx80 a STATUS_PARAM ) +int_fast32_t floatx80_to_int32( floatx80 a STATUS_PARAM ) { flag aSign; - int32 aExp, shiftCount; + int_fast32_t aExp, shiftCount; uint64_t aSig; aSig = extractFloatx80Frac( a ); @@ -3743,12 +3743,12 @@ int32 floatx80_to_int32( floatx80 a STATUS_PARAM ) | sign as `a' is returned. *----------------------------------------------------------------------------*/ -int32 floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM ) +int_fast32_t floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM ) { flag aSign; - int32 aExp, shiftCount; + int_fast32_t aExp, shiftCount; uint64_t aSig, savedASig; - int32 z; + int_fast32_t z; aSig = extractFloatx80Frac( a ); aExp = extractFloatx80Exp( a ); @@ -3791,7 +3791,7 @@ int32 floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM ) int64 floatx80_to_int64( floatx80 a STATUS_PARAM ) { flag aSign; - int32 aExp, shiftCount; + int_fast32_t aExp, shiftCount; uint64_t aSig, aSigExtra; aSig = extractFloatx80Frac( a ); @@ -3831,7 +3831,7 @@ int64 floatx80_to_int64( floatx80 a STATUS_PARAM ) int64 floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM ) { flag aSign; - int32 aExp, shiftCount; + int_fast32_t aExp, shiftCount; uint64_t aSig; int64 z; @@ -3872,7 +3872,7 @@ int64 floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM ) float32 floatx80_to_float32( floatx80 a STATUS_PARAM ) { flag aSign; - int32 aExp; + int_fast32_t aExp; uint64_t aSig; aSig = extractFloatx80Frac( a ); @@ -3900,7 +3900,7 @@ float32 floatx80_to_float32( floatx80 a STATUS_PARAM ) float64 floatx80_to_float64( floatx80 a STATUS_PARAM ) { flag aSign; - int32 aExp; + int_fast32_t aExp; uint64_t aSig, zSig; aSig = extractFloatx80Frac( a ); @@ -3956,7 +3956,7 @@ float128 floatx80_to_float128( floatx80 a STATUS_PARAM ) floatx80 floatx80_round_to_int( floatx80 a STATUS_PARAM ) { flag aSign; - int32 aExp; + int_fast32_t aExp; uint64_t lastBitMask, roundBitsMask; int_fast8_t roundingMode; floatx80 z; @@ -4029,9 +4029,9 @@ floatx80 floatx80_round_to_int( floatx80 a STATUS_PARAM ) static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM) { - int32 aExp, bExp, zExp; + int_fast32_t aExp, bExp, zExp; uint64_t aSig, bSig, zSig0, zSig1; - int32 expDiff; + int_fast32_t expDiff; aSig = extractFloatx80Frac( a ); aExp = extractFloatx80Exp( a ); @@ -4095,9 +4095,9 @@ static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM ) { - int32 aExp, bExp, zExp; + int_fast32_t aExp, bExp, zExp; uint64_t aSig, bSig, zSig0, zSig1; - int32 expDiff; + int_fast32_t expDiff; floatx80 z; aSig = extractFloatx80Frac( a ); @@ -4204,7 +4204,7 @@ floatx80 floatx80_sub( floatx80 a, floatx80 b STATUS_PARAM ) floatx80 floatx80_mul( floatx80 a, floatx80 b STATUS_PARAM ) { flag aSign, bSign, zSign; - int32 aExp, bExp, zExp; + int_fast32_t aExp, bExp, zExp; uint64_t aSig, bSig, zSig0, zSig1; floatx80 z; @@ -4263,7 +4263,7 @@ floatx80 floatx80_mul( floatx80 a, floatx80 b STATUS_PARAM ) floatx80 floatx80_div( floatx80 a, floatx80 b STATUS_PARAM ) { flag aSign, bSign, zSign; - int32 aExp, bExp, zExp; + int_fast32_t aExp, bExp, zExp; uint64_t aSig, bSig, zSig0, zSig1; uint64_t rem0, rem1, rem2, term0, term1, term2; floatx80 z; @@ -4343,7 +4343,7 @@ floatx80 floatx80_div( floatx80 a, floatx80 b STATUS_PARAM ) floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM ) { flag aSign, zSign; - int32 aExp, bExp, expDiff; + int_fast32_t aExp, bExp, expDiff; uint64_t aSig0, aSig1, bSig; uint64_t q, term0, term1, alternateASig0, alternateASig1; floatx80 z; @@ -4439,7 +4439,7 @@ floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM ) floatx80 floatx80_sqrt( floatx80 a STATUS_PARAM ) { flag aSign; - int32 aExp, zExp; + int_fast32_t aExp, zExp; uint64_t aSig0, aSig1, zSig0, zSig1, doubleZSig0; uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3; floatx80 z; @@ -4709,10 +4709,10 @@ int floatx80_lt_quiet( floatx80 a, floatx80 b STATUS_PARAM ) | largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int32 float128_to_int32( float128 a STATUS_PARAM ) +int_fast32_t float128_to_int32( float128 a STATUS_PARAM ) { flag aSign; - int32 aExp, shiftCount; + int_fast32_t aExp, shiftCount; uint64_t aSig0, aSig1; aSig1 = extractFloat128Frac1( a ); @@ -4738,12 +4738,12 @@ int32 float128_to_int32( float128 a STATUS_PARAM ) | returned. *----------------------------------------------------------------------------*/ -int32 float128_to_int32_round_to_zero( float128 a STATUS_PARAM ) +int_fast32_t float128_to_int32_round_to_zero( float128 a STATUS_PARAM ) { flag aSign; - int32 aExp, shiftCount; + int_fast32_t aExp, shiftCount; uint64_t aSig0, aSig1, savedASig; - int32 z; + int_fast32_t z; aSig1 = extractFloat128Frac1( a ); aSig0 = extractFloat128Frac0( a ); @@ -4789,7 +4789,7 @@ int32 float128_to_int32_round_to_zero( float128 a STATUS_PARAM ) int64 float128_to_int64( float128 a STATUS_PARAM ) { flag aSign; - int32 aExp, shiftCount; + int_fast32_t aExp, shiftCount; uint64_t aSig0, aSig1; aSig1 = extractFloat128Frac1( a ); @@ -4832,7 +4832,7 @@ int64 float128_to_int64( float128 a STATUS_PARAM ) int64 float128_to_int64_round_to_zero( float128 a STATUS_PARAM ) { flag aSign; - int32 aExp, shiftCount; + int_fast32_t aExp, shiftCount; uint64_t aSig0, aSig1; int64 z; @@ -4890,7 +4890,7 @@ int64 float128_to_int64_round_to_zero( float128 a STATUS_PARAM ) float32 float128_to_float32( float128 a STATUS_PARAM ) { flag aSign; - int32 aExp; + int_fast32_t aExp; uint64_t aSig0, aSig1; uint32_t zSig; @@ -4925,7 +4925,7 @@ float32 float128_to_float32( float128 a STATUS_PARAM ) float64 float128_to_float64( float128 a STATUS_PARAM ) { flag aSign; - int32 aExp; + int_fast32_t aExp; uint64_t aSig0, aSig1; aSig1 = extractFloat128Frac1( a ); @@ -4960,7 +4960,7 @@ float64 float128_to_float64( float128 a STATUS_PARAM ) floatx80 float128_to_floatx80( float128 a STATUS_PARAM ) { flag aSign; - int32 aExp; + int_fast32_t aExp; uint64_t aSig0, aSig1; aSig1 = extractFloat128Frac1( a ); @@ -4997,7 +4997,7 @@ floatx80 float128_to_floatx80( float128 a STATUS_PARAM ) float128 float128_round_to_int( float128 a STATUS_PARAM ) { flag aSign; - int32 aExp; + int_fast32_t aExp; uint64_t lastBitMask, roundBitsMask; int_fast8_t roundingMode; float128 z; @@ -5100,9 +5100,9 @@ float128 float128_round_to_int( float128 a STATUS_PARAM ) static float128 addFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM) { - int32 aExp, bExp, zExp; + int_fast32_t aExp, bExp, zExp; uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2; - int32 expDiff; + int_fast32_t expDiff; aSig1 = extractFloat128Frac1( a ); aSig0 = extractFloat128Frac0( a ); @@ -5181,9 +5181,9 @@ static float128 addFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM static float128 subFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM) { - int32 aExp, bExp, zExp; + int_fast32_t aExp, bExp, zExp; uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1; - int32 expDiff; + int_fast32_t expDiff; float128 z; aSig1 = extractFloat128Frac1( a ); @@ -5306,7 +5306,7 @@ float128 float128_sub( float128 a, float128 b STATUS_PARAM ) float128 float128_mul( float128 a, float128 b STATUS_PARAM ) { flag aSign, bSign, zSign; - int32 aExp, bExp, zExp; + int_fast32_t aExp, bExp, zExp; uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2, zSig3; float128 z; @@ -5370,7 +5370,7 @@ float128 float128_mul( float128 a, float128 b STATUS_PARAM ) float128 float128_div( float128 a, float128 b STATUS_PARAM ) { flag aSign, bSign, zSign; - int32 aExp, bExp, zExp; + int_fast32_t aExp, bExp, zExp; uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2; uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3; float128 z; @@ -5454,7 +5454,7 @@ float128 float128_div( float128 a, float128 b STATUS_PARAM ) float128 float128_rem( float128 a, float128 b STATUS_PARAM ) { flag aSign, zSign; - int32 aExp, bExp, expDiff; + int_fast32_t aExp, bExp, expDiff; uint64_t aSig0, aSig1, bSig0, bSig1, q, term0, term1, term2; uint64_t allZero, alternateASig0, alternateASig1, sigMean1; int64_t sigMean0; @@ -5563,7 +5563,7 @@ float128 float128_rem( float128 a, float128 b STATUS_PARAM ) float128 float128_sqrt( float128 a STATUS_PARAM ) { flag aSign; - int32 aExp, zExp; + int_fast32_t aExp, zExp; uint64_t aSig0, aSig1, zSig0, zSig1, zSig2, doubleZSig0; uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3; float128 z; @@ -6133,7 +6133,7 @@ floatx80 floatx80_scalbn( floatx80 a, int n STATUS_PARAM ) float128 float128_scalbn( float128 a, int n STATUS_PARAM ) { flag aSign; - int32 aExp; + int_fast32_t aExp; uint64_t aSig0, aSig1; aSig1 = extractFloat128Frac1( a ); diff --git a/fpu/softfloat.h b/fpu/softfloat.h index c599cc2..4c64d77 100644 --- a/fpu/softfloat.h +++ b/fpu/softfloat.h @@ -54,8 +54,6 @@ these four paragraphs for those parts of this code that are retained. | to the same as `int'. *----------------------------------------------------------------------------*/ typedef uint8_t flag; -typedef unsigned int uint32; -typedef signed int int32; typedef uint64_t uint64; typedef int64_t int64; @@ -234,15 +232,15 @@ void float_raise( int_fast8_t flags STATUS_PARAM); /*---------------------------------------------------------------------------- | Software IEC/IEEE integer-to-floating-point conversion routines. *----------------------------------------------------------------------------*/ -float32 int32_to_float32( int32 STATUS_PARAM ); -float64 int32_to_float64( int32 STATUS_PARAM ); +float32 int32_to_float32( int_fast32_t STATUS_PARAM ); +float64 int32_to_float64( int_fast32_t STATUS_PARAM ); float32 uint32_to_float32( unsigned int STATUS_PARAM ); float64 uint32_to_float64( unsigned int STATUS_PARAM ); #ifdef FLOATX80 -floatx80 int32_to_floatx80( int32 STATUS_PARAM ); +floatx80 int32_to_floatx80( int_fast32_t STATUS_PARAM ); #endif #ifdef FLOAT128 -float128 int32_to_float128( int32 STATUS_PARAM ); +float128 int32_to_float128( int_fast32_t STATUS_PARAM ); #endif float32 int64_to_float32( int64 STATUS_PARAM ); float32 uint64_to_float32( uint64 STATUS_PARAM ); @@ -284,10 +282,10 @@ float16 float16_maybe_silence_nan( float16 ); *----------------------------------------------------------------------------*/ int_fast16_t float32_to_int16_round_to_zero( float32 STATUS_PARAM ); uint_fast16_t float32_to_uint16_round_to_zero( float32 STATUS_PARAM ); -int32 float32_to_int32( float32 STATUS_PARAM ); -int32 float32_to_int32_round_to_zero( float32 STATUS_PARAM ); -uint32 float32_to_uint32( float32 STATUS_PARAM ); -uint32 float32_to_uint32_round_to_zero( float32 STATUS_PARAM ); +int_fast32_t float32_to_int32( float32 STATUS_PARAM ); +int_fast32_t float32_to_int32_round_to_zero( float32 STATUS_PARAM ); +uint_fast32_t float32_to_uint32( float32 STATUS_PARAM ); +uint_fast32_t float32_to_uint32_round_to_zero( float32 STATUS_PARAM ); int64 float32_to_int64( float32 STATUS_PARAM ); int64 float32_to_int64_round_to_zero( float32 STATUS_PARAM ); float64 float32_to_float64( float32 STATUS_PARAM ); @@ -394,10 +392,10 @@ INLINE float32 float32_set_sign(float32 a, int sign) *----------------------------------------------------------------------------*/ int_fast16_t float64_to_int16_round_to_zero( float64 STATUS_PARAM ); uint_fast16_t float64_to_uint16_round_to_zero( float64 STATUS_PARAM ); -int32 float64_to_int32( float64 STATUS_PARAM ); -int32 float64_to_int32_round_to_zero( float64 STATUS_PARAM ); -uint32 float64_to_uint32( float64 STATUS_PARAM ); -uint32 float64_to_uint32_round_to_zero( float64 STATUS_PARAM ); +int_fast32_t float64_to_int32( float64 STATUS_PARAM ); +int_fast32_t float64_to_int32_round_to_zero( float64 STATUS_PARAM ); +uint_fast32_t float64_to_uint32( float64 STATUS_PARAM ); +uint_fast32_t float64_to_uint32_round_to_zero( float64 STATUS_PARAM ); int64 float64_to_int64( float64 STATUS_PARAM ); int64 float64_to_int64_round_to_zero( float64 STATUS_PARAM ); uint64 float64_to_uint64 (float64 a STATUS_PARAM); @@ -501,8 +499,8 @@ INLINE float64 float64_set_sign(float64 a, int sign) /*---------------------------------------------------------------------------- | Software IEC/IEEE extended double-precision conversion routines. *----------------------------------------------------------------------------*/ -int32 floatx80_to_int32( floatx80 STATUS_PARAM ); -int32 floatx80_to_int32_round_to_zero( floatx80 STATUS_PARAM ); +int_fast32_t floatx80_to_int32( floatx80 STATUS_PARAM ); +int_fast32_t floatx80_to_int32_round_to_zero( floatx80 STATUS_PARAM ); int64 floatx80_to_int64( floatx80 STATUS_PARAM ); int64 floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM ); float32 floatx80_to_float32( floatx80 STATUS_PARAM ); @@ -584,8 +582,8 @@ INLINE int floatx80_is_any_nan(floatx80 a) /*---------------------------------------------------------------------------- | Software IEC/IEEE quadruple-precision conversion routines. *----------------------------------------------------------------------------*/ -int32 float128_to_int32( float128 STATUS_PARAM ); -int32 float128_to_int32_round_to_zero( float128 STATUS_PARAM ); +int_fast32_t float128_to_int32( float128 STATUS_PARAM ); +int_fast32_t float128_to_int32_round_to_zero( float128 STATUS_PARAM ); int64 float128_to_int64( float128 STATUS_PARAM ); int64 float128_to_int64_round_to_zero( float128 STATUS_PARAM ); float32 float128_to_float32( float128 STATUS_PARAM );
v5: * Initial. Cc: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Andreas Färber <andreas.faerber@web.de> --- fpu/softfloat.c | 132 +++++++++++++++++++++++++++--------------------------- fpu/softfloat.h | 34 +++++++-------- 2 files changed, 82 insertions(+), 84 deletions(-)