Skip to contentSkip to conversation

Get rid of confusing softfloat-specific integer types

PATCH In review Peter Maydell 5 participants 13 messages Jan 12, 2016 – Jan 19, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Get rid of confusing softfloat-specific integer types

This patchset removes the confusing softfloat-specific integer types int8, uint8, int32, uint32, int64 and uint64, replacing them with the standard _t types that they were typedef'd as. These frequently got accidentally used outside the softfloat code as a simple typo for the standard types (as you can see from the various files touched in the diffstat).

Although there is technically a semantic difference (the softfloat types are "at least X bits" whereas the standard types are "exactly X bits", the distinction is unlikely to make much performance difference and "upgrading" the types to use int_fast*_t would require careful code analysis to check we weren't accidentally relying on the type width. It also means we might potentially have subtle bugs on only some host platforms, which is worth avoiding I think.

(In particular glibc defines int_fast32_t as a 64 bit type on 64 bit systems, which is unlikely to be the most sensible type to actually use for performance. I was reading a discussion about the _fast_ types from the musl irc channel recently:
https://gist.github.com/andrewrk/ac66b24a0a202d87cea7
which suggests that they're in practice not very useful.)

This is admittedly a different decision to the one we made in the past for int16/uint16 (commits 94a49d86c536af3, 5aea4c589aa). I can do a followup patch which converts our int_fast16_t/uint_fast16_t usage to int16_t/uint16_t if people would like.
(I think the difference is partly that the old int16/uint16 types really were bigger than 16 bits so we knew the code was not accidentally relying on exactly-16-bitness. Also I have a feeling that I was one of those suggesting the _fast_ types, but I have changed my mind and think I was wrong back then.)

I have left the 'flag' type alone. This could reasonably be changed to 'bool' if we checked all the uses to make sure they weren't accidentally relying on it being an integer type. The type name is not such that it will be accidentally used outside softfloat, so it's less of an irritant.

thanks
-- PMM

Peter Maydell (6):
fpu: Replace int64 typedef with int64_t
fpu: Replace uint64 typedef with uint64_t
fpu: Replace int32 typedef with int32_t
fpu: Replace uint32 typedef with uint32_t
fpu: Replace int8 typedef with int8_t
fpu: Replace uint8 typedef with uint8_t

 crypto/secret.c            |   2 +-
 fpu/softfloat-macros.h     |  26 +++---
 fpu/softfloat-specialize.h |   2 +-
 fpu/softfloat.c            | 218 ++++++++++++++++++++++-----------------------
 hw/i386/pc.c               |   2 +-
 hw/ipmi/isa_ipmi_bt.c      |   2 +-
 hw/ipmi/isa_ipmi_kcs.c     |   2 +-
 hw/misc/imx25_ccm.c        |   2 +-
 hw/misc/imx31_ccm.c        |   2 +-
 hw/net/vmware_utils.h      |   2 +-
 hw/net/vmxnet3.c           |   2 +-
 hw/ppc/spapr_events.c      |   4 +-
 include/fpu/softfloat.h    |  68 ++++++--------
 include/hw/i386/pc.h       |   2 +-
 migration/ram.c            |   2 +-
 target-alpha/fpu_helper.c  |   2 +-
 target-mips/kvm.c          |   4 +-
 target-mips/msa_helper.c   |  36 ++++----
 target-s390x/kvm.c         |   2 +-
 tests/vhost-user-test.c    |   2 +-
 20 files changed, 187 insertions(+), 197 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/6 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.

---
 fpu/softfloat.c          | 30 +++++++++++++++---------------
 include/fpu/softfloat.h  | 17 ++++++++---------
 target-mips/msa_helper.c | 12 ++++++------
 3 files changed, 29 insertions(+), 30 deletions(-)
fpu/softfloat.c +15 -15
index f1170fe..967da1c 100644
@@ -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 );
include/fpu/softfloat.h +8 -9
index ded34eb..b49d5fb 100644
@@ -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);
target-mips/msa_helper.c +6 -6
index 5dd3da6..b42b23f 100644
@@ -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) {
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/6 fpu: Replace uint64 typedef with uint64_t

In reply to Peter Maydell

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.

---
 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(-)
fpu/softfloat.c +5 -5
index 967da1c..c72eb5b 100644
@@ -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);
include/fpu/softfloat.h +4 -5
index b49d5fb..438804e 100644
@@ -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);
target-alpha/fpu_helper.c +1 -1
index b091aa8..0c65e1f 100644
@@ -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.  */
 
target-mips/kvm.c +2 -2
index 12d7db3..ffc120d 100644
@@ -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 = {
target-s390x/kvm.c +1 -1
index 75a0e5d..b8222cc 100644
@@ -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);
Signature · 1 line
1.9.1
Acked-by on v1 2/6
#3 lore raw

Re: [Qemu-devel] [PATCH 2/6] fpu: Replace uint64 typedef with uint64_t

Quoted 12 lines · Peter Maydell

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.

Quoted 6 lines
---
 fpu/softfloat.c           | 10 +++++-----
 include/fpu/softfloat.h   |  9 ++++-----
 target-alpha/fpu_helper.c |  2 +-
 target-mips/kvm.c         |  4 ++--

Thanks! For MIPS KVM bits:

Paolo/Leon: This also affects kvm_mips_get_one_ureg64() in patch 5 of my MIPS KVM FPU patchset (mips/kvm: Support signed 64-bit KVM registers). Are you okay to fix up the conflict when you apply?

Cheers
James

Quoted 137 lines
 target-s390x/kvm.c        |  2 +-
 5 files changed, 13 insertions(+), 14 deletions(-)
fpu/softfloat.c +5 -5
index 967da1c..c72eb5b 100644
@@ -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);
include/fpu/softfloat.h +4 -5
index b49d5fb..438804e 100644
@@ -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);
target-alpha/fpu_helper.c +1 -1
index b091aa8..0c65e1f 100644
@@ -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.  */
 
target-mips/kvm.c +2 -2
index 12d7db3..ffc120d 100644
@@ -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 = {
target-s390x/kvm.c +1 -1
index 75a0e5d..b8222cc 100644
@@ -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);
Signature · 1 line
1.9.1
#4 lore raw

Re: [Qemu-devel] [PATCH 2/6] fpu: Replace uint64 typedef with uint64_t

Quoted 3 lines · James Hogan

Paolo/Leon: This also affects kvm_mips_get_one_ureg64() in patch 5 of my MIPS KVM FPU patchset (mips/kvm: Support signed 64-bit KVM registers). Are you okay to fix up the conflict when you apply?

I'll fix it while applying to my queue.

Regards,
Leon

#5 lore raw

PATCH 3/6 fpu: Replace int32 typedef with int32_t

In reply to Peter Maydell

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.

---
 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(-)
fpu/softfloat.c +53 -53
index c72eb5b..af3f82e 100644
@@ -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;
hw/ipmi/isa_ipmi_bt.c +1 -1
index 21fa4a7..ce1b78a 100644
@@ -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;
hw/ipmi/isa_ipmi_kcs.c +1 -1
index c662aee..daa70c3 100644
@@ -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;
include/fpu/softfloat.h +9 -9
index 438804e..c61f836 100644
@@ -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);
target-mips/msa_helper.c +12 -12
index b42b23f..b8e2917 100644
@@ -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)                   \
Signature · 1 line
1.9.1
#6 lore raw

PATCH 4/6 fpu: Replace uint32 typedef with uint32_t

In reply to Peter Maydell

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.

---
 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(-)
fpu/softfloat.c +11 -11
index af3f82e..4ee98c4 100644
@@ -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);
hw/i386/pc.c +1 -1
index c36b8cf..1bd05a1 100644
@@ -1465,7 +1465,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];
hw/misc/imx25_ccm.c +1 -1
index 23759ca..90752fd 100644
@@ -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) {
hw/misc/imx31_ccm.c +1 -1
index 47d6ead..c47b96f 100644
@@ -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) {
hw/net/vmxnet3.c +1 -1
index 67abad3..5147f05 100644
@@ -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;
 
hw/ppc/spapr_events.c +2 -2
index 744ea62..333e6ff 100644
@@ -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);
include/fpu/softfloat.h +4 -6
index c61f836..bee849e 100644
@@ -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);
include/hw/i386/pc.h +1 -1
index 588a33c..4894dbc 100644
@@ -255,7 +255,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,
tests/vhost-user-test.c +1 -1
index 991fd85..95f35af 100644
@@ -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;
Signature · 1 line
1.9.1
#7 lore raw

PATCH 5/6 fpu: Replace int8 typedef with int8_t

In reply to Peter Maydell

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.

---
 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(-)
fpu/softfloat-macros.h +13 -13
index 5e030cd..e95b445 100644
@@ -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<<count;
     z1 = a1<<count;
@@ -428,7 +428,7 @@ static inline void
  )
 {
     uint64_t z0, z1, z2;
-    int8 carry0, carry1;
+    int8_t carry0, carry1;
 
     z2 = a2 + b2;
     carry1 = ( z2 < a2 );
@@ -484,7 +484,7 @@ static inline void
  )
 {
     uint64_t z0, z1, z2;
-    int8 borrow0, borrow1;
+    int8_t borrow0, borrow1;
 
     z2 = a2 - b2;
     borrow1 = ( a2 < b2 );
@@ -645,7 +645,7 @@ static uint32_t estimateSqrt32(int_fast16_t aExp, uint32_t a)
         0x0A2D, 0x08AF, 0x075A, 0x0629, 0x051A, 0x0429, 0x0356, 0x029E,
         0x0200, 0x0179, 0x0109, 0x00AF, 0x0068, 0x0034, 0x0012, 0x0002
     };
-    int8 index;
+    int8_t index;
     uint32_t z;
 
     index = ( a>>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 ) {
fpu/softfloat-specialize.h +1 -1
index 6dd41d8..0875436 100644
@@ -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;
 }
fpu/softfloat.c +25 -25

185 lines not on this page · raw message

include/fpu/softfloat.h +1 -2
index bee849e..a6842ad 100644
@@ -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
Signature · 1 line
1.9.1
#8 lore raw

PATCH 6/6 fpu: Replace uint8 typedef with uint8_t

In reply to Peter Maydell

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...

---
 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(-)
crypto/secret.c +1 -1
index 9a9257a..a799da1 100644
@@ -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;
hw/net/vmware_utils.h +1 -1
index c2c2f90..c0dbb2f 100644
@@ -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);
include/fpu/softfloat.h +4 -9
index a6842ad..575a739 100644
@@ -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
 
migration/ram.c +1 -1
index 0490f00..73ed944 100644
@@ -264,7 +264,7 @@ struct DecompressParam {
     QemuMutex mutex;
     QemuCond cond;
     void *des;
-    uint8 *compbuf;
+    uint8_t *compbuf;
     int len;
 };
 typedef struct DecompressParam DecompressParam;
Signature · 1 line
1.9.1
Reviewed-by on the v1 series
#9 lore raw
In reply to Peter Maydell
Quoted 7 lines · Peter Maydell

Peter Maydell (6):
fpu: Replace int64 typedef with int64_t
fpu: Replace uint64 typedef with uint64_t
fpu: Replace int32 typedef with int32_t
fpu: Replace uint32 typedef with uint32_t
fpu: Replace int8 typedef with int8_t
fpu: Replace uint8 typedef with uint8_t

r~

Acked-by on the v1 series
#10 lore raw
In reply to Peter Maydell
Quoted 63 lines · Peter Maydell

This patchset removes the confusing softfloat-specific integer types int8, uint8, int32, uint32, int64 and uint64, replacing them with the standard _t types that they were typedef'd as. These frequently got accidentally used outside the softfloat code as a simple typo for the standard types (as you can see from the various files touched in the diffstat).

Although there is technically a semantic difference (the softfloat types are "at least X bits" whereas the standard types are "exactly X bits", the distinction is unlikely to make much performance difference and "upgrading" the types to use int_fast*_t would require careful code analysis to check we weren't accidentally relying on the type width. It also means we might potentially have subtle bugs on only some host platforms, which is worth avoiding I think.

(In particular glibc defines int_fast32_t as a 64 bit type on 64 bit systems, which is unlikely to be the most sensible type to actually use for performance. I was reading a discussion about the _fast_ types from the musl irc channel recently:
https://gist.github.com/andrewrk/ac66b24a0a202d87cea7
which suggests that they're in practice not very useful.)

This is admittedly a different decision to the one we made in the past for int16/uint16 (commits 94a49d86c536af3, 5aea4c589aa). I can do a followup patch which converts our int_fast16_t/uint_fast16_t usage to int16_t/uint16_t if people would like.
(I think the difference is partly that the old int16/uint16 types really were bigger than 16 bits so we knew the code was not accidentally relying on exactly-16-bitness. Also I have a feeling that I was one of those suggesting the _fast_ types, but I have changed my mind and think I was wrong back then.)

I have left the 'flag' type alone. This could reasonably be changed to 'bool' if we checked all the uses to make sure they weren't accidentally relying on it being an integer type. The type name is not such that it will be accidentally used outside softfloat, so it's less of an irritant.

thanks
-- PMM

Peter Maydell (6):
fpu: Replace int64 typedef with int64_t
fpu: Replace uint64 typedef with uint64_t
fpu: Replace int32 typedef with int32_t
fpu: Replace uint32 typedef with uint32_t
fpu: Replace int8 typedef with int8_t
fpu: Replace uint8 typedef with uint8_t

 crypto/secret.c            |   2 +-
 fpu/softfloat-macros.h     |  26 +++---
 fpu/softfloat-specialize.h |   2 +-
 fpu/softfloat.c            | 218 ++++++++++++++++++++++-----------------------
 hw/i386/pc.c               |   2 +-
 hw/ipmi/isa_ipmi_bt.c      |   2 +-
 hw/ipmi/isa_ipmi_kcs.c     |   2 +-
 hw/misc/imx25_ccm.c        |   2 +-
 hw/misc/imx31_ccm.c        |   2 +-
 hw/net/vmware_utils.h      |   2 +-
 hw/net/vmxnet3.c           |   2 +-
 hw/ppc/spapr_events.c      |   4 +-
 include/fpu/softfloat.h    |  68 ++++++--------
Quoted 9 lines
 include/hw/i386/pc.h       |   2 +-
 migration/ram.c            |   2 +-
 target-alpha/fpu_helper.c  |   2 +-
 target-mips/kvm.c          |   4 +-
 target-mips/msa_helper.c   |  36 ++++----
 target-s390x/kvm.c         |   2 +-
 tests/vhost-user-test.c    |   2 +-
 20 files changed, 187 insertions(+), 197 deletions(-)

Looks good to me; for MIPS part in patch 1 and 3:

Thanks,
Leon

Reviewed-by on the v1 series
#11 lore raw
In reply to Peter Maydell
Quoted 16 lines · Peter Maydell

This patchset removes the confusing softfloat-specific integer types int8, uint8, int32, uint32, int64 and uint64, replacing them with the standard _t types that they were typedef'd as. These frequently got accidentally used outside the softfloat code as a simple typo for the standard types (as you can see from the various files touched in the diffstat).

Although there is technically a semantic difference (the softfloat types are "at least X bits" whereas the standard types are "exactly X bits", the distinction is unlikely to make much performance difference and "upgrading" the types to use int_fast*_t would require careful code analysis to check we weren't accidentally relying on the type width. It also means we might potentially have subtle bugs on only some host platforms, which is worth avoiding I think.

Quoted 6 lines

(In particular glibc defines int_fast32_t as a 64 bit type on 64 bit systems, which is unlikely to be the most sensible type to actually use for performance. I was reading a discussion about the _fast_ types from the musl irc channel recently:
https://gist.github.com/andrewrk/ac66b24a0a202d87cea7
which suggests that they're in practice not very useful.)

Thanks for doing this change. I hope this time we'll reach a consensus.

Quoted 9 lines

This is admittedly a different decision to the one we made in the past for int16/uint16 (commits 94a49d86c536af3, 5aea4c589aa). I can do a followup patch which converts our int_fast16_t/uint_fast16_t usage to int16_t/uint16_t if people would like.
(I think the difference is partly that the old int16/uint16 types really were bigger than 16 bits so we knew the code was not accidentally relying on exactly-16-bitness. Also I have a feeling that I was one of those suggesting the _fast_ types, but I have changed my mind and think I was wrong back then.)

Yes please it would be nice if we can use standard consistent type everywhere.

Quoted 5 lines

I have left the 'flag' type alone. This could reasonably be changed to 'bool' if we checked all the uses to make sure they weren't accidentally relying on it being an integer type. The type name is not such that it will be accidentally used outside softfloat, so it's less of an irritant.

Indeed.

Quoted 24 lines

thanks
-- PMM

Peter Maydell (6):
fpu: Replace int64 typedef with int64_t
fpu: Replace uint64 typedef with uint64_t
fpu: Replace int32 typedef with int32_t
fpu: Replace uint32 typedef with uint32_t
fpu: Replace int8 typedef with int8_t
fpu: Replace uint8 typedef with uint8_t

 crypto/secret.c            |   2 +-
 fpu/softfloat-macros.h     |  26 +++---
 fpu/softfloat-specialize.h |   2 +-
 fpu/softfloat.c            | 218 ++++++++++++++++++++++-----------------------
 hw/i386/pc.c               |   2 +-
 hw/ipmi/isa_ipmi_bt.c      |   2 +-
 hw/ipmi/isa_ipmi_kcs.c     |   2 +-
 hw/misc/imx25_ccm.c        |   2 +-
 hw/misc/imx31_ccm.c        |   2 +-
 hw/net/vmware_utils.h      |   2 +-
 hw/net/vmxnet3.c           |   2 +-
 hw/ppc/spapr_events.c      |   4 +-
 include/fpu/softfloat.h    |  68 ++++++--------
Quoted 8 lines
 include/hw/i386/pc.h       |   2 +-
 migration/ram.c            |   2 +-
 target-alpha/fpu_helper.c  |   2 +-
 target-mips/kvm.c          |   4 +-
 target-mips/msa_helper.c   |  36 ++++----
 target-s390x/kvm.c         |   2 +-
 tests/vhost-user-test.c    |   2 +-
 20 files changed, 187 insertions(+), 197 deletions(-)

So I am happy to give a:

Regards,
Aurelien

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                 http://www.aurel32.net
#12 lore raw
In reply to Peter Maydell
Quoted 23 lines · Peter Maydell

This patchset removes the confusing softfloat-specific integer types int8, uint8, int32, uint32, int64 and uint64, replacing them with the standard _t types that they were typedef'd as. These frequently got accidentally used outside the softfloat code as a simple typo for the standard types (as you can see from the various files touched in the diffstat).

Although there is technically a semantic difference (the softfloat types are "at least X bits" whereas the standard types are "exactly X bits", the distinction is unlikely to make much performance difference and "upgrading" the types to use int_fast*_t would require careful code analysis to check we weren't accidentally relying on the type width. It also means we might potentially have subtle bugs on only some host platforms, which is worth avoiding I think.

(In particular glibc defines int_fast32_t as a 64 bit type on 64 bit systems, which is unlikely to be the most sensible type to actually use for performance. I was reading a discussion about the _fast_ types from the musl irc channel recently:
https://gist.github.com/andrewrk/ac66b24a0a202d87cea7
which suggests that they're in practice not very useful.)

Quoted 9 lines

This is admittedly a different decision to the one we made in the past for int16/uint16 (commits 94a49d86c536af3, 5aea4c589aa). I can do a followup patch which converts our int_fast16_t/uint_fast16_t usage to int16_t/uint16_t if people would like.
(I think the difference is partly that the old int16/uint16 types really were bigger than 16 bits so we knew the code was not accidentally relying on exactly-16-bitness. Also I have a feeling that I was one of those suggesting the _fast_ types, but I have changed my mind and think I was wrong back then.)

Since this series has got positive review and nothing negative I intend to commit it to master later this week.

thanks
-- PMM