Skip to contentSkip to conversation

softfloat queue

GIT PULL Applied Peter Maydell 1 participant 8 messages Feb 19, 2016

lore
Share & tools
lore
#0 lore raw

This is just the MAINTAINERS change plus dropping the fast types. I've included the minor MIPS change (by agreement with Leon) and the osdep.h change that drops the solaris compat baggage.

thanks
-- PMM

The following changes since commit 1b3337bb1d1c3125a2140c47629f36540ac57605:

Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2016-02-19' into staging (2016-02-19 15:19:13 +0000)

are available in the git repository at:

git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-softfloat-20160219

for you to fetch changes up to 1badb5869831de916792628b5e159176f7e342b8:

MAINTAINERS: Add section for FPU emulation (2016-02-19 16:27:22 +0000)

----------------------------------------------------------------
softfloat queue:
* update MAINTAINERS with a section for softfloat
* drop all the uses of int_fast*_t types

----------------------------------------------------------------
Peter Maydell (6):
target-mips: Stop using uint_fast*_t types in r4k_tlb_t struct
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
MAINTAINERS: Add section for FPU emulation

 MAINTAINERS             |   7 +++
 fpu/softfloat-macros.h  |  18 +++---
 fpu/softfloat.c         | 162 ++++++++++++++++++++++++++----------------------
 include/fpu/softfloat.h |  16 ++---
 include/qemu/osdep.h    |   7 ---
 target-mips/cpu.h       |  26 ++++----
 6 files changed, 124 insertions(+), 112 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/6] target-mips: Stop using uint_fast*_t types in r4k_tlb_t struct

The r4k_tlb_t structure uses the uint_fast*_t types. Most of these uses are in bitfields and are thus pointless, because the bitfield itself specifies the width of the type; just use 'unsigned int' instead. (On glibc uint_fast16_t is defined as either 32 or 64 bits, so we know the code is not reliant on it being exactly 16 bits.) There is also one use of uint_fast8_t, which we replace with uint8_t, because both are exactly 8 bits on glibc and this is the only place outside the softfloat code which uses an int_fast*_t type.

---
 target-mips/cpu.h | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
target-mips/cpu.h +13 -13
index 17817c3..86b6333 100644
@@ -19,19 +19,19 @@ typedef struct r4k_tlb_t r4k_tlb_t;
 struct r4k_tlb_t {
     target_ulong VPN;
     uint32_t PageMask;
-    uint_fast8_t ASID;
-    uint_fast16_t G:1;
-    uint_fast16_t C0:3;
-    uint_fast16_t C1:3;
-    uint_fast16_t V0:1;
-    uint_fast16_t V1:1;
-    uint_fast16_t D0:1;
-    uint_fast16_t D1:1;
-    uint_fast16_t XI0:1;
-    uint_fast16_t XI1:1;
-    uint_fast16_t RI0:1;
-    uint_fast16_t RI1:1;
-    uint_fast16_t EHINV:1;
+    uint8_t ASID;
+    unsigned int G:1;
+    unsigned int C0:3;
+    unsigned int C1:3;
+    unsigned int V0:1;
+    unsigned int V1:1;
+    unsigned int D0:1;
+    unsigned int D1:1;
+    unsigned int XI0:1;
+    unsigned int XI1:1;
+    unsigned int RI0:1;
+    unsigned int RI1:1;
+    unsigned int EHINV:1;
     uint64_t PFN[2];
 };
 
Signature · 1 line
1.9.1
#2 lore raw

[Qemu-devel] [PULL 5/6] osdep.h: Remove int_fast*_t Solaris compatibility code

In reply to Peter Maydell

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.

Message-id: [email protected]

---
 include/qemu/osdep.h | 7 -------
 1 file changed, 7 deletions(-)
include/qemu/osdep.h +0 -7
index cc055c9..431cf71 100644
@@ -84,13 +84,6 @@ extern int daemon(int, int);
 
 #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
Signature · 1 line
1.9.1
#3 lore raw

[Qemu-devel] [PULL 6/6] MAINTAINERS: Add section for FPU emulation

In reply to Peter Maydell

Add an entry to the MAINTAINERS file for our softfloat FPU emulation code. This code is only 'odd fixes' but it's useful to record who to cc on patches to it.

Message-id: [email protected]

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 02710f8..9adeda3 100644
@@ -84,6 +84,13 @@ F: include/exec/exec-all.h
 F: include/exec/helper*.h
 F: include/exec/tb-hash.h
 
+FPU emulation
+M: Aurelien Jarno <[email protected]>
+M: Peter Maydell <[email protected]>
+S: Odd Fixes
+F: fpu/
+F: include/fpu/
+
 Alpha
 M: Richard Henderson <[email protected]>
 S: Maintained
Signature · 1 line
1.9.1
#4 lore raw

[Qemu-devel] [PULL 2/6] fpu: Remove use of int_fast16_t in conversions to int16

In reply to Peter Maydell

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

Message-id: [email protected]

---
 fpu/softfloat.c         | 28 ++++++++++++++--------------
 include/fpu/softfloat.h | 16 ++++++++--------
 2 files changed, 22 insertions(+), 22 deletions(-)
fpu/softfloat.c +14 -14
index cfa9787..f1fce53 100644
@@ -1616,7 +1616,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;
@@ -3149,7 +3149,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;
@@ -7117,10 +7117,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);
@@ -7137,10 +7137,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);
@@ -7157,10 +7157,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);
@@ -7210,10 +7210,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);
@@ -7230,10 +7230,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);
@@ -7250,10 +7250,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);
include/fpu/softfloat.h +8 -8
index 575a739..624ed61 100644
@@ -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);
Signature · 1 line
1.9.1
#5 lore raw

[Qemu-devel] [PULL 3/6] fpu: Use plain 'int' rather than 'int_fast16_t' for shift counts

In reply to Peter Maydell

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

Message-id: [email protected]

---
 fpu/softfloat-macros.h | 16 ++++++++--------
 fpu/softfloat.c        | 36 ++++++++++++++++++++++++------------
 2 files changed, 32 insertions(+), 20 deletions(-)
fpu/softfloat-macros.h +8 -8
index e95b445..51947ef 100644
@@ -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
fpu/softfloat.c +24 -12
index f1fce53..74124f9 100644
@@ -1543,7 +1543,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;
 
@@ -1574,7 +1575,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);
@@ -1619,7 +1621,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;
 
@@ -1668,7 +1671,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);
@@ -1707,7 +1711,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);
@@ -1771,7 +1776,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;
@@ -3075,7 +3081,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);
 
@@ -3103,7 +3110,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);
@@ -3152,7 +3160,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;
 
@@ -3203,7 +3212,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);
 
@@ -3246,7 +3256,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);
@@ -7284,7 +7295,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);
 
Signature · 1 line
1.9.1
#6 lore raw

[Qemu-devel] [PULL 4/6] fpu: Use plain 'int' rather than 'int_fast16_t' for exponents

In reply to Peter Maydell

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

Message-id: [email protected]

---
 fpu/softfloat-macros.h |   2 +-
 fpu/softfloat.c        | 122 ++++++++++++++++++++++++-------------------------
 2 files changed, 62 insertions(+), 62 deletions(-)
fpu/softfloat-macros.h +1 -1
index 51947ef..9cc6158 100644
@@ -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,
fpu/softfloat.c +61 -61

466 lines not on this page · raw message

Signature · 1 line
1.9.1
author Applied
#7 lore raw
In reply to Peter Maydell
Quoted 18 lines · Peter Maydell

This is just the MAINTAINERS change plus dropping the fast types. I've included the minor MIPS change (by agreement with Leon) and the osdep.h change that drops the solaris compat baggage.

thanks
-- PMM

The following changes since commit 1b3337bb1d1c3125a2140c47629f36540ac57605:

Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2016-02-19' into staging (2016-02-19 15:19:13 +0000)

are available in the git repository at:

git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-softfloat-20160219

Quoted 8 lines

for you to fetch changes up to 1badb5869831de916792628b5e159176f7e342b8:

MAINTAINERS: Add section for FPU emulation (2016-02-19 16:27:22 +0000)

----------------------------------------------------------------
softfloat queue:
* update MAINTAINERS with a section for softfloat
* drop all the uses of int_fast*_t types

Applied, thanks.

-- PMM