fpu: Replace int32 typedef with int32_t

Replace the int32 softfloat-specific typedef with int32_t.
This change was made with

find hw include fpu target-* -name '*.[ch]' | xargs sed -i -e 's/\bint32\b/int32_t/g'

together with manual removal of the typedef definition, and
manual undoing of some mis-hits where macro arguments were
being used for token pasting rather than as a type.

The uses in hw/ipmi/ should not have been using this type at all.

Backports commit f4014512cda682a9d0c75310d278d7ae96b0505c from qemu
This commit is contained in:
Peter Maydell 2018-02-19 00:22:39 -05:00 committed by Lioncash
parent df84f0d513
commit 9712d8a7ac
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
3 changed files with 74 additions and 75 deletions

View file

@ -144,7 +144,7 @@ static inline flag extractFloat16Sign(float16 a)
| positive or negative integer is returned.
*----------------------------------------------------------------------------*/
static int32 roundAndPackInt32( flag zSign, uint64_t absZ, float_status *status)
static int32_t roundAndPackInt32( flag zSign, uint64_t absZ, float_status *status)
{
int8 roundingMode;
flag roundNearestEven;
@ -685,7 +685,7 @@ static inline uint64_t extractFloatx80Frac( floatx80 a )
| value `a'.
*----------------------------------------------------------------------------*/
static inline int32 extractFloatx80Exp( floatx80 a )
static inline int32_t extractFloatx80Exp( floatx80 a )
{
return a.high & 0x7FFF;
@ -712,7 +712,7 @@ static inline flag extractFloatx80Sign( floatx80 a )
*----------------------------------------------------------------------------*/
static void
normalizeFloatx80Subnormal( uint64_t aSig, int32 *zExpPtr, uint64_t *zSigPtr )
normalizeFloatx80Subnormal( uint64_t aSig, int32_t *zExpPtr, uint64_t *zSigPtr )
{
int8 shiftCount;
@ -727,7 +727,7 @@ static void
| extended double-precision floating-point value, returning the result.
*----------------------------------------------------------------------------*/
static inline floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig )
static inline floatx80 packFloatx80( flag zSign, int32_t zExp, uint64_t zSig )
{
floatx80 z;
@ -763,7 +763,7 @@ static inline floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig )
static floatx80
roundAndPackFloatx80(
int8 roundingPrecision, flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1
int8 roundingPrecision, flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1
, float_status *status)
{
int8 roundingMode;
@ -950,7 +950,7 @@ static floatx80
static floatx80
normalizeRoundAndPackFloatx80(
int8 roundingPrecision, flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1
int8 roundingPrecision, flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1
, float_status *status)
{
int8 shiftCount;
@ -997,7 +997,7 @@ static inline uint64_t extractFloat128Frac0( float128 a )
| `a'.
*----------------------------------------------------------------------------*/
static inline int32 extractFloat128Exp( float128 a )
static inline int32_t extractFloat128Exp( float128 a )
{
return ( a.high>>48 ) & 0x7FFF;
@ -1029,7 +1029,7 @@ static void
normalizeFloat128Subnormal(
uint64_t aSig0,
uint64_t aSig1,
int32 *zExpPtr,
int32_t *zExpPtr,
uint64_t *zSig0Ptr,
uint64_t *zSig1Ptr
)
@ -1070,7 +1070,7 @@ static void
*----------------------------------------------------------------------------*/
static inline float128
packFloat128( flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 )
packFloat128( flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1 )
{
float128 z;
@ -1103,7 +1103,7 @@ static inline float128
static float128
roundAndPackFloat128(
flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2, float_status *status)
flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2, float_status *status)
{
int8 roundingMode;
flag roundNearestEven, increment, isTiny;
@ -1218,7 +1218,7 @@ static float128
static float128
normalizeRoundAndPackFloat128(
flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1, float_status *status)
flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1, float_status *status)
{
int8 shiftCount;
uint64_t zSig2;
@ -1409,7 +1409,7 @@ float128 int64_to_float128(int64_t a, float_status *status)
flag zSign;
uint64_t absA;
int8 shiftCount;
int32 zExp;
int32_t zExp;
uint64_t zSig0, zSig1;
if ( a == 0 ) return packFloat128( 0, 0, 0, 0 );
@ -1515,7 +1515,7 @@ float128 uint64_to_float128(uint64_t a, float_status *status)
| largest integer with the same sign as `a' is returned.
*----------------------------------------------------------------------------*/
int32 float32_to_int32( float32 a, float_status *status)
int32_t float32_to_int32( float32 a, float_status *status)
{
flag aSign;
int_fast16_t aExp, shiftCount;
@ -1546,7 +1546,7 @@ int32 float32_to_int32( float32 a, float_status *status)
| returned.
*----------------------------------------------------------------------------*/
int32 float32_to_int32_round_to_zero( float32 a, float_status *status)
int32_t float32_to_int32_round_to_zero( float32 a, float_status *status)
{
flag aSign;
int_fast16_t aExp, shiftCount;
@ -1594,7 +1594,7 @@ int_fast16_t float32_to_int16_round_to_zero(float32 a, float_status *status)
flag aSign;
int_fast16_t aExp, shiftCount;
uint32_t aSig;
int32 z;
int32_t z;
aSig = extractFloat32Frac( a );
aExp = extractFloat32Exp( a );
@ -3038,7 +3038,7 @@ int float32_unordered_quiet( float32 a, float32 b, float_status *status )
| largest integer with the same sign as `a' is returned.
*----------------------------------------------------------------------------*/
int32 float64_to_int32( float64 a, float_status *status )
int32_t float64_to_int32( float64 a, float_status *status )
{
flag aSign;
int_fast16_t aExp, shiftCount;
@ -3066,7 +3066,7 @@ int32 float64_to_int32( float64 a, float_status *status )
| returned.
*----------------------------------------------------------------------------*/
int32 float64_to_int32_round_to_zero( float64 a, float_status *status )
int32_t float64_to_int32_round_to_zero( float64 a, float_status *status )
{
flag aSign;
int_fast16_t aExp, shiftCount;
@ -3120,7 +3120,7 @@ int_fast16_t float64_to_int16_round_to_zero(float64 a, float_status *status)
flag aSign;
int_fast16_t aExp, shiftCount;
uint64_t aSig, savedASig;
int32 z;
int32_t z;
aSig = extractFloat64Frac( a );
aExp = extractFloat64Exp( a );
@ -3141,7 +3141,7 @@ int_fast16_t float64_to_int16_round_to_zero(float64 a, float_status *status)
shiftCount = 0x433 - aExp;
savedASig = aSig;
aSig >>= shiftCount;
z = (int32)aSig;
z = (int32_t)aSig;
if ( aSign ) {
z = - z;
}
@ -4751,10 +4751,10 @@ int float64_unordered_quiet( float64 a, float64 b, float_status *status )
| overflows, the largest integer with the same sign as `a' is returned.
*----------------------------------------------------------------------------*/
int32 floatx80_to_int32( floatx80 a, float_status *status )
int32_t floatx80_to_int32( floatx80 a, float_status *status )
{
flag aSign;
int32 aExp, shiftCount;
int32_t aExp, shiftCount;
uint64_t aSig;
if (floatx80_invalid_encoding(a)) {
@ -4782,10 +4782,10 @@ int32 floatx80_to_int32( floatx80 a, float_status *status )
| sign as `a' is returned.
*----------------------------------------------------------------------------*/
int32 floatx80_to_int32_round_to_zero( floatx80 a, float_status *status )
int32_t floatx80_to_int32_round_to_zero( floatx80 a, float_status *status )
{
flag aSign;
int32 aExp, shiftCount;
int32_t aExp, shiftCount;
uint64_t aSig, savedASig;
int32_t z;
@ -4836,7 +4836,7 @@ int32 floatx80_to_int32_round_to_zero( floatx80 a, float_status *status )
int64_t floatx80_to_int64( floatx80 a, float_status *status )
{
flag aSign;
int32 aExp, shiftCount;
int32_t aExp, shiftCount;
uint64_t aSig, aSigExtra;
if (floatx80_invalid_encoding(a)) {
@ -4880,7 +4880,7 @@ int64_t floatx80_to_int64( floatx80 a, float_status *status )
int64_t floatx80_to_int64_round_to_zero( floatx80 a, float_status *status )
{
flag aSign;
int32 aExp, shiftCount;
int32_t aExp, shiftCount;
uint64_t aSig;
int64_t z;
@ -4927,7 +4927,7 @@ int64_t floatx80_to_int64_round_to_zero( floatx80 a, float_status *status )
float32 floatx80_to_float32( floatx80 a, float_status *status )
{
flag aSign;
int32 aExp;
int32_t aExp;
uint64_t aSig;
if (floatx80_invalid_encoding(a)) {
@ -4959,7 +4959,7 @@ float32 floatx80_to_float32( floatx80 a, float_status *status )
float64 floatx80_to_float64( floatx80 a, float_status *status )
{
flag aSign;
int32 aExp;
int32_t aExp;
uint64_t aSig, zSig;
if (floatx80_invalid_encoding(a)) {
@ -5019,7 +5019,7 @@ float128 floatx80_to_float128( floatx80 a, float_status *status )
floatx80 floatx80_round_to_int( floatx80 a, float_status *status )
{
flag aSign;
int32 aExp;
int32_t aExp;
uint64_t lastBitMask, roundBitsMask;
floatx80 z;
@ -5117,9 +5117,9 @@ floatx80 floatx80_round_to_int( floatx80 a, float_status *status )
static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign, float_status *status)
{
int32 aExp, bExp, zExp;
int32_t aExp, bExp, zExp;
uint64_t aSig, bSig, zSig0, zSig1;
int32 expDiff;
int32_t expDiff;
aSig = extractFloatx80Frac( a );
aExp = extractFloatx80Exp( a );
@ -5185,9 +5185,9 @@ static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign, float_statu
static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign, float_status *status )
{
int32 aExp, bExp, zExp;
int32_t aExp, bExp, zExp;
uint64_t aSig, bSig, zSig0, zSig1;
int32 expDiff;
int32_t expDiff;
floatx80 z;
aSig = extractFloatx80Frac( a );
@ -5302,7 +5302,7 @@ floatx80 floatx80_sub( floatx80 a, floatx80 b, float_status *status )
floatx80 floatx80_mul( floatx80 a, floatx80 b, float_status *status )
{
flag aSign, bSign, zSign;
int32 aExp, bExp, zExp;
int32_t aExp, bExp, zExp;
uint64_t aSig, bSig, zSig0, zSig1;
floatx80 z;
@ -5365,7 +5365,7 @@ floatx80 floatx80_mul( floatx80 a, floatx80 b, float_status *status )
floatx80 floatx80_div( floatx80 a, floatx80 b, float_status *status )
{
flag aSign, bSign, zSign;
int32 aExp, bExp, zExp;
int32_t aExp, bExp, zExp;
uint64_t aSig, bSig, zSig0, zSig1;
uint64_t rem0, rem1, rem2, term0, term1, term2;
floatx80 z;
@ -5449,7 +5449,7 @@ floatx80 floatx80_div( floatx80 a, floatx80 b, float_status *status )
floatx80 floatx80_rem( floatx80 a, floatx80 b, float_status *status )
{
flag aSign, zSign;
int32 aExp, bExp, expDiff;
int32_t aExp, bExp, expDiff;
uint64_t aSig0, aSig1, bSig;
uint64_t q, term0, term1, alternateASig0, alternateASig1;
floatx80 z;
@ -5549,7 +5549,7 @@ floatx80 floatx80_rem( floatx80 a, floatx80 b, float_status *status )
floatx80 floatx80_sqrt( floatx80 a, float_status *status )
{
flag aSign;
int32 aExp, zExp;
int32_t aExp, zExp;
uint64_t aSig0, aSig1, zSig0, zSig1, doubleZSig0;
uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3;
floatx80 z;
@ -5881,10 +5881,10 @@ int floatx80_unordered_quiet( floatx80 a, floatx80 b, float_status *status )
| largest integer with the same sign as `a' is returned.
*----------------------------------------------------------------------------*/
int32 float128_to_int32( float128 a, float_status *status )
int32_t float128_to_int32( float128 a, float_status *status )
{
flag aSign;
int32 aExp, shiftCount;
int32_t aExp, shiftCount;
uint64_t aSig0, aSig1;
aSig1 = extractFloat128Frac1( a );
@ -5910,10 +5910,10 @@ int32 float128_to_int32( float128 a, float_status *status )
| returned.
*----------------------------------------------------------------------------*/
int32 float128_to_int32_round_to_zero( float128 a, float_status *status )
int32_t float128_to_int32_round_to_zero( float128 a, float_status *status )
{
flag aSign;
int32 aExp, shiftCount;
int32_t aExp, shiftCount;
uint64_t aSig0, aSig1, savedASig;
int32_t z;
@ -5961,7 +5961,7 @@ int32 float128_to_int32_round_to_zero( float128 a, float_status *status )
int64_t float128_to_int64( float128 a, float_status *status )
{
flag aSign;
int32 aExp, shiftCount;
int32_t aExp, shiftCount;
uint64_t aSig0, aSig1;
aSig1 = extractFloat128Frac1( a );
@ -6004,7 +6004,7 @@ int64_t float128_to_int64( float128 a, float_status *status )
int64_t float128_to_int64_round_to_zero( float128 a, float_status *status )
{
flag aSign;
int32 aExp, shiftCount;
int32_t aExp, shiftCount;
uint64_t aSig0, aSig1;
int64_t z;
@ -6062,7 +6062,7 @@ int64_t float128_to_int64_round_to_zero( float128 a, float_status *status )
float32 float128_to_float32( float128 a, float_status *status )
{
flag aSign;
int32 aExp;
int32_t aExp;
uint64_t aSig0, aSig1;
uint32_t zSig;
@ -6097,7 +6097,7 @@ float32 float128_to_float32( float128 a, float_status *status )
float64 float128_to_float64( float128 a, float_status *status )
{
flag aSign;
int32 aExp;
int32_t aExp;
uint64_t aSig0, aSig1;
aSig1 = extractFloat128Frac1( a );
@ -6130,7 +6130,7 @@ float64 float128_to_float64( float128 a, float_status *status )
floatx80 float128_to_floatx80( float128 a, float_status *status )
{
flag aSign;
int32 aExp;
int32_t aExp;
uint64_t aSig0, aSig1;
aSig1 = extractFloat128Frac1( a );
@ -6165,7 +6165,7 @@ floatx80 float128_to_floatx80( float128 a, float_status *status )
float128 float128_round_to_int( float128 a, float_status *status )
{
flag aSign;
int32 aExp;
int32_t aExp;
uint64_t lastBitMask, roundBitsMask;
float128 z;
@ -6303,9 +6303,9 @@ float128 float128_round_to_int( float128 a, float_status *status )
static float128 addFloat128Sigs( float128 a, float128 b, flag zSign, float_status *status)
{
int32 aExp, bExp, zExp;
int32_t aExp, bExp, zExp;
uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2;
int32 expDiff;
int32_t expDiff;
aSig1 = extractFloat128Frac1( a );
aSig0 = extractFloat128Frac0( a );
@ -6389,9 +6389,9 @@ static float128 addFloat128Sigs( float128 a, float128 b, flag zSign, float_statu
static float128 subFloat128Sigs( float128 a, float128 b, flag zSign, float_status *status)
{
int32 aExp, bExp, zExp;
int32_t aExp, bExp, zExp;
uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1;
int32 expDiff;
int32_t expDiff;
float128 z;
aSig1 = extractFloat128Frac1( a );
@ -6514,7 +6514,7 @@ float128 float128_sub( float128 a, float128 b, float_status *status )
float128 float128_mul( float128 a, float128 b, float_status *status )
{
flag aSign, bSign, zSign;
int32 aExp, bExp, zExp;
int32_t aExp, bExp, zExp;
uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2, zSig3;
float128 z;
@ -6578,7 +6578,7 @@ float128 float128_mul( float128 a, float128 b, float_status *status )
float128 float128_div( float128 a, float128 b, float_status *status )
{
flag aSign, bSign, zSign;
int32 aExp, bExp, zExp;
int32_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;
@ -6662,7 +6662,7 @@ float128 float128_div( float128 a, float128 b, float_status *status )
float128 float128_rem( float128 a, float128 b, float_status *status )
{
flag aSign, zSign;
int32 aExp, bExp, expDiff;
int32_t aExp, bExp, expDiff;
uint64_t aSig0, aSig1, bSig0, bSig1, q, term0, term1, term2;
uint64_t allZero, alternateASig0, alternateASig1, sigMean1;
int64_t sigMean0;
@ -6771,7 +6771,7 @@ float128 float128_rem( float128 a, float128 b, float_status *status )
float128 float128_sqrt( float128 a, float_status *status )
{
flag aSign;
int32 aExp, zExp;
int32_t aExp, zExp;
uint64_t aSig0, aSig1, zSig0, zSig1, zSig2, doubleZSig0;
uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3;
float128 z;

View file

@ -102,7 +102,6 @@ typedef uint8_t flag;
typedef uint8_t uint8;
typedef int8_t int8;
typedef unsigned int uint32;
typedef signed int int32;
#define LIT64( a ) a##LL
@ -378,8 +377,8 @@ int_fast16_t float32_to_int16(float32, float_status *status);
uint_fast16_t float32_to_uint16(float32, float_status *status);
int_fast16_t float32_to_int16_round_to_zero(float32, float_status *status);
uint_fast16_t float32_to_uint16_round_to_zero(float32, float_status *status);
int32 float32_to_int32( float32, float_status *status );
int32 float32_to_int32_round_to_zero( float32, float_status *status );
int32_t float32_to_int32( float32, float_status *status );
int32_t float32_to_int32_round_to_zero( float32, float_status *status );
uint32 float32_to_uint32( float32, float_status *status );
uint32 float32_to_uint32_round_to_zero( float32, float_status *status );
int64_t float32_to_int64( float32, float_status *status );
@ -490,8 +489,8 @@ int_fast16_t float64_to_int16(float64, float_status *status);
uint_fast16_t float64_to_uint16(float64, float_status *status);
int_fast16_t float64_to_int16_round_to_zero(float64, float_status *status);
uint_fast16_t float64_to_uint16_round_to_zero(float64, float_status *status);
int32 float64_to_int32( float64, float_status *status );
int32 float64_to_int32_round_to_zero( float64, float_status *status );
int32_t float64_to_int32( float64, float_status *status );
int32_t float64_to_int32_round_to_zero( float64, float_status *status );
uint32 float64_to_uint32( float64, float_status *status );
uint32 float64_to_uint32_round_to_zero( float64, float_status *status );
int64_t float64_to_int64( float64, float_status *status );
@ -598,8 +597,8 @@ extern const float64 float64_default_nan;
/*----------------------------------------------------------------------------
| Software IEC/IEEE extended double-precision conversion routines.
*----------------------------------------------------------------------------*/
int32 floatx80_to_int32( floatx80, float_status *status );
int32 floatx80_to_int32_round_to_zero( floatx80, float_status *status );
int32_t floatx80_to_int32( floatx80, float_status *status );
int32_t floatx80_to_int32_round_to_zero( floatx80, float_status *status );
int64_t floatx80_to_int64( floatx80, float_status *status );
int64_t floatx80_to_int64_round_to_zero( floatx80, float_status *status );
float32 floatx80_to_float32( floatx80, float_status *status );
@ -698,8 +697,8 @@ extern const floatx80 floatx80_default_nan;
/*----------------------------------------------------------------------------
| Software IEC/IEEE quadruple-precision conversion routines.
*----------------------------------------------------------------------------*/
int32 float128_to_int32( float128, float_status *status );
int32 float128_to_int32_round_to_zero( float128, float_status *status );
int32_t float128_to_int32( float128, float_status *status );
int32_t float128_to_int32_round_to_zero( float128, float_status *status );
int64_t float128_to_int64( float128, float_status *status );
int64_t float128_to_int64_round_to_zero( float128, float_status *status );
float32 float128_to_float32( float128, float_status *status );

View file

@ -1603,7 +1603,7 @@ static inline int get_enabled_exceptions(const CPUMIPSState *env, int c)
return c & enable;
}
static inline float16 float16_from_float32(int32 a, flag ieee, float_status *status)
static inline float16 float16_from_float32(int32_t a, flag ieee, float_status *status)
{
float16 f_val;
@ -1633,7 +1633,7 @@ static inline float32 float32_from_float16(int16_t a, flag ieee, float_status *s
return a < 0 ? (f_val | (1 << 31)) : f_val;
}
static inline float64 float64_from_float32(int32 a, float_status *status)
static inline float64 float64_from_float32(int32_t a, float_status *status)
{
float64 f_val;
@ -1654,7 +1654,7 @@ static inline float32 float32_from_q16(int16_t a, float_status *status)
return f_val;
}
static inline float64 float64_from_q32(int32 a, float_status *status)
static inline float64 float64_from_q32(int32_t a, float_status *status)
{
float64 f_val;
@ -1667,9 +1667,9 @@ static inline float64 float64_from_q32(int32 a, float_status *status)
static inline int16_t float32_to_q16(float32 a, float_status *status)
{
int32 q_val;
int32 q_min = 0xffff8000;
int32 q_max = 0x00007fff;
int32_t q_val;
int32_t q_min = 0xffff8000;
int32_t q_max = 0x00007fff;
int ieee_ex;
@ -1687,7 +1687,7 @@ static inline int16_t float32_to_q16(float32 a, float_status *status)
if (ieee_ex & float_flag_overflow) {
float_raise(float_flag_inexact, status);
return (int32)a < 0 ? q_min : q_max;
return (int32_t)a < 0 ? q_min : q_max;
}
/* conversion to int */
@ -1701,7 +1701,7 @@ static inline int16_t float32_to_q16(float32 a, float_status *status)
set_float_exception_flags(ieee_ex & (~float_flag_invalid)
, status);
float_raise(float_flag_overflow | float_flag_inexact, status);
return (int32)a < 0 ? q_min : q_max;
return (int32_t)a < 0 ? q_min : q_max;
}
if (q_val < q_min) {
@ -1717,7 +1717,7 @@ static inline int16_t float32_to_q16(float32 a, float_status *status)
return (int16_t)q_val;
}
static inline int32 float64_to_q32(float64 a, float_status *status)
static inline int32_t float64_to_q32(float64 a, float_status *status)
{
int64_t q_val;
int64_t q_min = 0xffffffff80000000LL;
@ -1758,15 +1758,15 @@ static inline int32 float64_to_q32(float64 a, float_status *status)
if (q_val < q_min) {
float_raise(float_flag_overflow | float_flag_inexact, status);
return (int32)q_min;
return (int32_t)q_min;
}
if (q_max < q_val) {
float_raise(float_flag_overflow | float_flag_inexact, status);
return (int32)q_max;
return (int32_t)q_max;
}
return (int32)q_val;
return (int32_t)q_val;
}
#define MSA_FLOAT_COND(DEST, OP, ARG1, ARG2, BITS, QUIET) \