* [Qemu-devel] [PATCH 0/4] fpu: Remove use of int_fast*_t types
@ 2016-01-26 11:30 Peter Maydell
2016-01-26 11:30 ` [Qemu-devel] [PATCH 1/4] fpu: Remove use of int_fast16_t in conversions to int16 Peter Maydell
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Peter Maydell @ 2016-01-26 11:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Aurelien Jarno, patches
This patchset removes the uses of int_fast*_t types from the
softfloat code:
* the return types for the "convert to 16 bit integer" functions
are changed to int16_t
* uses of int_fast*_t for a shift count or an exponent value
are changed to int
Basically, where the type was being used to mean what should
logically be exactly 16 bits we use int16_t; where it was just
being used for a value which isn't inherently 16 bits wide
we switch to plain int.
Compatibility note: both these changes match the logical definition
of int_fast*_t so if the code was not previously buggily relying
on the width it happened to be they will not introduce any new bugs.
In practice on glibc int_fast16_t is 32-bits on 32-bit platforms
and 64-bits on 64-bit platforms so we are changing the underlying
type size. I have tested by running a bunch of ARM regression
tests with 'risu', so I'm pretty happy this doesn't cause problems.
The final patch removes some back-compat defines from osdep.h;
it depends on both the earlier patches in this series and also
on the targe-mips patch I sent out yesterday:
http://patchwork.ozlabs.org/patch/572843/
(there are no other uses of the int_fast* types in QEMU.)
thanks
-- PMM
Peter Maydell (4):
fpu: Remove use of int_fast16_t in conversions to int16
fpu: Use plain 'int' rather than 'int_fast16_t' for shift counts
fpu: Use plain 'int' rather than 'int_fast16_t' for exponents
osdep.h: Remove int_fast*_t Solaris compatibility code
fpu/softfloat-macros.h | 18 +++---
fpu/softfloat.c | 162 ++++++++++++++++++++++++++----------------------
include/fpu/softfloat.h | 16 ++---
include/qemu/osdep.h | 7 ---
4 files changed, 104 insertions(+), 99 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/4] fpu: Remove use of int_fast16_t in conversions to int16
2016-01-26 11:30 [Qemu-devel] [PATCH 0/4] fpu: Remove use of int_fast*_t types Peter Maydell
@ 2016-01-26 11:30 ` Peter Maydell
2016-01-26 11:30 ` [Qemu-devel] [PATCH 2/4] fpu: Use plain 'int' rather than 'int_fast16_t' for shift counts Peter Maydell
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2016-01-26 11:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Aurelien Jarno, patches
Make the functions which convert floating point to 16 bit integer
return int16_t rather than int_fast16_t, and correspondingly use
int_fast16_t in their internal implementations where appropriate.
(These functions are used only by the ARM target.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
fpu/softfloat.c | 28 ++++++++++++++--------------
include/fpu/softfloat.h | 16 ++++++++--------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 162c211..fc6a160 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1617,7 +1617,7 @@ int32_t float32_to_int32_round_to_zero(float32 a, float_status *status)
| returned.
*----------------------------------------------------------------------------*/
-int_fast16_t float32_to_int16_round_to_zero(float32 a, float_status *status)
+int16_t float32_to_int16_round_to_zero(float32 a, float_status *status)
{
flag aSign;
int_fast16_t aExp, shiftCount;
@@ -3150,7 +3150,7 @@ int32_t float64_to_int32_round_to_zero(float64 a, float_status *status)
| returned.
*----------------------------------------------------------------------------*/
-int_fast16_t float64_to_int16_round_to_zero(float64 a, float_status *status)
+int16_t float64_to_int16_round_to_zero(float64 a, float_status *status)
{
flag aSign;
int_fast16_t aExp, shiftCount;
@@ -7118,10 +7118,10 @@ uint32_t float32_to_uint32_round_to_zero(float32 a, float_status *status)
return res;
}
-int_fast16_t float32_to_int16(float32 a, float_status *status)
+int16_t float32_to_int16(float32 a, float_status *status)
{
int32_t v;
- int_fast16_t res;
+ int16_t res;
int old_exc_flags = get_float_exception_flags(status);
v = float32_to_int32(a, status);
@@ -7138,10 +7138,10 @@ int_fast16_t float32_to_int16(float32 a, float_status *status)
return res;
}
-uint_fast16_t float32_to_uint16(float32 a, float_status *status)
+uint16_t float32_to_uint16(float32 a, float_status *status)
{
int32_t v;
- uint_fast16_t res;
+ uint16_t res;
int old_exc_flags = get_float_exception_flags(status);
v = float32_to_int32(a, status);
@@ -7158,10 +7158,10 @@ uint_fast16_t float32_to_uint16(float32 a, float_status *status)
return res;
}
-uint_fast16_t float32_to_uint16_round_to_zero(float32 a, float_status *status)
+uint16_t float32_to_uint16_round_to_zero(float32 a, float_status *status)
{
int64_t v;
- uint_fast16_t res;
+ uint16_t res;
int old_exc_flags = get_float_exception_flags(status);
v = float32_to_int64_round_to_zero(a, status);
@@ -7211,10 +7211,10 @@ uint32_t float64_to_uint32_round_to_zero(float64 a, float_status *status)
return res;
}
-int_fast16_t float64_to_int16(float64 a, float_status *status)
+int16_t float64_to_int16(float64 a, float_status *status)
{
int64_t v;
- int_fast16_t res;
+ int16_t res;
int old_exc_flags = get_float_exception_flags(status);
v = float64_to_int32(a, status);
@@ -7231,10 +7231,10 @@ int_fast16_t float64_to_int16(float64 a, float_status *status)
return res;
}
-uint_fast16_t float64_to_uint16(float64 a, float_status *status)
+uint16_t float64_to_uint16(float64 a, float_status *status)
{
int64_t v;
- uint_fast16_t res;
+ uint16_t res;
int old_exc_flags = get_float_exception_flags(status);
v = float64_to_int32(a, status);
@@ -7251,10 +7251,10 @@ uint_fast16_t float64_to_uint16(float64 a, float_status *status)
return res;
}
-uint_fast16_t float64_to_uint16_round_to_zero(float64 a, float_status *status)
+uint16_t float64_to_uint16_round_to_zero(float64 a, float_status *status)
{
int64_t v;
- uint_fast16_t res;
+ uint16_t res;
int old_exc_flags = get_float_exception_flags(status);
v = float64_to_int64_round_to_zero(a, status);
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
index 575a739..624ed61 100644
--- a/include/fpu/softfloat.h
+++ b/include/fpu/softfloat.h
@@ -362,10 +362,10 @@ extern const float16 float16_default_nan;
/*----------------------------------------------------------------------------
| Software IEC/IEEE single-precision conversion routines.
*----------------------------------------------------------------------------*/
-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);
+int16_t float32_to_int16(float32, float_status *status);
+uint16_t float32_to_uint16(float32, float_status *status);
+int16_t float32_to_int16_round_to_zero(float32, float_status *status);
+uint16_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_t float32_to_uint32(float32, float_status *status);
@@ -474,10 +474,10 @@ extern const float32 float32_default_nan;
/*----------------------------------------------------------------------------
| Software IEC/IEEE double-precision conversion routines.
*----------------------------------------------------------------------------*/
-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);
+int16_t float64_to_int16(float64, float_status *status);
+uint16_t float64_to_uint16(float64, float_status *status);
+int16_t float64_to_int16_round_to_zero(float64, float_status *status);
+uint16_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_t float64_to_uint32(float64, float_status *status);
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/4] fpu: Use plain 'int' rather than 'int_fast16_t' for shift counts
2016-01-26 11:30 [Qemu-devel] [PATCH 0/4] fpu: Remove use of int_fast*_t types Peter Maydell
2016-01-26 11:30 ` [Qemu-devel] [PATCH 1/4] fpu: Remove use of int_fast16_t in conversions to int16 Peter Maydell
@ 2016-01-26 11:30 ` Peter Maydell
2016-01-26 11:30 ` [Qemu-devel] [PATCH 3/4] fpu: Use plain 'int' rather than 'int_fast16_t' for exponents Peter Maydell
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2016-01-26 11:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Aurelien Jarno, patches
Use the plain 'int' type rather than 'int_fast16_t' for shift counts
in the various shift related functions, since we don't actually care
about the size of the integer at all here, and using int16_t would
be confusing.
This should be a safe change because int_fast16_t semantics
permit use of 'int' (and on 32-bit glibc that is what you get).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
fpu/softfloat-macros.h | 16 ++++++++--------
fpu/softfloat.c | 36 ++++++++++++++++++++++++------------
2 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/fpu/softfloat-macros.h b/fpu/softfloat-macros.h
index e95b445..51947ef 100644
--- a/fpu/softfloat-macros.h
+++ b/fpu/softfloat-macros.h
@@ -99,7 +99,7 @@ this code that are retained.
| The result is stored in the location pointed to by `zPtr'.
*----------------------------------------------------------------------------*/
-static inline void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)
+static inline void shift32RightJamming(uint32_t a, int count, uint32_t *zPtr)
{
uint32_t z;
@@ -125,7 +125,7 @@ static inline void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t
| The result is stored in the location pointed to by `zPtr'.
*----------------------------------------------------------------------------*/
-static inline void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)
+static inline void shift64RightJamming(uint64_t a, int count, uint64_t *zPtr)
{
uint64_t z;
@@ -161,7 +161,7 @@ static inline void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t
static inline void
shift64ExtraRightJamming(
- uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
+ uint64_t a0, uint64_t a1, int count, uint64_t *z0Ptr, uint64_t *z1Ptr)
{
uint64_t z0, z1;
int8_t negCount = ( - count ) & 63;
@@ -198,7 +198,7 @@ static inline void
static inline void
shift128Right(
- uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
+ uint64_t a0, uint64_t a1, int count, uint64_t *z0Ptr, uint64_t *z1Ptr)
{
uint64_t z0, z1;
int8_t negCount = ( - count ) & 63;
@@ -233,7 +233,7 @@ static inline void
static inline void
shift128RightJamming(
- uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
+ uint64_t a0, uint64_t a1, int count, uint64_t *z0Ptr, uint64_t *z1Ptr)
{
uint64_t z0, z1;
int8_t negCount = ( - count ) & 63;
@@ -287,7 +287,7 @@ static inline void
uint64_t a0,
uint64_t a1,
uint64_t a2,
- int_fast16_t count,
+ int count,
uint64_t *z0Ptr,
uint64_t *z1Ptr,
uint64_t *z2Ptr
@@ -342,7 +342,7 @@ static inline void
static inline void
shortShift128Left(
- uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
+ uint64_t a0, uint64_t a1, int count, uint64_t *z0Ptr, uint64_t *z1Ptr)
{
*z1Ptr = a1<<count;
@@ -364,7 +364,7 @@ static inline void
uint64_t a0,
uint64_t a1,
uint64_t a2,
- int_fast16_t count,
+ int count,
uint64_t *z0Ptr,
uint64_t *z1Ptr,
uint64_t *z2Ptr
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index fc6a160..89e6fd9 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1544,7 +1544,8 @@ float128 uint64_to_float128(uint64_t a, float_status *status)
int32_t float32_to_int32(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp, shiftCount;
+ int_fast16_t aExp;
+ int shiftCount;
uint32_t aSig;
uint64_t aSig64;
@@ -1575,7 +1576,8 @@ int32_t float32_to_int32(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;
+ int_fast16_t aExp;
+ int shiftCount;
uint32_t aSig;
int32_t z;
a = float32_squash_input_denormal(a, status);
@@ -1620,7 +1622,8 @@ int32_t float32_to_int32_round_to_zero(float32 a, float_status *status)
int16_t float32_to_int16_round_to_zero(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp, shiftCount;
+ int_fast16_t aExp;
+ int shiftCount;
uint32_t aSig;
int32_t z;
@@ -1669,7 +1672,8 @@ int16_t float32_to_int16_round_to_zero(float32 a, float_status *status)
int64_t float32_to_int64(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp, shiftCount;
+ int_fast16_t aExp;
+ int shiftCount;
uint32_t aSig;
uint64_t aSig64, aSigExtra;
a = float32_squash_input_denormal(a, status);
@@ -1708,7 +1712,8 @@ int64_t float32_to_int64(float32 a, float_status *status)
uint64_t float32_to_uint64(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp, shiftCount;
+ int_fast16_t aExp;
+ int shiftCount;
uint32_t aSig;
uint64_t aSig64, aSigExtra;
a = float32_squash_input_denormal(a, status);
@@ -1772,7 +1777,8 @@ uint64_t float32_to_uint64_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;
+ int_fast16_t aExp;
+ int shiftCount;
uint32_t aSig;
uint64_t aSig64;
int64_t z;
@@ -3076,7 +3082,8 @@ int float32_unordered_quiet(float32 a, float32 b, float_status *status)
int32_t float64_to_int32(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp, shiftCount;
+ int_fast16_t aExp;
+ int shiftCount;
uint64_t aSig;
a = float64_squash_input_denormal(a, status);
@@ -3104,7 +3111,8 @@ int32_t float64_to_int32(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;
+ int_fast16_t aExp;
+ int shiftCount;
uint64_t aSig, savedASig;
int32_t z;
a = float64_squash_input_denormal(a, status);
@@ -3153,7 +3161,8 @@ int32_t float64_to_int32_round_to_zero(float64 a, float_status *status)
int16_t float64_to_int16_round_to_zero(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp, shiftCount;
+ int_fast16_t aExp;
+ int shiftCount;
uint64_t aSig, savedASig;
int32_t z;
@@ -3204,7 +3213,8 @@ int16_t float64_to_int16_round_to_zero(float64 a, float_status *status)
int64_t float64_to_int64(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp, shiftCount;
+ int_fast16_t aExp;
+ int shiftCount;
uint64_t aSig, aSigExtra;
a = float64_squash_input_denormal(a, status);
@@ -3247,7 +3257,8 @@ int64_t float64_to_int64(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;
+ int_fast16_t aExp;
+ int shiftCount;
uint64_t aSig;
int64_t z;
a = float64_squash_input_denormal(a, status);
@@ -7285,7 +7296,8 @@ uint16_t float64_to_uint16_round_to_zero(float64 a, float_status *status)
uint64_t float64_to_uint64(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp, shiftCount;
+ int_fast16_t aExp;
+ int shiftCount;
uint64_t aSig, aSigExtra;
a = float64_squash_input_denormal(a, status);
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 3/4] fpu: Use plain 'int' rather than 'int_fast16_t' for exponents
2016-01-26 11:30 [Qemu-devel] [PATCH 0/4] fpu: Remove use of int_fast*_t types Peter Maydell
2016-01-26 11:30 ` [Qemu-devel] [PATCH 1/4] fpu: Remove use of int_fast16_t in conversions to int16 Peter Maydell
2016-01-26 11:30 ` [Qemu-devel] [PATCH 2/4] fpu: Use plain 'int' rather than 'int_fast16_t' for shift counts Peter Maydell
@ 2016-01-26 11:30 ` Peter Maydell
2016-01-26 11:30 ` [Qemu-devel] [PATCH 4/4] osdep.h: Remove int_fast*_t Solaris compatibility code Peter Maydell
2016-01-29 8:46 ` [Qemu-devel] [PATCH 0/4] fpu: Remove use of int_fast*_t types Aurelien Jarno
4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2016-01-26 11:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Aurelien Jarno, patches
Use the plain 'int' type rather than 'int_fast16_t' for handling
exponents. Exponents don't need to be exactly 16 bits, so using int16_t
for them would confuse more than it clarified.
This should be a safe change because int_fast16_t semantics
permit use of 'int' (and on 32-bit glibc that is what you get).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
fpu/softfloat-macros.h | 2 +-
fpu/softfloat.c | 122 ++++++++++++++++++++++++-------------------------
2 files changed, 62 insertions(+), 62 deletions(-)
diff --git a/fpu/softfloat-macros.h b/fpu/softfloat-macros.h
index 51947ef..9cc6158 100644
--- a/fpu/softfloat-macros.h
+++ b/fpu/softfloat-macros.h
@@ -635,7 +635,7 @@ static uint64_t estimateDiv128To64( uint64_t a0, uint64_t a1, uint64_t b )
| value.
*----------------------------------------------------------------------------*/
-static uint32_t estimateSqrt32(int_fast16_t aExp, uint32_t a)
+static uint32_t estimateSqrt32(int aExp, uint32_t a)
{
static const uint16_t sqrtOddAdjustments[] = {
0x0004, 0x0022, 0x005D, 0x00B1, 0x011D, 0x019F, 0x0236, 0x02E0,
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 89e6fd9..02a279c 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -119,7 +119,7 @@ static inline uint32_t extractFloat16Frac(float16 a)
| Returns the exponent bits of the half-precision floating-point value `a'.
*----------------------------------------------------------------------------*/
-static inline int_fast16_t extractFloat16Exp(float16 a)
+static inline int extractFloat16Exp(float16 a)
{
return (float16_val(a) >> 10) & 0x1f;
}
@@ -315,7 +315,7 @@ static inline uint32_t extractFloat32Frac( float32 a )
| Returns the exponent bits of the single-precision floating-point value `a'.
*----------------------------------------------------------------------------*/
-static inline int_fast16_t extractFloat32Exp(float32 a)
+static inline int extractFloat32Exp(float32 a)
{
return ( float32_val(a)>>23 ) & 0xFF;
@@ -356,7 +356,7 @@ float32 float32_squash_input_denormal(float32 a, float_status *status)
*----------------------------------------------------------------------------*/
static void
- normalizeFloat32Subnormal(uint32_t aSig, int_fast16_t *zExpPtr, uint32_t *zSigPtr)
+ normalizeFloat32Subnormal(uint32_t aSig, int *zExpPtr, uint32_t *zSigPtr)
{
int8_t shiftCount;
@@ -377,7 +377,7 @@ static void
| significand.
*----------------------------------------------------------------------------*/
-static inline float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
+static inline float32 packFloat32(flag zSign, int zExp, uint32_t zSig)
{
return make_float32(
@@ -407,7 +407,7 @@ static inline float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
| Binary Floating-Point Arithmetic.
*----------------------------------------------------------------------------*/
-static float32 roundAndPackFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig,
+static float32 roundAndPackFloat32(flag zSign, int zExp, uint32_t zSig,
float_status *status)
{
int8_t roundingMode;
@@ -482,7 +482,7 @@ static float32 roundAndPackFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig,
*----------------------------------------------------------------------------*/
static float32
- normalizeRoundAndPackFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig,
+ normalizeRoundAndPackFloat32(flag zSign, int zExp, uint32_t zSig,
float_status *status)
{
int8_t shiftCount;
@@ -508,7 +508,7 @@ static inline uint64_t extractFloat64Frac( float64 a )
| Returns the exponent bits of the double-precision floating-point value `a'.
*----------------------------------------------------------------------------*/
-static inline int_fast16_t extractFloat64Exp(float64 a)
+static inline int extractFloat64Exp(float64 a)
{
return ( float64_val(a)>>52 ) & 0x7FF;
@@ -549,7 +549,7 @@ float64 float64_squash_input_denormal(float64 a, float_status *status)
*----------------------------------------------------------------------------*/
static void
- normalizeFloat64Subnormal(uint64_t aSig, int_fast16_t *zExpPtr, uint64_t *zSigPtr)
+ normalizeFloat64Subnormal(uint64_t aSig, int *zExpPtr, uint64_t *zSigPtr)
{
int8_t shiftCount;
@@ -570,7 +570,7 @@ static void
| significand.
*----------------------------------------------------------------------------*/
-static inline float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
+static inline float64 packFloat64(flag zSign, int zExp, uint64_t zSig)
{
return make_float64(
@@ -600,12 +600,12 @@ static inline float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
| Binary Floating-Point Arithmetic.
*----------------------------------------------------------------------------*/
-static float64 roundAndPackFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig,
+static float64 roundAndPackFloat64(flag zSign, int zExp, uint64_t zSig,
float_status *status)
{
int8_t roundingMode;
flag roundNearestEven;
- int_fast16_t roundIncrement, roundBits;
+ int roundIncrement, roundBits;
flag isTiny;
roundingMode = status->float_rounding_mode;
@@ -674,7 +674,7 @@ static float64 roundAndPackFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig,
*----------------------------------------------------------------------------*/
static float64
- normalizeRoundAndPackFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig,
+ normalizeRoundAndPackFloat64(flag zSign, int zExp, uint64_t zSig,
float_status *status)
{
int8_t shiftCount;
@@ -1544,7 +1544,7 @@ float128 uint64_to_float128(uint64_t a, float_status *status)
int32_t float32_to_int32(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
int shiftCount;
uint32_t aSig;
uint64_t aSig64;
@@ -1576,7 +1576,7 @@ int32_t float32_to_int32(float32 a, float_status *status)
int32_t float32_to_int32_round_to_zero(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
int shiftCount;
uint32_t aSig;
int32_t z;
@@ -1622,7 +1622,7 @@ int32_t float32_to_int32_round_to_zero(float32 a, float_status *status)
int16_t float32_to_int16_round_to_zero(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
int shiftCount;
uint32_t aSig;
int32_t z;
@@ -1672,7 +1672,7 @@ int16_t float32_to_int16_round_to_zero(float32 a, float_status *status)
int64_t float32_to_int64(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
int shiftCount;
uint32_t aSig;
uint64_t aSig64, aSigExtra;
@@ -1712,7 +1712,7 @@ int64_t float32_to_int64(float32 a, float_status *status)
uint64_t float32_to_uint64(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
int shiftCount;
uint32_t aSig;
uint64_t aSig64, aSigExtra;
@@ -1777,7 +1777,7 @@ uint64_t float32_to_uint64_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;
+ int aExp;
int shiftCount;
uint32_t aSig;
uint64_t aSig64;
@@ -1824,7 +1824,7 @@ int64_t float32_to_int64_round_to_zero(float32 a, float_status *status)
float64 float32_to_float64(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint32_t aSig;
a = float32_squash_input_denormal(a, status);
@@ -1856,7 +1856,7 @@ float64 float32_to_float64(float32 a, float_status *status)
floatx80 float32_to_floatx80(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint32_t aSig;
a = float32_squash_input_denormal(a, status);
@@ -1888,7 +1888,7 @@ floatx80 float32_to_floatx80(float32 a, float_status *status)
float128 float32_to_float128(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint32_t aSig;
a = float32_squash_input_denormal(a, status);
@@ -1920,7 +1920,7 @@ float128 float32_to_float128(float32 a, float_status *status)
float32 float32_round_to_int(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint32_t lastBitMask, roundBitsMask;
uint32_t z;
a = float32_squash_input_denormal(a, status);
@@ -2002,9 +2002,9 @@ float32 float32_round_to_int(float32 a, float_status *status)
static float32 addFloat32Sigs(float32 a, float32 b, flag zSign,
float_status *status)
{
- int_fast16_t aExp, bExp, zExp;
+ int aExp, bExp, zExp;
uint32_t aSig, bSig, zSig;
- int_fast16_t expDiff;
+ int expDiff;
aSig = extractFloat32Frac( a );
aExp = extractFloat32Exp( a );
@@ -2088,9 +2088,9 @@ static float32 addFloat32Sigs(float32 a, float32 b, flag zSign,
static float32 subFloat32Sigs(float32 a, float32 b, flag zSign,
float_status *status)
{
- int_fast16_t aExp, bExp, zExp;
+ int aExp, bExp, zExp;
uint32_t aSig, bSig, zSig;
- int_fast16_t expDiff;
+ int expDiff;
aSig = extractFloat32Frac( a );
aExp = extractFloat32Exp( a );
@@ -2214,7 +2214,7 @@ float32 float32_sub(float32 a, float32 b, float_status *status)
float32 float32_mul(float32 a, float32 b, float_status *status)
{
flag aSign, bSign, zSign;
- int_fast16_t aExp, bExp, zExp;
+ int aExp, bExp, zExp;
uint32_t aSig, bSig;
uint64_t zSig64;
uint32_t zSig;
@@ -2279,7 +2279,7 @@ float32 float32_mul(float32 a, float32 b, float_status *status)
float32 float32_div(float32 a, float32 b, float_status *status)
{
flag aSign, bSign, zSign;
- int_fast16_t aExp, bExp, zExp;
+ int aExp, bExp, zExp;
uint32_t aSig, bSig, zSig;
a = float32_squash_input_denormal(a, status);
b = float32_squash_input_denormal(b, status);
@@ -2349,7 +2349,7 @@ float32 float32_div(float32 a, float32 b, float_status *status)
float32 float32_rem(float32 a, float32 b, float_status *status)
{
flag aSign, zSign;
- int_fast16_t aExp, bExp, expDiff;
+ int aExp, bExp, expDiff;
uint32_t aSig, bSig;
uint32_t q;
uint64_t aSig64, bSig64, q64;
@@ -2457,7 +2457,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags,
float_status *status)
{
flag aSign, bSign, cSign, zSign;
- int_fast16_t aExp, bExp, cExp, pExp, zExp, expDiff;
+ int aExp, bExp, cExp, pExp, zExp, expDiff;
uint32_t aSig, bSig, cSig;
flag pInf, pZero, pSign;
uint64_t pSig64, cSig64, zSig64;
@@ -2677,7 +2677,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags,
float32 float32_sqrt(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp, zExp;
+ int aExp, zExp;
uint32_t aSig, zSig;
uint64_t rem, term;
a = float32_squash_input_denormal(a, status);
@@ -2765,7 +2765,7 @@ static const float64 float32_exp2_coefficients[15] =
float32 float32_exp2(float32 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint32_t aSig;
float64 r, x, xn;
int i;
@@ -2815,7 +2815,7 @@ float32 float32_exp2(float32 a, float_status *status)
float32 float32_log2(float32 a, float_status *status)
{
flag aSign, zSign;
- int_fast16_t aExp;
+ int aExp;
uint32_t aSig, zSig, i;
a = float32_squash_input_denormal(a, status);
@@ -3082,7 +3082,7 @@ int float32_unordered_quiet(float32 a, float32 b, float_status *status)
int32_t float64_to_int32(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
int shiftCount;
uint64_t aSig;
a = float64_squash_input_denormal(a, status);
@@ -3111,7 +3111,7 @@ int32_t float64_to_int32(float64 a, float_status *status)
int32_t float64_to_int32_round_to_zero(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
int shiftCount;
uint64_t aSig, savedASig;
int32_t z;
@@ -3161,7 +3161,7 @@ int32_t float64_to_int32_round_to_zero(float64 a, float_status *status)
int16_t float64_to_int16_round_to_zero(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
int shiftCount;
uint64_t aSig, savedASig;
int32_t z;
@@ -3213,7 +3213,7 @@ int16_t float64_to_int16_round_to_zero(float64 a, float_status *status)
int64_t float64_to_int64(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
int shiftCount;
uint64_t aSig, aSigExtra;
a = float64_squash_input_denormal(a, status);
@@ -3257,7 +3257,7 @@ int64_t float64_to_int64(float64 a, float_status *status)
int64_t float64_to_int64_round_to_zero(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
int shiftCount;
uint64_t aSig;
int64_t z;
@@ -3310,7 +3310,7 @@ int64_t float64_to_int64_round_to_zero(float64 a, float_status *status)
float32 float64_to_float32(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint64_t aSig;
uint32_t zSig;
a = float64_squash_input_denormal(a, status);
@@ -3345,7 +3345,7 @@ float32 float64_to_float32(float64 a, float_status *status)
| than the desired result exponent whenever `zSig' is a complete, normalized
| significand.
*----------------------------------------------------------------------------*/
-static float16 packFloat16(flag zSign, int_fast16_t zExp, uint16_t zSig)
+static float16 packFloat16(flag zSign, int zExp, uint16_t zSig)
{
return make_float16(
(((uint32_t)zSign) << 15) + (((uint32_t)zExp) << 10) + zSig);
@@ -3379,7 +3379,7 @@ static float16 packFloat16(flag zSign, int_fast16_t zExp, uint16_t zSig)
| Binary Floating-Point Arithmetic.
*----------------------------------------------------------------------------*/
-static float16 roundAndPackFloat16(flag zSign, int_fast16_t zExp,
+static float16 roundAndPackFloat16(flag zSign, int zExp,
uint32_t zSig, flag ieee,
float_status *status)
{
@@ -3466,7 +3466,7 @@ static float16 roundAndPackFloat16(flag zSign, int_fast16_t zExp,
return packFloat16(zSign, zExp, zSig >> 13);
}
-static void normalizeFloat16Subnormal(uint32_t aSig, int_fast16_t *zExpPtr,
+static void normalizeFloat16Subnormal(uint32_t aSig, int *zExpPtr,
uint32_t *zSigPtr)
{
int8_t shiftCount = countLeadingZeros32(aSig) - 21;
@@ -3480,7 +3480,7 @@ static void normalizeFloat16Subnormal(uint32_t aSig, int_fast16_t *zExpPtr,
float32 float16_to_float32(float16 a, flag ieee, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint32_t aSig;
aSign = extractFloat16Sign(a);
@@ -3507,7 +3507,7 @@ float32 float16_to_float32(float16 a, flag ieee, float_status *status)
float16 float32_to_float16(float32 a, flag ieee, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint32_t aSig;
a = float32_squash_input_denormal(a, status);
@@ -3551,7 +3551,7 @@ float16 float32_to_float16(float32 a, flag ieee, float_status *status)
float64 float16_to_float64(float16 a, flag ieee, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint32_t aSig;
aSign = extractFloat16Sign(a);
@@ -3579,7 +3579,7 @@ float64 float16_to_float64(float16 a, flag ieee, float_status *status)
float16 float64_to_float16(float64 a, flag ieee, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint64_t aSig;
uint32_t zSig;
@@ -3633,7 +3633,7 @@ float16 float64_to_float16(float64 a, flag ieee, float_status *status)
floatx80 float64_to_floatx80(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint64_t aSig;
a = float64_squash_input_denormal(a, status);
@@ -3666,7 +3666,7 @@ floatx80 float64_to_floatx80(float64 a, float_status *status)
float128 float64_to_float128(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint64_t aSig, zSig0, zSig1;
a = float64_squash_input_denormal(a, status);
@@ -3699,7 +3699,7 @@ float128 float64_to_float128(float64 a, float_status *status)
float64 float64_round_to_int(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint64_t lastBitMask, roundBitsMask;
uint64_t z;
a = float64_squash_input_denormal(a, status);
@@ -3793,9 +3793,9 @@ float64 float64_trunc_to_int(float64 a, float_status *status)
static float64 addFloat64Sigs(float64 a, float64 b, flag zSign,
float_status *status)
{
- int_fast16_t aExp, bExp, zExp;
+ int aExp, bExp, zExp;
uint64_t aSig, bSig, zSig;
- int_fast16_t expDiff;
+ int expDiff;
aSig = extractFloat64Frac( a );
aExp = extractFloat64Exp( a );
@@ -3879,9 +3879,9 @@ static float64 addFloat64Sigs(float64 a, float64 b, flag zSign,
static float64 subFloat64Sigs(float64 a, float64 b, flag zSign,
float_status *status)
{
- int_fast16_t aExp, bExp, zExp;
+ int aExp, bExp, zExp;
uint64_t aSig, bSig, zSig;
- int_fast16_t expDiff;
+ int expDiff;
aSig = extractFloat64Frac( a );
aExp = extractFloat64Exp( a );
@@ -4005,7 +4005,7 @@ float64 float64_sub(float64 a, float64 b, float_status *status)
float64 float64_mul(float64 a, float64 b, float_status *status)
{
flag aSign, bSign, zSign;
- int_fast16_t aExp, bExp, zExp;
+ int aExp, bExp, zExp;
uint64_t aSig, bSig, zSig0, zSig1;
a = float64_squash_input_denormal(a, status);
@@ -4068,7 +4068,7 @@ float64 float64_mul(float64 a, float64 b, float_status *status)
float64 float64_div(float64 a, float64 b, float_status *status)
{
flag aSign, bSign, zSign;
- int_fast16_t aExp, bExp, zExp;
+ int aExp, bExp, zExp;
uint64_t aSig, bSig, zSig;
uint64_t rem0, rem1;
uint64_t term0, term1;
@@ -4146,7 +4146,7 @@ float64 float64_div(float64 a, float64 b, float_status *status)
float64 float64_rem(float64 a, float64 b, float_status *status)
{
flag aSign, zSign;
- int_fast16_t aExp, bExp, expDiff;
+ int aExp, bExp, expDiff;
uint64_t aSig, bSig;
uint64_t q, alternateASig;
int64_t sigMean;
@@ -4240,7 +4240,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags,
float_status *status)
{
flag aSign, bSign, cSign, zSign;
- int_fast16_t aExp, bExp, cExp, pExp, zExp, expDiff;
+ int aExp, bExp, cExp, pExp, zExp, expDiff;
uint64_t aSig, bSig, cSig;
flag pInf, pZero, pSign;
uint64_t pSig0, pSig1, cSig0, cSig1, zSig0, zSig1;
@@ -4481,7 +4481,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags,
float64 float64_sqrt(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp, zExp;
+ int aExp, zExp;
uint64_t aSig, zSig, doubleZSig;
uint64_t rem0, rem1, term0, term1;
a = float64_squash_input_denormal(a, status);
@@ -4534,7 +4534,7 @@ float64 float64_sqrt(float64 a, float_status *status)
float64 float64_log2(float64 a, float_status *status)
{
flag aSign, zSign;
- int_fast16_t aExp;
+ int aExp;
uint64_t aSig, aSig0, aSig1, zSig, i;
a = float64_squash_input_denormal(a, status);
@@ -5017,7 +5017,7 @@ float64 floatx80_to_float64(floatx80 a, float_status *status)
float128 floatx80_to_float128(floatx80 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
uint64_t aSig, zSig0, zSig1;
aSig = extractFloatx80Frac( a );
@@ -7296,7 +7296,7 @@ uint16_t float64_to_uint16_round_to_zero(float64 a, float_status *status)
uint64_t float64_to_uint64(float64 a, float_status *status)
{
flag aSign;
- int_fast16_t aExp;
+ int aExp;
int shiftCount;
uint64_t aSig, aSigExtra;
a = float64_squash_input_denormal(a, status);
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 4/4] osdep.h: Remove int_fast*_t Solaris compatibility code
2016-01-26 11:30 [Qemu-devel] [PATCH 0/4] fpu: Remove use of int_fast*_t types Peter Maydell
` (2 preceding siblings ...)
2016-01-26 11:30 ` [Qemu-devel] [PATCH 3/4] fpu: Use plain 'int' rather than 'int_fast16_t' for exponents Peter Maydell
@ 2016-01-26 11:30 ` Peter Maydell
2016-01-29 8:46 ` [Qemu-devel] [PATCH 0/4] fpu: Remove use of int_fast*_t types Aurelien Jarno
4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2016-01-26 11:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Aurelien Jarno, patches
We now do not use the int_fast*_t types anywhere in QEMU, so we can
remove the compatibility definitions we were providing for the
benefit of ancient Solaris versions.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/qemu/osdep.h | 7 -------
1 file changed, 7 deletions(-)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 59a7f8d..cad78ae 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -73,13 +73,6 @@
#include "qapi/error.h"
-#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
-/* [u]int_fast*_t not in <sys/int_types.h> */
-typedef unsigned char uint_fast8_t;
-typedef unsigned int uint_fast16_t;
-typedef signed int int_fast16_t;
-#endif
-
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] fpu: Remove use of int_fast*_t types
2016-01-26 11:30 [Qemu-devel] [PATCH 0/4] fpu: Remove use of int_fast*_t types Peter Maydell
` (3 preceding siblings ...)
2016-01-26 11:30 ` [Qemu-devel] [PATCH 4/4] osdep.h: Remove int_fast*_t Solaris compatibility code Peter Maydell
@ 2016-01-29 8:46 ` Aurelien Jarno
4 siblings, 0 replies; 6+ messages in thread
From: Aurelien Jarno @ 2016-01-29 8:46 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, patches
On 2016-01-26 11:30, Peter Maydell wrote:
> This patchset removes the uses of int_fast*_t types from the
> softfloat code:
> * the return types for the "convert to 16 bit integer" functions
> are changed to int16_t
> * uses of int_fast*_t for a shift count or an exponent value
> are changed to int
>
> Basically, where the type was being used to mean what should
> logically be exactly 16 bits we use int16_t; where it was just
> being used for a value which isn't inherently 16 bits wide
> we switch to plain int.
>
> Compatibility note: both these changes match the logical definition
> of int_fast*_t so if the code was not previously buggily relying
> on the width it happened to be they will not introduce any new bugs.
> In practice on glibc int_fast16_t is 32-bits on 32-bit platforms
> and 64-bits on 64-bit platforms so we are changing the underlying
> type size. I have tested by running a bunch of ARM regression
> tests with 'risu', so I'm pretty happy this doesn't cause problems.
>
> The final patch removes some back-compat defines from osdep.h;
> it depends on both the earlier patches in this series and also
> on the targe-mips patch I sent out yesterday:
> http://patchwork.ozlabs.org/patch/572843/
> (there are no other uses of the int_fast* types in QEMU.)
>
> thanks
> -- PMM
>
> Peter Maydell (4):
> fpu: Remove use of int_fast16_t in conversions to int16
> fpu: Use plain 'int' rather than 'int_fast16_t' for shift counts
> fpu: Use plain 'int' rather than 'int_fast16_t' for exponents
> osdep.h: Remove int_fast*_t Solaris compatibility code
>
> fpu/softfloat-macros.h | 18 +++---
> fpu/softfloat.c | 162 ++++++++++++++++++++++++++----------------------
> include/fpu/softfloat.h | 16 ++---
> include/qemu/osdep.h | 7 ---
> 4 files changed, 104 insertions(+), 99 deletions(-)
Great work.
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-01-29 8:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-26 11:30 [Qemu-devel] [PATCH 0/4] fpu: Remove use of int_fast*_t types Peter Maydell
2016-01-26 11:30 ` [Qemu-devel] [PATCH 1/4] fpu: Remove use of int_fast16_t in conversions to int16 Peter Maydell
2016-01-26 11:30 ` [Qemu-devel] [PATCH 2/4] fpu: Use plain 'int' rather than 'int_fast16_t' for shift counts Peter Maydell
2016-01-26 11:30 ` [Qemu-devel] [PATCH 3/4] fpu: Use plain 'int' rather than 'int_fast16_t' for exponents Peter Maydell
2016-01-26 11:30 ` [Qemu-devel] [PATCH 4/4] osdep.h: Remove int_fast*_t Solaris compatibility code Peter Maydell
2016-01-29 8:46 ` [Qemu-devel] [PATCH 0/4] fpu: Remove use of int_fast*_t types Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).