All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types
@ 2016-01-12 12:55 Peter Maydell
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 1/6] fpu: Replace int64 typedef with int64_t Peter Maydell
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Peter Maydell @ 2016-01-12 12:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: James Hogan, patches, Leon Alrae, Andreas Färber,
	Aurelien Jarno, Richard Henderson

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(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 1/6] fpu: Replace int64 typedef with int64_t
  2016-01-12 12:55 [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Peter Maydell
@ 2016-01-12 12:55 ` Peter Maydell
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 2/6] fpu: Replace uint64 typedef with uint64_t Peter Maydell
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2016-01-12 12:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: James Hogan, patches, Leon Alrae, Andreas Färber,
	Aurelien Jarno, Richard Henderson

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 <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 f1170fe..967da1c 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 ded34eb..b49d5fb 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 5dd3da6..b42b23f 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) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 2/6] fpu: Replace uint64 typedef with uint64_t
  2016-01-12 12:55 [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Peter Maydell
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 1/6] fpu: Replace int64 typedef with int64_t Peter Maydell
@ 2016-01-12 12:55 ` Peter Maydell
  2016-01-12 14:31   ` James Hogan
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 3/6] fpu: Replace int32 typedef with int32_t Peter Maydell
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 13+ messages in thread
From: Peter Maydell @ 2016-01-12 12:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: James Hogan, patches, Leon Alrae, Andreas Färber,
	Aurelien Jarno, Richard Henderson

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 <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 967da1c..c72eb5b 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 b49d5fb..438804e 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 b091aa8..0c65e1f 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 12d7db3..ffc120d 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 75a0e5d..b8222cc 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);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 3/6] fpu: Replace int32 typedef with int32_t
  2016-01-12 12:55 [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Peter Maydell
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 1/6] fpu: Replace int64 typedef with int64_t Peter Maydell
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 2/6] fpu: Replace uint64 typedef with uint64_t Peter Maydell
@ 2016-01-12 12:55 ` Peter Maydell
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 4/6] fpu: Replace uint32 typedef with uint32_t Peter Maydell
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2016-01-12 12:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: James Hogan, patches, Leon Alrae, Andreas Färber,
	Aurelien Jarno, Richard Henderson

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 <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 c72eb5b..af3f82e 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 21fa4a7..ce1b78a 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 c662aee..daa70c3 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 438804e..c61f836 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 b42b23f..b8e2917 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)                   \
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 4/6] fpu: Replace uint32 typedef with uint32_t
  2016-01-12 12:55 [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Peter Maydell
                   ` (2 preceding siblings ...)
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 3/6] fpu: Replace int32 typedef with int32_t Peter Maydell
@ 2016-01-12 12:55 ` Peter Maydell
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 5/6] fpu: Replace int8 typedef with int8_t Peter Maydell
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2016-01-12 12:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: James Hogan, patches, Leon Alrae, Andreas Färber,
	Aurelien Jarno, Richard Henderson

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 <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 af3f82e..4ee98c4 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 c36b8cf..1bd05a1 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -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];
diff --git a/hw/misc/imx25_ccm.c b/hw/misc/imx25_ccm.c
index 23759ca..90752fd 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 47d6ead..c47b96f 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 67abad3..5147f05 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 744ea62..333e6ff 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 c61f836..bee849e 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 588a33c..4894dbc 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -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,
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 991fd85..95f35af 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;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 5/6] fpu: Replace int8 typedef with int8_t
  2016-01-12 12:55 [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Peter Maydell
                   ` (3 preceding siblings ...)
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 4/6] fpu: Replace uint32 typedef with uint32_t Peter Maydell
@ 2016-01-12 12:55 ` Peter Maydell
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 6/6] fpu: Replace uint8 typedef with uint8_t Peter Maydell
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2016-01-12 12:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: James Hogan, patches, Leon Alrae, Andreas Färber,
	Aurelien Jarno, Richard Henderson

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 <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 5e030cd..e95b445 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<<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 ) {
diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index 6dd41d8..0875436 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 4ee98c4..850d08f 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<<shiftCount;
@@ -410,9 +410,9 @@ static inline float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
 static float32 roundAndPackFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig,
                                    float_status *status)
 {
-    int8 roundingMode;
+    int8_t roundingMode;
     flag roundNearestEven;
-    int8 roundIncrement, roundBits;
+    int8_t roundIncrement, roundBits;
     flag isTiny;
 
     roundingMode = status->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<<shiftCount,
@@ -551,7 +551,7 @@ float64 float64_squash_input_denormal(float64 a, float_status *status)
 static void
  normalizeFloat64Subnormal(uint64_t aSig, int_fast16_t *zExpPtr, uint64_t *zSigPtr)
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     shiftCount = countLeadingZeros64( aSig ) - 11;
     *zSigPtr = aSig<<shiftCount;
@@ -603,7 +603,7 @@ static inline float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
 static float64 roundAndPackFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig,
                                    float_status *status)
 {
-    int8 roundingMode;
+    int8_t roundingMode;
     flag roundNearestEven;
     int_fast16_t roundIncrement, roundBits;
     flag isTiny;
@@ -677,7 +677,7 @@ static float64
  normalizeRoundAndPackFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig,
                               float_status *status)
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     shiftCount = countLeadingZeros64( zSig ) - 1;
     return roundAndPackFloat64(zSign, zExp - shiftCount, zSig<<shiftCount,
@@ -731,7 +731,7 @@ static inline flag extractFloatx80Sign( floatx80 a )
 static void
  normalizeFloatx80Subnormal( uint64_t aSig, int32_t *zExpPtr, uint64_t *zSigPtr )
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     shiftCount = countLeadingZeros64( aSig );
     *zSigPtr = aSig<<shiftCount;
@@ -778,11 +778,11 @@ static inline floatx80 packFloatx80( flag zSign, int32_t zExp, uint64_t zSig )
 | Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static floatx80 roundAndPackFloatx80(int8 roundingPrecision, flag zSign,
+static floatx80 roundAndPackFloatx80(int8_t roundingPrecision, flag zSign,
                                      int32_t zExp, uint64_t zSig0, uint64_t zSig1,
                                      float_status *status)
 {
-    int8 roundingMode;
+    int8_t roundingMode;
     flag roundNearestEven, increment, isTiny;
     int64_t roundIncrement, roundMask, roundBits;
 
@@ -974,12 +974,12 @@ static floatx80 roundAndPackFloatx80(int8 roundingPrecision, flag zSign,
 | normalized.
 *----------------------------------------------------------------------------*/
 
-static floatx80 normalizeRoundAndPackFloatx80(int8 roundingPrecision,
+static floatx80 normalizeRoundAndPackFloatx80(int8_t roundingPrecision,
                                               flag zSign, int32_t zExp,
                                               uint64_t zSig0, uint64_t zSig1,
                                               float_status *status)
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     if ( zSig0 == 0 ) {
         zSig0 = zSig1;
@@ -1060,7 +1060,7 @@ static void
      uint64_t *zSig1Ptr
  )
 {
-    int8 shiftCount;
+    int8_t shiftCount;
 
     if ( aSig0 == 0 ) {
         shiftCount = countLeadingZeros64( aSig1 ) - 15;
@@ -1131,7 +1131,7 @@ static float128 roundAndPackFloat128(flag zSign, int32_t zExp,
                                      uint64_t zSig0, uint64_t zSig1,
                                      uint64_t zSig2, float_status *status)
 {
-    int8 roundingMode;
+    int8_t roundingMode;
     flag roundNearestEven, increment, isTiny;
 
     roundingMode = status->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 bee849e..a6842ad 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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH 6/6] fpu: Replace uint8 typedef with uint8_t
  2016-01-12 12:55 [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Peter Maydell
                   ` (4 preceding siblings ...)
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 5/6] fpu: Replace int8 typedef with int8_t Peter Maydell
@ 2016-01-12 12:55 ` Peter Maydell
  2016-01-12 15:58 ` [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Richard Henderson
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2016-01-12 12:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: James Hogan, patches, Leon Alrae, Andreas Färber,
	Aurelien Jarno, Richard Henderson

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 <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 9a9257a..a799da1 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 c2c2f90..c0dbb2f 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 a6842ad..575a739 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 0490f00..73ed944 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -264,7 +264,7 @@ struct DecompressParam {
     QemuMutex mutex;
     QemuCond cond;
     void *des;
-    uint8 *compbuf;
+    uint8_t *compbuf;
     int len;
 };
 typedef struct DecompressParam DecompressParam;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 2/6] fpu: Replace uint64 typedef with uint64_t
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 2/6] fpu: Replace uint64 typedef with uint64_t Peter Maydell
@ 2016-01-12 14:31   ` James Hogan
  2016-01-12 17:08     ` Leon Alrae
  0 siblings, 1 reply; 13+ messages in thread
From: James Hogan @ 2016-01-12 14:31 UTC (permalink / raw)
  To: Peter Maydell
  Cc: patches, qemu-devel, Paolo Bonzini, Leon Alrae,
	Andreas Färber, Aurelien Jarno, Richard Henderson

[-- Attachment #1: Type: text/plain, Size: 7222 bytes --]

On Tue, Jan 12, 2016 at 12:55:11PM +0000, Peter Maydell wrote:
> 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 <peter.maydell@linaro.org>
> ---
>  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:
Acked-by: James Hogan <james.hogan@imgtec.com>

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

>  target-s390x/kvm.c        |  2 +-
>  5 files changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index 967da1c..c72eb5b 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 b49d5fb..438804e 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 b091aa8..0c65e1f 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 12d7db3..ffc120d 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 75a0e5d..b8222cc 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);
> -- 
> 1.9.1
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types
  2016-01-12 12:55 [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Peter Maydell
                   ` (5 preceding siblings ...)
  2016-01-12 12:55 ` [Qemu-devel] [PATCH 6/6] fpu: Replace uint8 typedef with uint8_t Peter Maydell
@ 2016-01-12 15:58 ` Richard Henderson
  2016-01-12 16:59 ` Leon Alrae
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2016-01-12 15:58 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: James Hogan, Leon Alrae, Andreas Färber, Aurelien Jarno, patches

On 01/12/2016 04:55 AM, Peter Maydell wrote:
> 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

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types
  2016-01-12 12:55 [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Peter Maydell
                   ` (6 preceding siblings ...)
  2016-01-12 15:58 ` [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Richard Henderson
@ 2016-01-12 16:59 ` Leon Alrae
  2016-01-13 15:59 ` Aurelien Jarno
  2016-01-19 15:24 ` Peter Maydell
  9 siblings, 0 replies; 13+ messages in thread
From: Leon Alrae @ 2016-01-12 16:59 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: Richard Henderson, James Hogan, Andreas Färber,
	Aurelien Jarno, patches

On 12/01/16 12:55, Peter Maydell wrote:
> 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(-)
> 

Looks good to me; for MIPS part in patch 1 and 3:
Acked-by: Leon Alrae <leon.alrae@imgtec.com>

Thanks,
Leon

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 2/6] fpu: Replace uint64 typedef with uint64_t
  2016-01-12 14:31   ` James Hogan
@ 2016-01-12 17:08     ` Leon Alrae
  0 siblings, 0 replies; 13+ messages in thread
From: Leon Alrae @ 2016-01-12 17:08 UTC (permalink / raw)
  To: James Hogan, Peter Maydell
  Cc: patches, qemu-devel, Paolo Bonzini, Andreas Färber,
	Aurelien Jarno, Richard Henderson

On 12/01/16 14:31, James Hogan wrote:
> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types
  2016-01-12 12:55 [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Peter Maydell
                   ` (7 preceding siblings ...)
  2016-01-12 16:59 ` Leon Alrae
@ 2016-01-13 15:59 ` Aurelien Jarno
  2016-01-19 15:24 ` Peter Maydell
  9 siblings, 0 replies; 13+ messages in thread
From: Aurelien Jarno @ 2016-01-13 15:59 UTC (permalink / raw)
  To: Peter Maydell
  Cc: James Hogan, patches, qemu-devel, Leon Alrae,
	Andreas Färber, Richard Henderson

On 2016-01-12 12:55, Peter Maydell wrote:
> 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.)

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

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

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

> 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(-)

So I am happy to give a:

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>


Regards,
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types
  2016-01-12 12:55 [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Peter Maydell
                   ` (8 preceding siblings ...)
  2016-01-13 15:59 ` Aurelien Jarno
@ 2016-01-19 15:24 ` Peter Maydell
  9 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2016-01-19 15:24 UTC (permalink / raw)
  To: QEMU Developers
  Cc: James Hogan, Patch Tracking, Leon Alrae, Andreas Färber,
	Aurelien Jarno, Richard Henderson

On 12 January 2016 at 12:55, Peter Maydell <peter.maydell@linaro.org> wrote:
> 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.)

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

thanks
-- PMM

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-01-19 15:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-12 12:55 [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Peter Maydell
2016-01-12 12:55 ` [Qemu-devel] [PATCH 1/6] fpu: Replace int64 typedef with int64_t Peter Maydell
2016-01-12 12:55 ` [Qemu-devel] [PATCH 2/6] fpu: Replace uint64 typedef with uint64_t Peter Maydell
2016-01-12 14:31   ` James Hogan
2016-01-12 17:08     ` Leon Alrae
2016-01-12 12:55 ` [Qemu-devel] [PATCH 3/6] fpu: Replace int32 typedef with int32_t Peter Maydell
2016-01-12 12:55 ` [Qemu-devel] [PATCH 4/6] fpu: Replace uint32 typedef with uint32_t Peter Maydell
2016-01-12 12:55 ` [Qemu-devel] [PATCH 5/6] fpu: Replace int8 typedef with int8_t Peter Maydell
2016-01-12 12:55 ` [Qemu-devel] [PATCH 6/6] fpu: Replace uint8 typedef with uint8_t Peter Maydell
2016-01-12 15:58 ` [Qemu-devel] [PATCH 0/6] Get rid of confusing softfloat-specific integer types Richard Henderson
2016-01-12 16:59 ` Leon Alrae
2016-01-13 15:59 ` Aurelien Jarno
2016-01-19 15:24 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.