From f42c222482b651400f0fa417eb174da1c9502c1c Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 22 Jan 2016 15:09:20 +0000 Subject: [PATCH 1/7] fpu: Replace int64 typedef with int64_t Replace the int64 softfloat-specific typedef with int64_t. This change was made with find include fpu target-* -name '*.[ch]' | xargs sed -i -e 's/\bint64\b/int64_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. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Aurelien Jarno Acked-by: Leon Alrae Message-id: 1452603315-27030-2-git-send-email-peter.maydell@linaro.org --- fpu/softfloat.c | 30 +++++++++++++++--------------- include/fpu/softfloat.h | 17 ++++++++--------- target-mips/msa_helper.c | 12 ++++++------ 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index f1170fe500..967da1c6a5 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -198,7 +198,7 @@ static int32 roundAndPackInt32(flag zSign, uint64_t absZ, float_status *status) | returned. *----------------------------------------------------------------------------*/ -static int64 roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1, +static int64_t roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1, float_status *status) { int8 roundingMode; @@ -255,7 +255,7 @@ static int64 roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1, | exception is raised and the largest unsigned integer is returned. *----------------------------------------------------------------------------*/ -static int64 roundAndPackUint64(flag zSign, uint64_t absZ0, +static int64_t roundAndPackUint64(flag zSign, uint64_t absZ0, uint64_t absZ1, float_status *status) { int8 roundingMode; @@ -784,7 +784,7 @@ static floatx80 roundAndPackFloatx80(int8 roundingPrecision, flag zSign, { int8 roundingMode; flag roundNearestEven, increment, isTiny; - int64 roundIncrement, roundMask, roundBits; + int64_t roundIncrement, roundMask, roundBits; roundingMode = status->float_rounding_mode; roundNearestEven = ( roundingMode == float_round_nearest_even ); @@ -1666,7 +1666,7 @@ int_fast16_t float32_to_int16_round_to_zero(float32 a, float_status *status) | largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int64 float32_to_int64(float32 a, float_status *status) +int64_t float32_to_int64(float32 a, float_status *status) { flag aSign; int_fast16_t aExp, shiftCount; @@ -1769,13 +1769,13 @@ uint64 float32_to_uint64_round_to_zero(float32 a, float_status *status) | returned. *----------------------------------------------------------------------------*/ -int64 float32_to_int64_round_to_zero(float32 a, float_status *status) +int64_t float32_to_int64_round_to_zero(float32 a, float_status *status) { flag aSign; int_fast16_t aExp, shiftCount; uint32_t aSig; uint64_t aSig64; - int64 z; + int64_t z; a = float32_squash_input_denormal(a, status); aSig = extractFloat32Frac( a ); @@ -3201,7 +3201,7 @@ int_fast16_t float64_to_int16_round_to_zero(float64 a, float_status *status) | largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int64 float64_to_int64(float64 a, float_status *status) +int64_t float64_to_int64(float64 a, float_status *status) { flag aSign; int_fast16_t aExp, shiftCount; @@ -3244,12 +3244,12 @@ int64 float64_to_int64(float64 a, float_status *status) | returned. *----------------------------------------------------------------------------*/ -int64 float64_to_int64_round_to_zero(float64 a, float_status *status) +int64_t float64_to_int64_round_to_zero(float64 a, float_status *status) { flag aSign; int_fast16_t aExp, shiftCount; uint64_t aSig; - int64 z; + int64_t z; a = float64_squash_input_denormal(a, status); aSig = extractFloat64Frac( a ); @@ -4864,7 +4864,7 @@ int32 floatx80_to_int32_round_to_zero(floatx80 a, float_status *status) | overflows, the largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int64 floatx80_to_int64(floatx80 a, float_status *status) +int64_t floatx80_to_int64(floatx80 a, float_status *status) { flag aSign; int32 aExp, shiftCount; @@ -4904,12 +4904,12 @@ int64 floatx80_to_int64(floatx80 a, float_status *status) | sign as `a' is returned. *----------------------------------------------------------------------------*/ -int64 floatx80_to_int64_round_to_zero(floatx80 a, float_status *status) +int64_t floatx80_to_int64_round_to_zero(floatx80 a, float_status *status) { flag aSign; int32 aExp, shiftCount; uint64_t aSig; - int64 z; + int64_t z; aSig = extractFloatx80Frac( a ); aExp = extractFloatx80Exp( a ); @@ -5933,7 +5933,7 @@ int32 float128_to_int32_round_to_zero(float128 a, float_status *status) | largest integer with the same sign as `a' is returned. *----------------------------------------------------------------------------*/ -int64 float128_to_int64(float128 a, float_status *status) +int64_t float128_to_int64(float128 a, float_status *status) { flag aSign; int32 aExp, shiftCount; @@ -5976,12 +5976,12 @@ int64 float128_to_int64(float128 a, float_status *status) | returned. *----------------------------------------------------------------------------*/ -int64 float128_to_int64_round_to_zero(float128 a, float_status *status) +int64_t float128_to_int64_round_to_zero(float128 a, float_status *status) { flag aSign; int32 aExp, shiftCount; uint64_t aSig0, aSig1; - int64 z; + int64_t z; aSig1 = extractFloat128Frac1( a ); aSig0 = extractFloat128Frac0( a ); diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index ded34eb000..b49d5fbf5c 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -104,7 +104,6 @@ typedef int8_t int8; typedef unsigned int uint32; typedef signed int int32; typedef uint64_t uint64; -typedef int64_t int64; #define LIT64( a ) a##LL @@ -380,10 +379,10 @@ int32 float32_to_int32(float32, float_status *status); int32 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 float32_to_int64(float32, float_status *status); +int64_t float32_to_int64(float32, float_status *status); uint64 float32_to_uint64(float32, float_status *status); uint64 float32_to_uint64_round_to_zero(float32, float_status *status); -int64 float32_to_int64_round_to_zero(float32, float_status *status); +int64_t float32_to_int64_round_to_zero(float32, float_status *status); float64 float32_to_float64(float32, float_status *status); floatx80 float32_to_floatx80(float32, float_status *status); float128 float32_to_float128(float32, float_status *status); @@ -492,8 +491,8 @@ int32 float64_to_int32(float64, float_status *status); int32 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 float64_to_int64(float64, float_status *status); -int64 float64_to_int64_round_to_zero(float64, float_status *status); +int64_t float64_to_int64(float64, float_status *status); +int64_t float64_to_int64_round_to_zero(float64, float_status *status); uint64 float64_to_uint64(float64 a, float_status *status); uint64 float64_to_uint64_round_to_zero(float64 a, float_status *status); float32 float64_to_float32(float64, float_status *status); @@ -598,8 +597,8 @@ extern const float64 float64_default_nan; *----------------------------------------------------------------------------*/ int32 floatx80_to_int32(floatx80, float_status *status); int32 floatx80_to_int32_round_to_zero(floatx80, float_status *status); -int64 floatx80_to_int64(floatx80, float_status *status); -int64 floatx80_to_int64_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); float64 floatx80_to_float64(floatx80, float_status *status); float128 floatx80_to_float128(floatx80, float_status *status); @@ -683,8 +682,8 @@ extern const floatx80 floatx80_default_nan; *----------------------------------------------------------------------------*/ int32 float128_to_int32(float128, float_status *status); int32 float128_to_int32_round_to_zero(float128, float_status *status); -int64 float128_to_int64(float128, float_status *status); -int64 float128_to_int64_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); float64 float128_to_float64(float128, float_status *status); floatx80 float128_to_floatx80(float128, float_status *status); diff --git a/target-mips/msa_helper.c b/target-mips/msa_helper.c index 5dd3da67a8..b42b23f750 100644 --- a/target-mips/msa_helper.c +++ b/target-mips/msa_helper.c @@ -1615,7 +1615,7 @@ static inline float16 float16_from_float32(int32 a, flag ieee, return a < 0 ? (f_val | (1 << 15)) : f_val; } -static inline float32 float32_from_float64(int64 a, float_status *status) +static inline float32 float32_from_float64(int64_t a, float_status *status) { float32 f_val; @@ -1722,9 +1722,9 @@ static inline int16_t float32_to_q16(float32 a, float_status *status) static inline int32 float64_to_q32(float64 a, float_status *status) { - int64 q_val; - int64 q_min = 0xffffffff80000000LL; - int64 q_max = 0x000000007fffffffLL; + int64_t q_val; + int64_t q_min = 0xffffffff80000000LL; + int64_t q_max = 0x000000007fffffffLL; int ieee_ex; @@ -1742,7 +1742,7 @@ static inline int32 float64_to_q32(float64 a, float_status *status) if (ieee_ex & float_flag_overflow) { float_raise(float_flag_inexact, status); - return (int64)a < 0 ? q_min : q_max; + return (int64_t)a < 0 ? q_min : q_max; } /* conversion to integer */ @@ -1756,7 +1756,7 @@ static inline int32 float64_to_q32(float64 a, float_status *status) set_float_exception_flags(ieee_ex & (~float_flag_invalid) , status); float_raise(float_flag_overflow | float_flag_inexact, status); - return (int64)a < 0 ? q_min : q_max; + return (int64_t)a < 0 ? q_min : q_max; } if (q_val < q_min) { From 182f42fdc219e6481654fcfb73b17e4b4e63b6ff Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 22 Jan 2016 15:09:20 +0000 Subject: [PATCH 2/7] fpu: Replace uint64 typedef with uint64_t Replace the uint64 softfloat-specific typedef with uint64_t. This change was made with find include fpu target-* -name '*.[ch]' | xargs sed -i -e 's/\buint64\b/uint64_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. Note that the target-mips/kvm.c and target-s390x/kvm.c changes are fixing code that should not have been using the uint64 type in the first place. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Aurelien Jarno Acked-by: Leon Alrae Acked-by: James Hogan Message-id: 1452603315-27030-3-git-send-email-peter.maydell@linaro.org --- fpu/softfloat.c | 10 +++++----- include/fpu/softfloat.h | 9 ++++----- target-alpha/fpu_helper.c | 2 +- target-mips/kvm.c | 4 ++-- target-s390x/kvm.c | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 967da1c6a5..c72eb5b2b0 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1363,7 +1363,7 @@ float128 int32_to_float128(int32_t a, float_status *status) float32 int64_to_float32(int64_t a, float_status *status) { flag zSign; - uint64 absA; + uint64_t absA; int8 shiftCount; if ( a == 0 ) return float32_zero; @@ -1414,7 +1414,7 @@ float64 int64_to_float64(int64_t a, float_status *status) floatx80 int64_to_floatx80(int64_t a, float_status *status) { flag zSign; - uint64 absA; + uint64_t absA; int8 shiftCount; if ( a == 0 ) return packFloatx80( 0, 0, 0 ); @@ -1434,7 +1434,7 @@ floatx80 int64_to_floatx80(int64_t a, float_status *status) float128 int64_to_float128(int64_t a, float_status *status) { flag zSign; - uint64 absA; + uint64_t absA; int8 shiftCount; int32 zExp; uint64_t zSig0, zSig1; @@ -1705,7 +1705,7 @@ int64_t float32_to_int64(float32 a, float_status *status) | raise the inexact exception flag. *----------------------------------------------------------------------------*/ -uint64 float32_to_uint64(float32 a, float_status *status) +uint64_t float32_to_uint64(float32 a, float_status *status) { flag aSign; int_fast16_t aExp, shiftCount; @@ -1750,7 +1750,7 @@ uint64 float32_to_uint64(float32 a, float_status *status) | not round to zero will raise the inexact flag. *----------------------------------------------------------------------------*/ -uint64 float32_to_uint64_round_to_zero(float32 a, float_status *status) +uint64_t float32_to_uint64_round_to_zero(float32 a, float_status *status) { signed char current_rounding_mode = status->float_rounding_mode; set_float_rounding_mode(float_round_to_zero, status); diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index b49d5fbf5c..438804ee5c 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -103,7 +103,6 @@ typedef uint8_t uint8; typedef int8_t int8; typedef unsigned int uint32; typedef signed int int32; -typedef uint64_t uint64; #define LIT64( a ) a##LL @@ -380,8 +379,8 @@ int32 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); -uint64 float32_to_uint64(float32, float_status *status); -uint64 float32_to_uint64_round_to_zero(float32, float_status *status); +uint64_t float32_to_uint64(float32, float_status *status); +uint64_t float32_to_uint64_round_to_zero(float32, float_status *status); int64_t float32_to_int64_round_to_zero(float32, float_status *status); float64 float32_to_float64(float32, float_status *status); floatx80 float32_to_floatx80(float32, float_status *status); @@ -493,8 +492,8 @@ 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); int64_t float64_to_int64_round_to_zero(float64, float_status *status); -uint64 float64_to_uint64(float64 a, float_status *status); -uint64 float64_to_uint64_round_to_zero(float64 a, float_status *status); +uint64_t float64_to_uint64(float64 a, float_status *status); +uint64_t float64_to_uint64_round_to_zero(float64 a, float_status *status); float32 float64_to_float32(float64, float_status *status); floatx80 float64_to_floatx80(float64, float_status *status); float128 float64_to_float128(float64, float_status *status); diff --git a/target-alpha/fpu_helper.c b/target-alpha/fpu_helper.c index b091aa842a..0c65e1f6e1 100644 --- a/target-alpha/fpu_helper.c +++ b/target-alpha/fpu_helper.c @@ -437,7 +437,7 @@ uint64_t helper_cvtqs(CPUAlphaState *env, uint64_t a) return float32_to_s(fr); } -/* Implement float64 to uint64 conversion without saturation -- we must +/* Implement float64 to uint64_t conversion without saturation -- we must supply the truncated result. This behaviour is used by the compiler to get unsigned conversion for free with the same instruction. */ diff --git a/target-mips/kvm.c b/target-mips/kvm.c index 12d7db311e..ffc120d716 100644 --- a/target-mips/kvm.c +++ b/target-mips/kvm.c @@ -277,7 +277,7 @@ static inline int kvm_mips_get_one_reg(CPUState *cs, uint64_t reg_id, return kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &cp0reg); } -static inline int kvm_mips_get_one_ulreg(CPUState *cs, uint64 reg_id, +static inline int kvm_mips_get_one_ulreg(CPUState *cs, uint64_t reg_id, target_ulong *addr) { int ret; @@ -294,7 +294,7 @@ static inline int kvm_mips_get_one_ulreg(CPUState *cs, uint64 reg_id, return ret; } -static inline int kvm_mips_get_one_reg64(CPUState *cs, uint64 reg_id, +static inline int kvm_mips_get_one_reg64(CPUState *cs, uint64_t reg_id, uint64_t *addr) { struct kvm_one_reg cp0reg = { diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 75a0e5d1c3..b8222ccd17 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -1433,7 +1433,7 @@ static int kvm_s390_store_status(S390CPU *cpu, hwaddr addr, bool store_arch) cpu_physical_memory_write(offsetof(LowCore, ar_access_id), &ar_id, 1); } for (i = 0; i < 16; ++i) { - *((uint64 *)mem + i) = get_freg(&cpu->env, i)->ll; + *((uint64_t *)mem + i) = get_freg(&cpu->env, i)->ll; } memcpy(mem + 128, &cpu->env.regs, 128); memcpy(mem + 256, &cpu->env.psw, 16); From f4014512cda682a9d0c75310d278d7ae96b0505c Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 22 Jan 2016 15:09:21 +0000 Subject: [PATCH 3/7] 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. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Aurelien Jarno Acked-by: Leon Alrae Acked-by: James Hogan Message-id: 1452603315-27030-4-git-send-email-peter.maydell@linaro.org --- fpu/softfloat.c | 106 +++++++++++++++++++-------------------- hw/ipmi/isa_ipmi_bt.c | 2 +- hw/ipmi/isa_ipmi_kcs.c | 2 +- include/fpu/softfloat.h | 18 +++---- target-mips/msa_helper.c | 24 ++++----- 5 files changed, 76 insertions(+), 76 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index c72eb5b2b0..af3f82ecdf 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -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; @@ -702,7 +702,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; @@ -729,7 +729,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; @@ -744,7 +744,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; @@ -779,7 +779,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, + int32_t zExp, uint64_t zSig0, uint64_t zSig1, float_status *status) { int8 roundingMode; @@ -975,7 +975,7 @@ static floatx80 roundAndPackFloatx80(int8 roundingPrecision, flag zSign, *----------------------------------------------------------------------------*/ static floatx80 normalizeRoundAndPackFloatx80(int8 roundingPrecision, - flag zSign, int32 zExp, + flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1, float_status *status) { @@ -1023,7 +1023,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; @@ -1055,7 +1055,7 @@ static void normalizeFloat128Subnormal( uint64_t aSig0, uint64_t aSig1, - int32 *zExpPtr, + int32_t *zExpPtr, uint64_t *zSig0Ptr, uint64_t *zSig1Ptr ) @@ -1096,7 +1096,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; @@ -1127,7 +1127,7 @@ static inline float128 | overflow follows the IEC/IEEE Standard for Binary Floating-Point Arithmetic. *----------------------------------------------------------------------------*/ -static float128 roundAndPackFloat128(flag zSign, int32 zExp, +static float128 roundAndPackFloat128(flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2, float_status *status) { @@ -1245,7 +1245,7 @@ static float128 roundAndPackFloat128(flag zSign, int32 zExp, | point exponent. *----------------------------------------------------------------------------*/ -static float128 normalizeRoundAndPackFloat128(flag zSign, int32 zExp, +static float128 normalizeRoundAndPackFloat128(flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1, float_status *status) { @@ -1436,7 +1436,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 ); @@ -1541,7 +1541,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; @@ -1572,7 +1572,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; @@ -1622,7 +1622,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 ); @@ -3073,7 +3073,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; @@ -3101,7 +3101,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; @@ -3155,7 +3155,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 ); @@ -4790,10 +4790,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; aSig = extractFloatx80Frac( a ); @@ -4817,10 +4817,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; @@ -4867,7 +4867,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; aSig = extractFloatx80Frac( a ); @@ -4907,7 +4907,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; @@ -4950,7 +4950,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; aSig = extractFloatx80Frac( a ); @@ -4978,7 +4978,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; aSig = extractFloatx80Frac( a ); @@ -5030,7 +5030,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; @@ -5125,9 +5125,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 ); @@ -5194,9 +5194,9 @@ static floatx80 addFloatx80Sigs(floatx80 a, floatx80 b, flag zSign, 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 ); @@ -5305,7 +5305,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; @@ -5364,7 +5364,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; @@ -5448,7 +5448,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; @@ -5546,7 +5546,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; @@ -5854,10 +5854,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 ); @@ -5883,10 +5883,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; @@ -5936,7 +5936,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 ); @@ -5979,7 +5979,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; @@ -6039,7 +6039,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; @@ -6074,7 +6074,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 ); @@ -6107,7 +6107,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 ); @@ -6142,7 +6142,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; @@ -6281,9 +6281,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 ); @@ -6372,9 +6372,9 @@ static float128 addFloat128Sigs(float128 a, float128 b, flag zSign, 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 ); @@ -6503,7 +6503,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; @@ -6569,7 +6569,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; @@ -6659,7 +6659,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; @@ -6769,7 +6769,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; diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c index 21fa4a7851..ce1b78a5a6 100644 --- a/hw/ipmi/isa_ipmi_bt.c +++ b/hw/ipmi/isa_ipmi_bt.c @@ -405,7 +405,7 @@ static void ipmi_bt_class_init(IPMIInterfaceClass *iic) typedef struct ISAIPMIBTDevice { ISADevice dev; - int32 isairq; + int32_t isairq; IPMIBT bt; IPMIFwInfo fwinfo; } ISAIPMIBTDevice; diff --git a/hw/ipmi/isa_ipmi_kcs.c b/hw/ipmi/isa_ipmi_kcs.c index c662aeec55..daa70c3cac 100644 --- a/hw/ipmi/isa_ipmi_kcs.c +++ b/hw/ipmi/isa_ipmi_kcs.c @@ -368,7 +368,7 @@ static void ipmi_kcs_class_init(IPMIInterfaceClass *iic) typedef struct ISAIPMIKCSDevice { ISADevice dev; - int32 isairq; + int32_t isairq; IPMIKCS kcs; IPMIFwInfo fwinfo; } ISAIPMIKCSDevice; diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 438804ee5c..c61f836ebe 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -102,7 +102,7 @@ typedef uint8_t flag; typedef uint8_t uint8; typedef int8_t int8; typedef unsigned int uint32; -typedef signed int int32; +typedef signed int int32_t; #define LIT64( a ) a##LL @@ -374,8 +374,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); @@ -486,8 +486,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); @@ -594,8 +594,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); @@ -679,8 +679,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); diff --git a/target-mips/msa_helper.c b/target-mips/msa_helper.c index b42b23f750..b8e2917e5e 100644 --- a/target-mips/msa_helper.c +++ b/target-mips/msa_helper.c @@ -1604,7 +1604,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, +static inline float16 float16_from_float32(int32_t a, flag ieee, float_status *status) { float16 f_val; @@ -1636,7 +1636,7 @@ static inline float32 float32_from_float16(int16_t a, flag ieee, 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; @@ -1657,7 +1657,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; @@ -1670,9 +1670,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; @@ -1690,7 +1690,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 */ @@ -1704,7 +1704,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) { @@ -1720,7 +1720,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; @@ -1761,15 +1761,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) \ From 3a87d00910ef64a2eece4aad25d96ea10683fc5c Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 22 Jan 2016 15:09:21 +0000 Subject: [PATCH 4/7] fpu: Replace uint32 typedef with uint32_t Replace the uint32 softfloat-specific typedef with uint32_t. This change was made with find include hw fpu target-* -name '*.[ch]' | xargs sed -i -e 's/\buint32\b/uint32_t/g' together with manual removal of the typedef definition, manual undoing of various mis-hits, and another couple of fixes found via test compilation. All the uses in hw/ were using the wrong type by mistake. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Aurelien Jarno Acked-by: Leon Alrae Acked-by: James Hogan Message-id: 1452603315-27030-5-git-send-email-peter.maydell@linaro.org --- fpu/softfloat.c | 22 +++++++++++----------- hw/i386/pc.c | 2 +- hw/misc/imx25_ccm.c | 2 +- hw/misc/imx31_ccm.c | 2 +- hw/net/vmxnet3.c | 2 +- hw/ppc/spapr_events.c | 4 ++-- include/fpu/softfloat.h | 10 ++++------ include/hw/i386/pc.h | 2 +- tests/vhost-user-test.c | 2 +- 9 files changed, 23 insertions(+), 25 deletions(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index af3f82ecdf..4ee98c4e81 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -1296,7 +1296,7 @@ float32 int32_to_float32(int32_t a, float_status *status) float64 int32_to_float64(int32_t a, float_status *status) { flag zSign; - uint32 absA; + uint32_t absA; int8 shiftCount; uint64_t zSig; @@ -1319,7 +1319,7 @@ float64 int32_to_float64(int32_t a, float_status *status) floatx80 int32_to_floatx80(int32_t a, float_status *status) { flag zSign; - uint32 absA; + uint32_t absA; int8 shiftCount; uint64_t zSig; @@ -1341,7 +1341,7 @@ floatx80 int32_to_floatx80(int32_t a, float_status *status) float128 int32_to_float128(int32_t a, float_status *status) { flag zSign; - uint32 absA; + uint32_t absA; int8 shiftCount; uint64_t zSig0; @@ -7080,10 +7080,10 @@ float64 uint32_to_float64(uint32_t a, float_status *status) return int64_to_float64(a, status); } -uint32 float32_to_uint32(float32 a, float_status *status) +uint32_t float32_to_uint32(float32 a, float_status *status) { int64_t v; - uint32 res; + uint32_t res; int old_exc_flags = get_float_exception_flags(status); v = float32_to_int64(a, status); @@ -7099,10 +7099,10 @@ uint32 float32_to_uint32(float32 a, float_status *status) return res; } -uint32 float32_to_uint32_round_to_zero(float32 a, float_status *status) +uint32_t float32_to_uint32_round_to_zero(float32 a, float_status *status) { int64_t v; - uint32 res; + uint32_t res; int old_exc_flags = get_float_exception_flags(status); v = float32_to_int64_round_to_zero(a, status); @@ -7177,10 +7177,10 @@ uint_fast16_t float32_to_uint16_round_to_zero(float32 a, float_status *status) return res; } -uint32 float64_to_uint32(float64 a, float_status *status) +uint32_t float64_to_uint32(float64 a, float_status *status) { uint64_t v; - uint32 res; + uint32_t res; int old_exc_flags = get_float_exception_flags(status); v = float64_to_uint64(a, status); @@ -7194,10 +7194,10 @@ uint32 float64_to_uint32(float64 a, float_status *status) return res; } -uint32 float64_to_uint32_round_to_zero(float64 a, float_status *status) +uint32_t float64_to_uint32_round_to_zero(float64 a, float_status *status) { uint64_t v; - uint32 res; + uint32_t res; int old_exc_flags = get_float_exception_flags(status); v = float64_to_uint64_round_to_zero(a, status); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 293e22a7e1..838636cfba 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1454,7 +1454,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state, bool create_fdctrl, bool no_vmport, - uint32 hpet_irqs) + uint32_t hpet_irqs) { int i; DriveInfo *fd[MAX_FD]; diff --git a/hw/misc/imx25_ccm.c b/hw/misc/imx25_ccm.c index 23759ca648..90752fd7a1 100644 --- a/hw/misc/imx25_ccm.c +++ b/hw/misc/imx25_ccm.c @@ -249,7 +249,7 @@ static void imx25_ccm_reset(DeviceState *dev) static uint64_t imx25_ccm_read(void *opaque, hwaddr offset, unsigned size) { - uint32 value = 0; + uint32_t value = 0; IMX25CCMState *s = (IMX25CCMState *)opaque; if (offset < 0x70) { diff --git a/hw/misc/imx31_ccm.c b/hw/misc/imx31_ccm.c index 47d6ead5ad..c47b96f2ac 100644 --- a/hw/misc/imx31_ccm.c +++ b/hw/misc/imx31_ccm.c @@ -261,7 +261,7 @@ static void imx31_ccm_reset(DeviceState *dev) static uint64_t imx31_ccm_read(void *opaque, hwaddr offset, unsigned size) { - uint32 value = 0; + uint32_t value = 0; IMX31CCMState *s = (IMX31CCMState *)opaque; if ((offset >> 2) < IMX31_CCM_MAX_REG) { diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 67abad3598..5147f05bd2 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -522,7 +522,7 @@ vmxnet3_dec_rx_completion_counter(VMXNET3State *s, int qidx) vmxnet3_ring_dec(&s->rxq_descr[qidx].comp_ring); } -static void vmxnet3_complete_packet(VMXNET3State *s, int qidx, uint32 tx_ridx) +static void vmxnet3_complete_packet(VMXNET3State *s, int qidx, uint32_t tx_ridx) { struct Vmxnet3_TxCompDesc txcq_descr; diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c index 744ea62ac0..333e6ff27b 100644 --- a/hw/ppc/spapr_events.c +++ b/hw/ppc/spapr_events.c @@ -459,7 +459,7 @@ void spapr_hotplug_req_add_by_index(sPAPRDRConnector *drc) { sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); sPAPRDRConnectorType drc_type = drck->get_type(drc); - uint32 index = drck->get_index(drc); + uint32_t index = drck->get_index(drc); spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_INDEX, RTAS_LOG_V6_HP_ACTION_ADD, drc_type, index); @@ -469,7 +469,7 @@ void spapr_hotplug_req_remove_by_index(sPAPRDRConnector *drc) { sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); sPAPRDRConnectorType drc_type = drck->get_type(drc); - uint32 index = drck->get_index(drc); + uint32_t index = drck->get_index(drc); spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_INDEX, RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, index); diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index c61f836ebe..bee849e0a7 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -101,8 +101,6 @@ this code that are retained. typedef uint8_t flag; typedef uint8_t uint8; typedef int8_t int8; -typedef unsigned int uint32; -typedef signed int int32_t; #define LIT64( a ) a##LL @@ -376,8 +374,8 @@ 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_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); +uint32_t float32_to_uint32(float32, float_status *status); +uint32_t float32_to_uint32_round_to_zero(float32, float_status *status); int64_t float32_to_int64(float32, float_status *status); uint64_t float32_to_uint64(float32, float_status *status); uint64_t float32_to_uint64_round_to_zero(float32, float_status *status); @@ -488,8 +486,8 @@ 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_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); +uint32_t float64_to_uint32(float64, float_status *status); +uint32_t float64_to_uint32_round_to_zero(float64, float_status *status); int64_t float64_to_int64(float64, float_status *status); int64_t float64_to_int64_round_to_zero(float64, float_status *status); uint64_t float64_to_uint64(float64 a, float_status *status); diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 5bac03d975..65e8f245a8 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -258,7 +258,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state, bool create_fdctrl, bool no_vmport, - uint32 hpet_irqs); + uint32_t hpet_irqs); void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd); void pc_cmos_init(PCMachineState *pcms, BusState *ide0, BusState *ide1, diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 991fd85c7c..95f35af3e5 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -439,7 +439,7 @@ static void wait_for_log_fd(TestServer *s) g_mutex_unlock(&s->data_mutex); } -static void write_guest_mem(TestServer *s, uint32 seed) +static void write_guest_mem(TestServer *s, uint32_t seed) { uint32_t *guest_mem; int i, j; From 8f506c709adb7d3bed4ebefefe9487c156192a64 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 22 Jan 2016 15:09:21 +0000 Subject: [PATCH 5/7] fpu: Replace int8 typedef with int8_t Replace the int8 softfloat-specific typedef with int8_t. This change was made with find include hw fpu target-* -name '*.[ch]' | xargs sed -i -e 's/\bint8\b/int8_t/g' together with manual removal of the typedef definition, and manual undoing of various mis-hits. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Aurelien Jarno Acked-by: Leon Alrae Acked-by: James Hogan Message-id: 1452603315-27030-6-git-send-email-peter.maydell@linaro.org --- fpu/softfloat-macros.h | 26 ++++++++++---------- fpu/softfloat-specialize.h | 2 +- fpu/softfloat.c | 50 +++++++++++++++++++------------------- include/fpu/softfloat.h | 3 +-- 4 files changed, 40 insertions(+), 41 deletions(-) diff --git a/fpu/softfloat-macros.h b/fpu/softfloat-macros.h index 5e030cd8e5..e95b4450fa 100644 --- a/fpu/softfloat-macros.h +++ b/fpu/softfloat-macros.h @@ -164,7 +164,7 @@ static inline void uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr) { uint64_t z0, z1; - int8 negCount = ( - count ) & 63; + int8_t negCount = ( - count ) & 63; if ( count == 0 ) { z1 = a1; @@ -201,7 +201,7 @@ static inline void uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr) { uint64_t z0, z1; - int8 negCount = ( - count ) & 63; + int8_t negCount = ( - count ) & 63; if ( count == 0 ) { z1 = a1; @@ -236,7 +236,7 @@ static inline void uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr) { uint64_t z0, z1; - int8 negCount = ( - count ) & 63; + int8_t negCount = ( - count ) & 63; if ( count == 0 ) { z1 = a1; @@ -294,7 +294,7 @@ static inline void ) { uint64_t z0, z1, z2; - int8 negCount = ( - count ) & 63; + int8_t negCount = ( - count ) & 63; if ( count == 0 ) { z2 = a2; @@ -371,7 +371,7 @@ static inline void ) { uint64_t z0, z1, z2; - int8 negCount; + int8_t negCount; z2 = a2<>27 ) & 15; @@ -669,7 +669,7 @@ static uint32_t estimateSqrt32(int_fast16_t aExp, uint32_t a) | `a'. If `a' is zero, 32 is returned. *----------------------------------------------------------------------------*/ -static int8 countLeadingZeros32( uint32_t a ) +static int8_t countLeadingZeros32( uint32_t a ) { #if SOFTFLOAT_GNUC_PREREQ(3, 4) if (a) { @@ -678,7 +678,7 @@ static int8 countLeadingZeros32( uint32_t a ) return 32; } #else - static const int8 countLeadingZerosHigh[] = { + static const int8_t countLeadingZerosHigh[] = { 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -696,7 +696,7 @@ static int8 countLeadingZeros32( uint32_t a ) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int8 shiftCount; + int8_t shiftCount; shiftCount = 0; if ( a < 0x10000 ) { @@ -717,7 +717,7 @@ static int8 countLeadingZeros32( uint32_t a ) | `a'. If `a' is zero, 64 is returned. *----------------------------------------------------------------------------*/ -static int8 countLeadingZeros64( uint64_t a ) +static int8_t countLeadingZeros64( uint64_t a ) { #if SOFTFLOAT_GNUC_PREREQ(3, 4) if (a) { @@ -726,7 +726,7 @@ static int8 countLeadingZeros64( uint64_t a ) return 64; } #else - int8 shiftCount; + int8_t shiftCount; shiftCount = 0; if ( a < ( (uint64_t) 1 )<<32 ) { diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index 6dd41d8978..0875436b83 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -174,7 +174,7 @@ const float128 float128_default_nan | should be simply `float_exception_flags |= flags;'. *----------------------------------------------------------------------------*/ -void float_raise(int8 flags, float_status *status) +void float_raise(int8_t flags, float_status *status) { status->float_exception_flags |= flags; } diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 4ee98c4e81..850d08fc17 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -146,9 +146,9 @@ static inline flag extractFloat16Sign(float16 a) static int32_t roundAndPackInt32(flag zSign, uint64_t absZ, float_status *status) { - int8 roundingMode; + int8_t roundingMode; flag roundNearestEven; - int8 roundIncrement, roundBits; + int8_t roundIncrement, roundBits; int32_t z; roundingMode = status->float_rounding_mode; @@ -201,7 +201,7 @@ static int32_t roundAndPackInt32(flag zSign, uint64_t absZ, float_status *status static int64_t roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1, float_status *status) { - int8 roundingMode; + int8_t roundingMode; flag roundNearestEven, increment; int64_t z; @@ -258,7 +258,7 @@ static int64_t roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1, static int64_t roundAndPackUint64(flag zSign, uint64_t absZ0, uint64_t absZ1, float_status *status) { - int8 roundingMode; + int8_t roundingMode; flag roundNearestEven, increment; roundingMode = status->float_rounding_mode; @@ -358,7 +358,7 @@ float32 float32_squash_input_denormal(float32 a, float_status *status) static void normalizeFloat32Subnormal(uint32_t aSig, int_fast16_t *zExpPtr, uint32_t *zSigPtr) { - int8 shiftCount; + int8_t shiftCount; shiftCount = countLeadingZeros32( aSig ) - 8; *zSigPtr = aSig<float_rounding_mode; @@ -485,7 +485,7 @@ static float32 normalizeRoundAndPackFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig, float_status *status) { - int8 shiftCount; + int8_t shiftCount; shiftCount = countLeadingZeros32( zSig ) - 1; return roundAndPackFloat32(zSign, zExp - shiftCount, zSig<float_rounding_mode; @@ -1249,7 +1249,7 @@ static float128 normalizeRoundAndPackFloat128(flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1, float_status *status) { - int8 shiftCount; + int8_t shiftCount; uint64_t zSig2; if ( zSig0 == 0 ) { @@ -1297,7 +1297,7 @@ float64 int32_to_float64(int32_t a, float_status *status) { flag zSign; uint32_t absA; - int8 shiftCount; + int8_t shiftCount; uint64_t zSig; if ( a == 0 ) return float64_zero; @@ -1320,7 +1320,7 @@ floatx80 int32_to_floatx80(int32_t a, float_status *status) { flag zSign; uint32_t absA; - int8 shiftCount; + int8_t shiftCount; uint64_t zSig; if ( a == 0 ) return packFloatx80( 0, 0, 0 ); @@ -1342,7 +1342,7 @@ float128 int32_to_float128(int32_t a, float_status *status) { flag zSign; uint32_t absA; - int8 shiftCount; + int8_t shiftCount; uint64_t zSig0; if ( a == 0 ) return packFloat128( 0, 0, 0, 0 ); @@ -1364,7 +1364,7 @@ float32 int64_to_float32(int64_t a, float_status *status) { flag zSign; uint64_t absA; - int8 shiftCount; + int8_t shiftCount; if ( a == 0 ) return float32_zero; zSign = ( a < 0 ); @@ -1415,7 +1415,7 @@ floatx80 int64_to_floatx80(int64_t a, float_status *status) { flag zSign; uint64_t absA; - int8 shiftCount; + int8_t shiftCount; if ( a == 0 ) return packFloatx80( 0, 0, 0 ); zSign = ( a < 0 ); @@ -1435,7 +1435,7 @@ float128 int64_to_float128(int64_t a, float_status *status) { flag zSign; uint64_t absA; - int8 shiftCount; + int8_t shiftCount; int32_t zExp; uint64_t zSig0, zSig1; diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index bee849e0a7..a6842ad21d 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -100,7 +100,6 @@ this code that are retained. *----------------------------------------------------------------------------*/ typedef uint8_t flag; typedef uint8_t uint8; -typedef int8_t int8; #define LIT64( a ) a##LL @@ -278,7 +277,7 @@ static inline flag get_default_nan_mode(float_status *status) | Routine to raise any or all of the software IEC/IEEE floating-point | exception flags. *----------------------------------------------------------------------------*/ -void float_raise(int8 flags, float_status *status); +void float_raise(int8_t flags, float_status *status); /*---------------------------------------------------------------------------- | If `a' is denormal and we are in flush-to-zero mode then set the From d341d9f3062c74d74c94ebe6359f067bed8311ba Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Fri, 22 Jan 2016 15:09:21 +0000 Subject: [PATCH 6/7] fpu: Replace uint8 typedef with uint8_t Replace the uint8 softfloat-specific typedef with uint8_t. This change was made with find include hw fpu target-* -name '*.[ch]' | xargs sed -i -e 's/\buint8\b/uint8_t/g' together with manual removal of the typedef definition and manual fixing of more erroneous uses found via test compilation. It turns out that the only code using this type is an accidental use where uint8_t was intended anyway... Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Aurelien Jarno Acked-by: Leon Alrae Acked-by: James Hogan Message-id: 1452603315-27030-7-git-send-email-peter.maydell@linaro.org --- crypto/secret.c | 2 +- hw/net/vmware_utils.h | 2 +- include/fpu/softfloat.h | 13 ++++--------- migration/ram.c | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/crypto/secret.c b/crypto/secret.c index 9a9257a7f0..a799da1bdb 100644 --- a/crypto/secret.c +++ b/crypto/secret.c @@ -434,7 +434,7 @@ int qcrypto_secret_lookup(const char *secretid, return -1; } - *data = g_new0(uint8, secret->rawlen + 1); + *data = g_new0(uint8_t, secret->rawlen + 1); memcpy(*data, secret->rawdata, secret->rawlen); (*data)[secret->rawlen] = '\0'; *datalen = secret->rawlen; diff --git a/hw/net/vmware_utils.h b/hw/net/vmware_utils.h index c2c2f900fa..c0dbb2ff41 100644 --- a/hw/net/vmware_utils.h +++ b/hw/net/vmware_utils.h @@ -49,7 +49,7 @@ vmw_shmem_rw(hwaddr addr, void *buf, int len, int is_write) } static inline void -vmw_shmem_set(hwaddr addr, uint8 val, int len) +vmw_shmem_set(hwaddr addr, uint8_t val, int len) { int i; VMW_SHPRN("SHMEM set: %" PRIx64 ", len: %d (value 0x%X)", addr, len, val); diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index a6842ad21d..575a7398cf 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -90,16 +90,11 @@ this code that are retained. #include "config-host.h" #include "qemu/osdep.h" -/*---------------------------------------------------------------------------- -| Each of the following `typedef's defines the most convenient type that holds -| integers of at least as many bits as specified. For example, `uint8' should -| be the most convenient type that can hold unsigned integers of as many as -| 8 bits. The `flag' type must be able to hold either a 0 or 1. For most -| implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed -| to the same as `int'. -*----------------------------------------------------------------------------*/ +/* This 'flag' type must be able to hold at least 0 and 1. It should + * probably be replaced with 'bool' but the uses would need to be audited + * to check that they weren't accidentally relying on it being a larger type. + */ typedef uint8_t flag; -typedef uint8_t uint8; #define LIT64( a ) a##LL diff --git a/migration/ram.c b/migration/ram.c index 4e606ab1a4..e49749d03d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -265,7 +265,7 @@ struct DecompressParam { QemuMutex mutex; QemuCond cond; void *des; - uint8 *compbuf; + uint8_t *compbuf; int len; }; typedef struct DecompressParam DecompressParam; From 7ceac86f49b564954f5bde477c4281f407be1399 Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Fri, 22 Jan 2016 15:09:21 +0000 Subject: [PATCH 7/7] softfloat: fix return type of roundAndPackFloat16 The roundAndPackFloat16 function should return a float16 value, not a float32 one. Fix that. Cc: Peter Maydell Signed-off-by: Aurelien Jarno Reviewed-by: Peter Maydell Message-id: 1452700993-6570-1-git-send-email-aurelien@aurel32.net Signed-off-by: Peter Maydell --- fpu/softfloat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 850d08fc17..162c21122c 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -3368,7 +3368,7 @@ static float16 packFloat16(flag zSign, int_fast16_t zExp, uint16_t zSig) | Binary Floating-Point Arithmetic. *----------------------------------------------------------------------------*/ -static float32 roundAndPackFloat16(flag zSign, int_fast16_t zExp, +static float16 roundAndPackFloat16(flag zSign, int_fast16_t zExp, uint32_t zSig, flag ieee, float_status *status) {