All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked
@ 2012-01-16  0:46 Andreas Färber
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 01/14] lm32: Fix mixup of uint32 and uint32_t Andreas Färber
                   ` (15 more replies)
  0 siblings, 16 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Rui Carmo, Peter Maydell, Pavel Borzenkov, Alexander Graf,
	Eric Sunshine, Blue Swirl, Christophe Lyon, malc, Juan Pineda,
	Andreas Färber, Aurélien Jarno

Hello,

Based on a suggestion from Alex earlier this week, I managed to run a
simple benchmark of softfloat performance with qemu-arm, as requested by
Peter.

I went for the Whetstone floating point benchmark:
http://en.wikipedia.org/wiki/Whetstone_%28benchmark%29

For a loop count of 100,000 and 5 runs I got the following results:

  current:        138.9-204.1 Whetstone-MIPS
  [u]int*_t:      185.2-188.7 Whetstone-MIPS
  [u]int_fast*_t: 285.7-294.1 Whetstone-MIPS

  Toshiba AC100:  833.3-909.1 Whetstone-MIPS

These results seem to indicate that the "fast" POSIX types are indeed
somewhat faster, both compared to exact-size POSIX types and to the
current state.

As a short summary of previous discussions, softfloat had these typedefs:
  [s]bits{8,16,32,64} - exact-size semantics, => [u]int{8,16,32,64}_t
  [u]int{8,16,32,64}  - minimum-width semantics, host-independent
AIX, Mac OS X and BeOS/Haiku have some or all of the latter already,
leading to type conflicts.
I had originally suggested the POSIX [u]int_least*_t types but we
rather preferred [u]int_fast*_t, worried about performance, to get the
fastest least-width types. For either of these the actual width depends
on system headers. On the other hand it would be futile to try to
performance-optimize integer types for every possible host inside QEMU.
If we don't mind performance or dislike host-dependencies, we could just
use [u]int*_t, but then with everything [u]int*_t we can't easily change
this in case it bites us in the future.

Personally I prefer those 'fast' types, because that way we get to
keep the distinction between what was formerly [s]bits* and [u]int* types.
The clear name distinction would even allow to do conversions by regex.

However, I noticed that target-mips/cpu.h had typedefs for
uint_fast{8,16}_t for Solaris <= 9. So I moved these to osdep.h and
added typedefs for the newly needed types.

Coccinelle needed some tweaking for the macros and only did the uint16
conversion fully. For the others I was too impatient, so I hand-converted
the remaining occurrences that Coccinelle did not catch.

Since Coccinelle stripped leading whitespace before types replaced anyway,
I hand-edited (and git-am'ed) the patches to make lines touched adhere to
Coding Style.

Patches 1-3 fix misuses of softfloat types that were introduced since the
last series of fixes. These could be cherry-picked.

Patch 4 fixes a misuse of int inside softfloat. This could be cherry-picked.

Patch 5 moves the Solaris typedefs to a central header, resolving an XXX
present since their introduction in r1979.

Patches 6-13 convert the softfloat integer types.

Patch 14 converts the 'flag' type to bool, removing the last softfloat type.

Please test that this doesn't break / unbreaks Your Favorite Host:
http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/softfloat

Regards,
Andreas

Cc: Alexander Graf <agraf@suse.de>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Aurélien Jarno <aurelien@aurel32.net>
Cc: malc <av1474@comtv.ru>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>

Cc: Rui Carmo <rui.carmo@gmail.com>
Cc: Eric Sunshine <sunshine@sunshineco.com>
Cc: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Cc: Juan Pineda <juan@logician.com>

Host: HP Envy w/ Intel Core i7-2630QM 2.0 GHz (openSUSE 12.1)
QEMU: 2be276242135eac6e86be2a8259545e620c94107 plus + 2 patches
Configuration: --prefix=/usr/local
Command: arm-linux-user/qemu-arm path/to/whetstone -c 100000

Source: http://www.netlib.org/benchmark/whetstone.c
Compiler: gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
Compilation: gcc -O -s whetstone.c -o whetstone -lm -static

[u]int*_t:
---
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 07c2929..6fe19d7 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -57,11 +57,11 @@ typedef uint8_t flag;
 typedef uint8_t uint8;
 typedef int8_t int8;
 #ifndef _AIX
-typedef int uint16;
-typedef int int16;
+typedef uint16_t uint16;
+typedef int16_t int16;
 #endif
-typedef unsigned int uint32;
-typedef signed int int32;
+typedef uint32_t uint32;
+typedef int32_t int32;
 typedef uint64_t uint64;
 typedef int64_t int64;

---

[u]int_fast*_t:
---
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 07c2929..43486aa 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -54,16 +54,16 @@ these four paragraphs for those parts of this code
that are retained.
 | to the same as `int'.
 *----------------------------------------------------------------------------*/
 typedef uint8_t flag;
-typedef uint8_t uint8;
-typedef int8_t int8;
+typedef uint_fast8_t uint8;
+typedef int_fast8_t int8;
 #ifndef _AIX
-typedef int uint16;
-typedef int int16;
+typedef uint_fast16_t uint16;
+typedef int_fast16_t int16;
 #endif
-typedef unsigned int uint32;
-typedef signed int int32;
-typedef uint64_t uint64;
-typedef int64_t int64;
+typedef uint_fast32_t uint32;
+typedef int_fast32_t int32;
+typedef uint_fast64_t uint64;
+typedef int_fast64_t int64;

 #define LIT64( a ) a##LL
 #define INLINE static inline
---

spatch(1) -macro_file_builtins:
---
#define STATUS_PARAM
#define STATUS_VAR

#define INLINE static inline

#define MINMAX
---

Andreas Färber (13):
  lm32: Fix mixup of uint32 and uint32_t
  target-sparc: Fix mixup of uint64 and uint64_t
  qemu-tool: Fix mixup of int64 and int64_t
  softfloat: Fix mixups of int and int16
  softfloat: Replace uint16 type with uint_fast16_t
  softfloat: Replace int16 type with int_fast16_t
  softfloat: Remove unused uint8 type
  softfloat: Replace int8 type with int_fast8_t
  softfloat: Replace uint32 type with uint_fast32_t
  softfloat: Replace int32 type with int_fast32_t
  softfloat: Replace uint64 type with uint_fast64_t
  softfloat: Replace int64 type with int_fast64_t
  softfloat: Replace flag type with bool

 fpu/softfloat-macros.h        |   52 ++--
 fpu/softfloat-specialize.h    |   56 ++--
 fpu/softfloat.c               |  626 ++++++++++++++++++++--------------------
 fpu/softfloat.h               |  115 ++++-----
 hw/milkymist-vgafb_template.h |    2 +-
 qemu-tool.c                   |    4 +-
 target-sparc/vis_helper.c     |    2 +-
 7 files changed, 419 insertions(+), 438 deletions(-)

-- 
1.7.7

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

* [Qemu-devel] [PATCH 01/14] lm32: Fix mixup of uint32 and uint32_t
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
@ 2012-01-16  0:46 ` Andreas Färber
  2012-01-16 11:27   ` Peter Maydell
  2012-01-17  9:44   ` [Qemu-devel] [PATCH v2] " Andreas Färber
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 02/14] target-sparc: Fix mixup of uint64 and uint64_t Andreas Färber
                   ` (14 subsequent siblings)
  15 siblings, 2 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Edgar E. Iglesias, Michael Walle, Andreas Färber

Commit d23948b15a9920fb7f6374b55a6db1ecff81f3ee (lm32: add Milkymist
VGAFB support) introduced a stray usage of the softfloat uint32 type.

Use uint32_t instead.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Michael Walle <michael@walle.cc>
---
 hw/milkymist-vgafb_template.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/milkymist-vgafb_template.h b/hw/milkymist-vgafb_template.h
index 69af9ef..544b55e 100644
--- a/hw/milkymist-vgafb_template.h
+++ b/hw/milkymist-vgafb_template.h
@@ -39,7 +39,7 @@
 #elif BITS == 24
 #define COPY_PIXEL(to, r, g, b)                    \
     do {                                           \
-        uint32 tmp = rgb_to_pixel24(r, g, b);      \
+        uint32_t tmp = rgb_to_pixel24(r, g, b);      \
         *(to++) =         tmp & 0xff;              \
         *(to++) =  (tmp >> 8) & 0xff;              \
         *(to++) = (tmp >> 16) & 0xff;              \
-- 
1.7.7

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

* [Qemu-devel] [PATCH 02/14] target-sparc: Fix mixup of uint64 and uint64_t
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 01/14] lm32: Fix mixup of uint32 and uint32_t Andreas Färber
@ 2012-01-16  0:46 ` Andreas Färber
  2012-01-21 18:51   ` Blue Swirl
  2012-01-22 10:02   ` Blue Swirl
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 03/14] qemu-tool: Fix mixup of int64 and int64_t Andreas Färber
                   ` (13 subsequent siblings)
  15 siblings, 2 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, Andreas Färber, Richard Henderson

Commit 793a137a41ad4125011c7022cf16a1baa40a5ab6 (target-sparc:
Implement BMASK/BSHUFFLE.) introduced a stray usage of softfloat uint64
type.

Use uint64_t instead.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Blue Swirl <blauwirbel@gmail.com>
---
 target-sparc/vis_helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/target-sparc/vis_helper.c b/target-sparc/vis_helper.c
index a992c29..9d2edb0 100644
--- a/target-sparc/vis_helper.c
+++ b/target-sparc/vis_helper.c
@@ -459,7 +459,7 @@ uint32_t helper_fpackfix(uint64_t gsr, uint64_t rs2)
     return ret;
 }
 
-uint64 helper_bshuffle(uint64_t gsr, uint64_t src1, uint64_t src2)
+uint64_t helper_bshuffle(uint64_t gsr, uint64_t src1, uint64_t src2)
 {
     union {
         uint64_t ll[2];
-- 
1.7.7

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

* [Qemu-devel] [PATCH 03/14] qemu-tool: Fix mixup of int64 and int64_t
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 01/14] lm32: Fix mixup of uint32 and uint32_t Andreas Färber
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 02/14] target-sparc: Fix mixup of uint64 and uint64_t Andreas Färber
@ 2012-01-16  0:46 ` Andreas Färber
  2012-01-16  8:11   ` Stefan Hajnoczi
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 04/14] softfloat: Fix mixups of int and int16 Andreas Färber
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Anthony Liguori, Stefan Hajnoczi, Frediano Ziglio,
	Paolo Bonzini, Andreas Färber

Commit cbcfa0418f0c196afa765f5c9837b9344d1adcf3 (link the main loop and
its dependencies into the tools) introduced stray usages of int64.

Use int64_t instead.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
---
 qemu-tool.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/qemu-tool.c b/qemu-tool.c
index c73bf71..6b69668 100644
--- a/qemu-tool.c
+++ b/qemu-tool.c
@@ -59,12 +59,12 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
 {
 }
 
-int64 cpu_get_clock(void)
+int64_t cpu_get_clock(void)
 {
     abort();
 }
 
-int64 cpu_get_icount(void)
+int64_t cpu_get_icount(void)
 {
     abort();
 }
-- 
1.7.7

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

* [Qemu-devel] [PATCH 04/14] softfloat: Fix mixups of int and int16
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (2 preceding siblings ...)
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 03/14] qemu-tool: Fix mixup of int64 and int64_t Andreas Färber
@ 2012-01-16  0:46 ` Andreas Färber
  2012-01-16 17:51   ` Peter Maydell
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 05/14] target-mips: Move definition of uint_fast{8, 16}_t to osdep.h Andreas Färber
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl, Peter Maydell, Andreas Färber, Aurelien Jarno

normalizeFloat{32,64}Subnormal() expect the exponent as int16, not int.
This went unnoticed since int16 and uint16 were both typedef'ed to int.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 fpu/softfloat.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 81a7d1a..6dbcb1b 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -2131,7 +2131,7 @@ float32 float32_rem( float32 a, float32 b STATUS_PARAM )
 float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
 {
     flag aSign, bSign, cSign, zSign;
-    int aExp, bExp, cExp, pExp, zExp, expDiff;
+    int16 aExp, bExp, cExp, pExp, zExp, expDiff;
     uint32_t aSig, bSig, cSig;
     flag pInf, pZero, pSign;
     uint64_t pSig64, cSig64, zSig64;
@@ -3685,7 +3685,7 @@ float64 float64_rem( float64 a, float64 b STATUS_PARAM )
 float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
 {
     flag aSign, bSign, cSign, zSign;
-    int aExp, bExp, cExp, pExp, zExp, expDiff;
+    int16 aExp, bExp, cExp, pExp, zExp, expDiff;
     uint64_t aSig, bSig, cSig;
     flag pInf, pZero, pSign;
     uint64_t pSig0, pSig1, cSig0, cSig1, zSig0, zSig1;
-- 
1.7.7

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

* [Qemu-devel] [PATCH 05/14] target-mips: Move definition of uint_fast{8, 16}_t to osdep.h
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (3 preceding siblings ...)
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 04/14] softfloat: Fix mixups of int and int16 Andreas Färber
@ 2012-01-16  0:46 ` Andreas Färber
  2012-01-16 11:38   ` Peter Maydell
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 06/14] softfloat: Replace uint16 type with uint_fast16_t Andreas Färber
                   ` (10 subsequent siblings)
  15 siblings, 1 reply; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Anthony Liguori, Jan Kiszka, Blue Swirl, Stefan Weil,
	Andreas Färber, Aurélien Jarno

osdep.h is included via qemu-common.h.

Prepares for use of [u]int_fast*_t types in softfloat code.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
Cc: Aurélien Jarno <aurelien@aurel32.net>
---
 osdep.h           |    6 ++++++
 target-mips/cpu.h |    7 -------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/osdep.h b/osdep.h
index 432b91e..8f45a96 100644
--- a/osdep.h
+++ b/osdep.h
@@ -10,6 +10,12 @@
 
 #include <sys/time.h>
 
+#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
+/* uint_fast8_t and uint_fast16_t not in <sys/int_types.h> */
+typedef unsigned char           uint_fast8_t;
+typedef unsigned int            uint_fast16_t;
+#endif
+
 #ifndef glue
 #define xglue(x, y) x ## y
 #define glue(x, y) xglue(x, y)
diff --git a/target-mips/cpu.h b/target-mips/cpu.h
index 71cb4e8..23564a7 100644
--- a/target-mips/cpu.h
+++ b/target-mips/cpu.h
@@ -15,13 +15,6 @@
 #include "cpu-defs.h"
 #include "softfloat.h"
 
-// uint_fast8_t and uint_fast16_t not in <sys/int_types.h>
-// XXX: move that elsewhere
-#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
-typedef unsigned char           uint_fast8_t;
-typedef unsigned int            uint_fast16_t;
-#endif
-
 struct CPUMIPSState;
 
 typedef struct r4k_tlb_t r4k_tlb_t;
-- 
1.7.7

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

* [Qemu-devel] [PATCH 06/14] softfloat: Replace uint16 type with uint_fast16_t
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (4 preceding siblings ...)
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 05/14] target-mips: Move definition of uint_fast{8, 16}_t to osdep.h Andreas Färber
@ 2012-01-16  0:46 ` Andreas Färber
  2012-01-16 18:43   ` Peter Maydell
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 07/14] softfloat: Replace int16 type with int_fast16_t Andreas Färber
                   ` (9 subsequent siblings)
  15 siblings, 1 reply; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Blue Swirl, Christophe Lyon, malc, Juan Pineda,
	Andreas Färber, Aurelien Jarno

Based on the following Coccinelle patch:

@@
typedef uint16, uint_fast16_t;
@@
-uint16
+uint_fast16_t

Fixes the build of the Cocoa frontend on Mac OS X and avoids a
workaround for AIX.

For pre-10 Solaris include osdep.h.

Reported-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
Reported-by: Rui Carmo <rui.carmo@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Juan Pineda <juan@logician.com>
Cc: malc <av1474@comtv.ru>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
---
 fpu/softfloat.c |    8 ++++----
 fpu/softfloat.h |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 6dbcb1b..18b184b 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -6443,10 +6443,10 @@ uint32 float32_to_uint32_round_to_zero( float32 a STATUS_PARAM )
     return res;
 }
 
-uint16 float32_to_uint16_round_to_zero( float32 a STATUS_PARAM )
+uint_fast16_t float32_to_uint16_round_to_zero(float32 a STATUS_PARAM)
 {
     int64_t v;
-    uint16 res;
+    uint_fast16_t res;
 
     v = float32_to_int64_round_to_zero(a STATUS_VAR);
     if (v < 0) {
@@ -6497,10 +6497,10 @@ uint32 float64_to_uint32_round_to_zero( float64 a STATUS_PARAM )
     return res;
 }
 
-uint16 float64_to_uint16_round_to_zero( float64 a STATUS_PARAM )
+uint_fast16_t float64_to_uint16_round_to_zero(float64 a STATUS_PARAM)
 {
     int64_t v;
-    uint16 res;
+    uint_fast16_t res;
 
     v = float64_to_int64_round_to_zero(a STATUS_VAR);
     if (v < 0) {
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 07c2929..4eab04c 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -44,6 +44,7 @@ these four paragraphs for those parts of this code that are retained.
 
 #include <inttypes.h>
 #include "config-host.h"
+#include "osdep.h"
 
 /*----------------------------------------------------------------------------
 | Each of the following `typedef's defines the most convenient type that holds
@@ -57,7 +58,6 @@ typedef uint8_t flag;
 typedef uint8_t uint8;
 typedef int8_t int8;
 #ifndef _AIX
-typedef int uint16;
 typedef int int16;
 #endif
 typedef unsigned int uint32;
@@ -261,7 +261,7 @@ extern const float16 float16_default_nan;
 | Software IEC/IEEE single-precision conversion routines.
 *----------------------------------------------------------------------------*/
 int16 float32_to_int16_round_to_zero( float32 STATUS_PARAM );
-uint16 float32_to_uint16_round_to_zero( float32 STATUS_PARAM );
+uint_fast16_t float32_to_uint16_round_to_zero(float32 STATUS_PARAM);
 int32 float32_to_int32( float32 STATUS_PARAM );
 int32 float32_to_int32_round_to_zero( float32 STATUS_PARAM );
 uint32 float32_to_uint32( float32 STATUS_PARAM );
@@ -365,7 +365,7 @@ extern const float32 float32_default_nan;
 | Software IEC/IEEE double-precision conversion routines.
 *----------------------------------------------------------------------------*/
 int16 float64_to_int16_round_to_zero( float64 STATUS_PARAM );
-uint16 float64_to_uint16_round_to_zero( float64 STATUS_PARAM );
+uint_fast16_t float64_to_uint16_round_to_zero(float64 STATUS_PARAM);
 int32 float64_to_int32( float64 STATUS_PARAM );
 int32 float64_to_int32_round_to_zero( float64 STATUS_PARAM );
 uint32 float64_to_uint32( float64 STATUS_PARAM );
-- 
1.7.7

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

* [Qemu-devel] [PATCH 07/14] softfloat: Replace int16 type with int_fast16_t
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (5 preceding siblings ...)
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 06/14] softfloat: Replace uint16 type with uint_fast16_t Andreas Färber
@ 2012-01-16  0:46 ` Andreas Färber
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 08/14] softfloat: Remove unused uint8 type Andreas Färber
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Anthony Liguori, Stefan Weil, Jan Kiszka,
	Blue Swirl, Christophe Lyon, malc, Andreas Färber,
	Aurelien Jarno

Based on the following Coccinelle patch:

@@
typedef int16, int_fast16_t;
@@
-int16
+int_fast16_t

Avoids a workaround for AIX.

Add typedef for pre-10 Solaris.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: malc <av1474@comtv.ru>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
---
 fpu/softfloat-macros.h |   18 ++++----
 fpu/softfloat.c        |  114 ++++++++++++++++++++++++------------------------
 fpu/softfloat.h        |    7 +--
 osdep.h                |    1 +
 4 files changed, 69 insertions(+), 71 deletions(-)

diff --git a/fpu/softfloat-macros.h b/fpu/softfloat-macros.h
index e82ce23..b5164af 100644
--- a/fpu/softfloat-macros.h
+++ b/fpu/softfloat-macros.h
@@ -55,7 +55,7 @@ these four paragraphs for those parts of this code that are retained.
 | The result is stored in the location pointed to by `zPtr'.
 *----------------------------------------------------------------------------*/
 
-INLINE void shift32RightJamming( uint32_t a, int16 count, uint32_t *zPtr )
+INLINE void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)
 {
     uint32_t z;
 
@@ -81,7 +81,7 @@ INLINE void shift32RightJamming( uint32_t a, int16 count, uint32_t *zPtr )
 | The result is stored in the location pointed to by `zPtr'.
 *----------------------------------------------------------------------------*/
 
-INLINE void shift64RightJamming( uint64_t a, int16 count, uint64_t *zPtr )
+INLINE void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)
 {
     uint64_t z;
 
@@ -117,7 +117,7 @@ INLINE void shift64RightJamming( uint64_t a, int16 count, uint64_t *zPtr )
 
 INLINE void
  shift64ExtraRightJamming(
-     uint64_t a0, uint64_t a1, int16 count, uint64_t *z0Ptr, uint64_t *z1Ptr )
+     uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
 {
     uint64_t z0, z1;
     int8 negCount = ( - count ) & 63;
@@ -154,7 +154,7 @@ INLINE void
 
 INLINE void
  shift128Right(
-     uint64_t a0, uint64_t a1, int16 count, uint64_t *z0Ptr, uint64_t *z1Ptr )
+     uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
 {
     uint64_t z0, z1;
     int8 negCount = ( - count ) & 63;
@@ -189,7 +189,7 @@ INLINE void
 
 INLINE void
  shift128RightJamming(
-     uint64_t a0, uint64_t a1, int16 count, uint64_t *z0Ptr, uint64_t *z1Ptr )
+     uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
 {
     uint64_t z0, z1;
     int8 negCount = ( - count ) & 63;
@@ -243,7 +243,7 @@ INLINE void
      uint64_t a0,
      uint64_t a1,
      uint64_t a2,
-     int16 count,
+     int_fast16_t count,
      uint64_t *z0Ptr,
      uint64_t *z1Ptr,
      uint64_t *z2Ptr
@@ -298,7 +298,7 @@ INLINE void
 
 INLINE void
  shortShift128Left(
-     uint64_t a0, uint64_t a1, int16 count, uint64_t *z0Ptr, uint64_t *z1Ptr )
+     uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
 {
 
     *z1Ptr = a1<<count;
@@ -320,7 +320,7 @@ INLINE void
      uint64_t a0,
      uint64_t a1,
      uint64_t a2,
-     int16 count,
+     int_fast16_t count,
      uint64_t *z0Ptr,
      uint64_t *z1Ptr,
      uint64_t *z2Ptr
@@ -591,7 +591,7 @@ static uint64_t estimateDiv128To64( uint64_t a0, uint64_t a1, uint64_t b )
 | value.
 *----------------------------------------------------------------------------*/
 
-static uint32_t estimateSqrt32( int16 aExp, uint32_t a )
+static uint32_t estimateSqrt32(int_fast16_t 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 18b184b..a406a35 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -87,7 +87,7 @@ INLINE uint32_t extractFloat16Frac(float16 a)
 | Returns the exponent bits of the half-precision floating-point value `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE int16 extractFloat16Exp(float16 a)
+INLINE int_fast16_t extractFloat16Exp(float16 a)
 {
     return (float16_val(a) >> 10) & 0x1f;
 }
@@ -218,7 +218,7 @@ INLINE uint32_t extractFloat32Frac( float32 a )
 | Returns the exponent bits of the single-precision floating-point value `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE int16 extractFloat32Exp( float32 a )
+INLINE int_fast16_t extractFloat32Exp(float32 a)
 {
 
     return ( float32_val(a)>>23 ) & 0xFF;
@@ -259,7 +259,7 @@ static float32 float32_squash_input_denormal(float32 a STATUS_PARAM)
 *----------------------------------------------------------------------------*/
 
 static void
- normalizeFloat32Subnormal( uint32_t aSig, int16 *zExpPtr, uint32_t *zSigPtr )
+ normalizeFloat32Subnormal(uint32_t aSig, int_fast16_t *zExpPtr, uint32_t *zSigPtr)
 {
     int8 shiftCount;
 
@@ -280,7 +280,7 @@ static void
 | significand.
 *----------------------------------------------------------------------------*/
 
-INLINE float32 packFloat32( flag zSign, int16 zExp, uint32_t zSig )
+INLINE float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
 {
 
     return make_float32(
@@ -310,7 +310,7 @@ INLINE float32 packFloat32( flag zSign, int16 zExp, uint32_t zSig )
 | Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static float32 roundAndPackFloat32( flag zSign, int16 zExp, uint32_t zSig STATUS_PARAM)
+static float32 roundAndPackFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig STATUS_PARAM)
 {
     int8 roundingMode;
     flag roundNearestEven;
@@ -376,7 +376,7 @@ static float32 roundAndPackFloat32( flag zSign, int16 zExp, uint32_t zSig STATUS
 *----------------------------------------------------------------------------*/
 
 static float32
- normalizeRoundAndPackFloat32( flag zSign, int16 zExp, uint32_t zSig STATUS_PARAM)
+ normalizeRoundAndPackFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig STATUS_PARAM)
 {
     int8 shiftCount;
 
@@ -400,7 +400,7 @@ INLINE uint64_t extractFloat64Frac( float64 a )
 | Returns the exponent bits of the double-precision floating-point value `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE int16 extractFloat64Exp( float64 a )
+INLINE int_fast16_t extractFloat64Exp(float64 a)
 {
 
     return ( float64_val(a)>>52 ) & 0x7FF;
@@ -441,7 +441,7 @@ static float64 float64_squash_input_denormal(float64 a STATUS_PARAM)
 *----------------------------------------------------------------------------*/
 
 static void
- normalizeFloat64Subnormal( uint64_t aSig, int16 *zExpPtr, uint64_t *zSigPtr )
+ normalizeFloat64Subnormal(uint64_t aSig, int_fast16_t *zExpPtr, uint64_t *zSigPtr)
 {
     int8 shiftCount;
 
@@ -462,7 +462,7 @@ static void
 | significand.
 *----------------------------------------------------------------------------*/
 
-INLINE float64 packFloat64( flag zSign, int16 zExp, uint64_t zSig )
+INLINE float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
 {
 
     return make_float64(
@@ -492,11 +492,11 @@ INLINE float64 packFloat64( flag zSign, int16 zExp, uint64_t zSig )
 | Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static float64 roundAndPackFloat64( flag zSign, int16 zExp, uint64_t zSig STATUS_PARAM)
+static float64 roundAndPackFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig STATUS_PARAM)
 {
     int8 roundingMode;
     flag roundNearestEven;
-    int16 roundIncrement, roundBits;
+    int_fast16_t roundIncrement, roundBits;
     flag isTiny;
 
     roundingMode = STATUS(float_rounding_mode);
@@ -558,7 +558,7 @@ static float64 roundAndPackFloat64( flag zSign, int16 zExp, uint64_t zSig STATUS
 *----------------------------------------------------------------------------*/
 
 static float64
- normalizeRoundAndPackFloat64( flag zSign, int16 zExp, uint64_t zSig STATUS_PARAM)
+ normalizeRoundAndPackFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig STATUS_PARAM)
 {
     int8 shiftCount;
 
@@ -1345,7 +1345,7 @@ float128 int64_to_float128( int64 a STATUS_PARAM )
 int32 float32_to_int32( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int_fast16_t aExp, shiftCount;
     uint32_t aSig;
     uint64_t aSig64;
 
@@ -1376,7 +1376,7 @@ int32 float32_to_int32( float32 a STATUS_PARAM )
 int32 float32_to_int32_round_to_zero( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int_fast16_t aExp, shiftCount;
     uint32_t aSig;
     int32 z;
     a = float32_squash_input_denormal(a STATUS_VAR);
@@ -1416,10 +1416,10 @@ int32 float32_to_int32_round_to_zero( float32 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int16 float32_to_int16_round_to_zero( float32 a STATUS_PARAM )
+int_fast16_t float32_to_int16_round_to_zero(float32 a STATUS_PARAM)
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int_fast16_t aExp, shiftCount;
     uint32_t aSig;
     int32 z;
 
@@ -1468,7 +1468,7 @@ int16 float32_to_int16_round_to_zero( float32 a STATUS_PARAM )
 int64 float32_to_int64( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int_fast16_t aExp, shiftCount;
     uint32_t aSig;
     uint64_t aSig64, aSigExtra;
     a = float32_squash_input_denormal(a STATUS_VAR);
@@ -1505,7 +1505,7 @@ int64 float32_to_int64( float32 a STATUS_PARAM )
 int64 float32_to_int64_round_to_zero( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int_fast16_t aExp, shiftCount;
     uint32_t aSig;
     uint64_t aSig64;
     int64 z;
@@ -1549,7 +1549,7 @@ int64 float32_to_int64_round_to_zero( float32 a STATUS_PARAM )
 float64 float32_to_float64( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint32_t aSig;
     a = float32_squash_input_denormal(a STATUS_VAR);
 
@@ -1579,7 +1579,7 @@ float64 float32_to_float64( float32 a STATUS_PARAM )
 floatx80 float32_to_floatx80( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint32_t aSig;
 
     a = float32_squash_input_denormal(a STATUS_VAR);
@@ -1609,7 +1609,7 @@ floatx80 float32_to_floatx80( float32 a STATUS_PARAM )
 float128 float32_to_float128( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint32_t aSig;
 
     a = float32_squash_input_denormal(a STATUS_VAR);
@@ -1639,7 +1639,7 @@ float128 float32_to_float128( float32 a STATUS_PARAM )
 float32 float32_round_to_int( float32 a STATUS_PARAM)
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint32_t lastBitMask, roundBitsMask;
     int8 roundingMode;
     uint32_t z;
@@ -1699,9 +1699,9 @@ float32 float32_round_to_int( float32 a STATUS_PARAM)
 
 static float32 addFloat32Sigs( float32 a, float32 b, flag zSign STATUS_PARAM)
 {
-    int16 aExp, bExp, zExp;
+    int_fast16_t aExp, bExp, zExp;
     uint32_t aSig, bSig, zSig;
-    int16 expDiff;
+    int_fast16_t expDiff;
 
     aSig = extractFloat32Frac( a );
     aExp = extractFloat32Exp( a );
@@ -1778,9 +1778,9 @@ static float32 addFloat32Sigs( float32 a, float32 b, flag zSign STATUS_PARAM)
 
 static float32 subFloat32Sigs( float32 a, float32 b, flag zSign STATUS_PARAM)
 {
-    int16 aExp, bExp, zExp;
+    int_fast16_t aExp, bExp, zExp;
     uint32_t aSig, bSig, zSig;
-    int16 expDiff;
+    int_fast16_t expDiff;
 
     aSig = extractFloat32Frac( a );
     aExp = extractFloat32Exp( a );
@@ -1898,7 +1898,7 @@ float32 float32_sub( float32 a, float32 b STATUS_PARAM )
 float32 float32_mul( float32 a, float32 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
+    int_fast16_t aExp, bExp, zExp;
     uint32_t aSig, bSig;
     uint64_t zSig64;
     uint32_t zSig;
@@ -1961,7 +1961,7 @@ float32 float32_mul( float32 a, float32 b STATUS_PARAM )
 float32 float32_div( float32 a, float32 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
+    int_fast16_t aExp, bExp, zExp;
     uint32_t aSig, bSig, zSig;
     a = float32_squash_input_denormal(a STATUS_VAR);
     b = float32_squash_input_denormal(b STATUS_VAR);
@@ -2025,7 +2025,7 @@ float32 float32_div( float32 a, float32 b STATUS_PARAM )
 float32 float32_rem( float32 a, float32 b STATUS_PARAM )
 {
     flag aSign, zSign;
-    int16 aExp, bExp, expDiff;
+    int_fast16_t aExp, bExp, expDiff;
     uint32_t aSig, bSig;
     uint32_t q;
     uint64_t aSig64, bSig64, q64;
@@ -2131,7 +2131,7 @@ float32 float32_rem( float32 a, float32 b STATUS_PARAM )
 float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
 {
     flag aSign, bSign, cSign, zSign;
-    int16 aExp, bExp, cExp, pExp, zExp, expDiff;
+    int_fast16_t aExp, bExp, cExp, pExp, zExp, expDiff;
     uint32_t aSig, bSig, cSig;
     flag pInf, pZero, pSign;
     uint64_t pSig64, cSig64, zSig64;
@@ -2333,7 +2333,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
 float32 float32_sqrt( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, zExp;
+    int_fast16_t aExp, zExp;
     uint32_t aSig, zSig;
     uint64_t rem, term;
     a = float32_squash_input_denormal(a STATUS_VAR);
@@ -2419,7 +2419,7 @@ static const float64 float32_exp2_coefficients[15] =
 float32 float32_exp2( float32 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint32_t aSig;
     float64 r, x, xn;
     int i;
@@ -2467,7 +2467,7 @@ float32 float32_exp2( float32 a STATUS_PARAM )
 float32 float32_log2( float32 a STATUS_PARAM )
 {
     flag aSign, zSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint32_t aSig, zSig, i;
 
     a = float32_squash_input_denormal(a STATUS_VAR);
@@ -2732,7 +2732,7 @@ int float32_unordered_quiet( float32 a, float32 b STATUS_PARAM )
 int32 float64_to_int32( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int_fast16_t aExp, shiftCount;
     uint64_t aSig;
     a = float64_squash_input_denormal(a STATUS_VAR);
 
@@ -2760,7 +2760,7 @@ int32 float64_to_int32( float64 a STATUS_PARAM )
 int32 float64_to_int32_round_to_zero( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int_fast16_t aExp, shiftCount;
     uint64_t aSig, savedASig;
     int32 z;
     a = float64_squash_input_denormal(a STATUS_VAR);
@@ -2804,10 +2804,10 @@ int32 float64_to_int32_round_to_zero( float64 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int16 float64_to_int16_round_to_zero( float64 a STATUS_PARAM )
+int_fast16_t float64_to_int16_round_to_zero(float64 a STATUS_PARAM)
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int_fast16_t aExp, shiftCount;
     uint64_t aSig, savedASig;
     int32 z;
 
@@ -2858,7 +2858,7 @@ int16 float64_to_int16_round_to_zero( float64 a STATUS_PARAM )
 int64 float64_to_int64( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int_fast16_t aExp, shiftCount;
     uint64_t aSig, aSigExtra;
     a = float64_squash_input_denormal(a STATUS_VAR);
 
@@ -2901,7 +2901,7 @@ int64 float64_to_int64( float64 a STATUS_PARAM )
 int64 float64_to_int64_round_to_zero( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, shiftCount;
+    int_fast16_t aExp, shiftCount;
     uint64_t aSig;
     int64 z;
     a = float64_squash_input_denormal(a STATUS_VAR);
@@ -2951,7 +2951,7 @@ int64 float64_to_int64_round_to_zero( float64 a STATUS_PARAM )
 float32 float64_to_float32( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint64_t aSig;
     uint32_t zSig;
     a = float64_squash_input_denormal(a STATUS_VAR);
@@ -2984,7 +2984,7 @@ float32 float64_to_float32( float64 a STATUS_PARAM )
 | than the desired result exponent whenever `zSig' is a complete, normalized
 | significand.
 *----------------------------------------------------------------------------*/
-static float16 packFloat16(flag zSign, int16 zExp, uint16_t zSig)
+static float16 packFloat16(flag zSign, int_fast16_t zExp, uint16_t zSig)
 {
     return make_float16(
         (((uint32_t)zSign) << 15) + (((uint32_t)zExp) << 10) + zSig);
@@ -2996,7 +2996,7 @@ static float16 packFloat16(flag zSign, int16 zExp, uint16_t zSig)
 float32 float16_to_float32(float16 a, flag ieee STATUS_PARAM)
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint32_t aSig;
 
     aSign = extractFloat16Sign(a);
@@ -3026,7 +3026,7 @@ float32 float16_to_float32(float16 a, flag ieee STATUS_PARAM)
 float16 float32_to_float16(float32 a, flag ieee STATUS_PARAM)
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint32_t aSig;
     uint32_t mask;
     uint32_t increment;
@@ -3127,7 +3127,7 @@ float16 float32_to_float16(float32 a, flag ieee STATUS_PARAM)
 floatx80 float64_to_floatx80( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint64_t aSig;
 
     a = float64_squash_input_denormal(a STATUS_VAR);
@@ -3158,7 +3158,7 @@ floatx80 float64_to_floatx80( float64 a STATUS_PARAM )
 float128 float64_to_float128( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint64_t aSig, zSig0, zSig1;
 
     a = float64_squash_input_denormal(a STATUS_VAR);
@@ -3189,7 +3189,7 @@ float128 float64_to_float128( float64 a STATUS_PARAM )
 float64 float64_round_to_int( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint64_t lastBitMask, roundBitsMask;
     int8 roundingMode;
     uint64_t z;
@@ -3262,9 +3262,9 @@ float64 float64_trunc_to_int( float64 a STATUS_PARAM)
 
 static float64 addFloat64Sigs( float64 a, float64 b, flag zSign STATUS_PARAM )
 {
-    int16 aExp, bExp, zExp;
+    int_fast16_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig;
-    int16 expDiff;
+    int_fast16_t expDiff;
 
     aSig = extractFloat64Frac( a );
     aExp = extractFloat64Exp( a );
@@ -3341,9 +3341,9 @@ static float64 addFloat64Sigs( float64 a, float64 b, flag zSign STATUS_PARAM )
 
 static float64 subFloat64Sigs( float64 a, float64 b, flag zSign STATUS_PARAM )
 {
-    int16 aExp, bExp, zExp;
+    int_fast16_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig;
-    int16 expDiff;
+    int_fast16_t expDiff;
 
     aSig = extractFloat64Frac( a );
     aExp = extractFloat64Exp( a );
@@ -3461,7 +3461,7 @@ float64 float64_sub( float64 a, float64 b STATUS_PARAM )
 float64 float64_mul( float64 a, float64 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
+    int_fast16_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig0, zSig1;
 
     a = float64_squash_input_denormal(a STATUS_VAR);
@@ -3522,7 +3522,7 @@ float64 float64_mul( float64 a, float64 b STATUS_PARAM )
 float64 float64_div( float64 a, float64 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
+    int_fast16_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig;
     uint64_t rem0, rem1;
     uint64_t term0, term1;
@@ -3594,7 +3594,7 @@ float64 float64_div( float64 a, float64 b STATUS_PARAM )
 float64 float64_rem( float64 a, float64 b STATUS_PARAM )
 {
     flag aSign, zSign;
-    int16 aExp, bExp, expDiff;
+    int_fast16_t aExp, bExp, expDiff;
     uint64_t aSig, bSig;
     uint64_t q, alternateASig;
     int64_t sigMean;
@@ -3685,7 +3685,7 @@ float64 float64_rem( float64 a, float64 b STATUS_PARAM )
 float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
 {
     flag aSign, bSign, cSign, zSign;
-    int16 aExp, bExp, cExp, pExp, zExp, expDiff;
+    int_fast16_t aExp, bExp, cExp, pExp, zExp, expDiff;
     uint64_t aSig, bSig, cSig;
     flag pInf, pZero, pSign;
     uint64_t pSig0, pSig1, cSig0, cSig1, zSig0, zSig1;
@@ -3900,7 +3900,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
 float64 float64_sqrt( float64 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp, zExp;
+    int_fast16_t aExp, zExp;
     uint64_t aSig, zSig, doubleZSig;
     uint64_t rem0, rem1, term0, term1;
     a = float64_squash_input_denormal(a STATUS_VAR);
@@ -3951,7 +3951,7 @@ float64 float64_sqrt( float64 a STATUS_PARAM )
 float64 float64_log2( float64 a STATUS_PARAM )
 {
     flag aSign, zSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint64_t aSig, aSig0, aSig1, zSig, i;
     a = float64_squash_input_denormal(a STATUS_VAR);
 
@@ -4428,7 +4428,7 @@ float64 floatx80_to_float64( floatx80 a STATUS_PARAM )
 float128 floatx80_to_float128( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int16 aExp;
+    int_fast16_t aExp;
     uint64_t aSig, zSig0, zSig1;
 
     aSig = extractFloatx80Frac( a );
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 4eab04c..dbdd390 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -57,9 +57,6 @@ these four paragraphs for those parts of this code that are retained.
 typedef uint8_t flag;
 typedef uint8_t uint8;
 typedef int8_t int8;
-#ifndef _AIX
-typedef int int16;
-#endif
 typedef unsigned int uint32;
 typedef signed int int32;
 typedef uint64_t uint64;
@@ -260,7 +257,7 @@ extern const float16 float16_default_nan;
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE single-precision conversion routines.
 *----------------------------------------------------------------------------*/
-int16 float32_to_int16_round_to_zero( float32 STATUS_PARAM );
+int_fast16_t float32_to_int16_round_to_zero(float32 STATUS_PARAM);
 uint_fast16_t float32_to_uint16_round_to_zero(float32 STATUS_PARAM);
 int32 float32_to_int32( float32 STATUS_PARAM );
 int32 float32_to_int32_round_to_zero( float32 STATUS_PARAM );
@@ -364,7 +361,7 @@ extern const float32 float32_default_nan;
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE double-precision conversion routines.
 *----------------------------------------------------------------------------*/
-int16 float64_to_int16_round_to_zero( float64 STATUS_PARAM );
+int_fast16_t float64_to_int16_round_to_zero(float64 STATUS_PARAM);
 uint_fast16_t float64_to_uint16_round_to_zero(float64 STATUS_PARAM);
 int32 float64_to_int32( float64 STATUS_PARAM );
 int32 float64_to_int32_round_to_zero( float64 STATUS_PARAM );
diff --git a/osdep.h b/osdep.h
index 8f45a96..0e560aa 100644
--- a/osdep.h
+++ b/osdep.h
@@ -14,6 +14,7 @@
 /* uint_fast8_t and uint_fast16_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 glue
-- 
1.7.7

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

* [Qemu-devel] [PATCH 08/14] softfloat: Remove unused uint8 type
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (6 preceding siblings ...)
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 07/14] softfloat: Replace int16 type with int_fast16_t Andreas Färber
@ 2012-01-16  0:46 ` Andreas Färber
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 09/14] softfloat: Replace int8 type with int_fast8_t Andreas Färber
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Blue Swirl, Peter Maydell, Andreas Färber, Aurelien Jarno,
	Christophe Lyon

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 fpu/softfloat.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index dbdd390..99ff44e 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -55,7 +55,6 @@ these four paragraphs for those parts of this code that are retained.
 | to the same as `int'.
 *----------------------------------------------------------------------------*/
 typedef uint8_t flag;
-typedef uint8_t uint8;
 typedef int8_t int8;
 typedef unsigned int uint32;
 typedef signed int int32;
-- 
1.7.7

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

* [Qemu-devel] [PATCH 09/14] softfloat: Replace int8 type with int_fast8_t
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (7 preceding siblings ...)
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 08/14] softfloat: Remove unused uint8 type Andreas Färber
@ 2012-01-16  0:46 ` Andreas Färber
  2012-01-16 18:48   ` Peter Maydell
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 10/14] softfloat: Replace uint32 type with uint_fast32_t Andreas Färber
                   ` (6 subsequent siblings)
  15 siblings, 1 reply; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Anthony Liguori, Stefan Weil, Jan Kiszka,
	Blue Swirl, Christophe Lyon, Andreas Färber, Aurelien Jarno

Based on the following Coccinelle patch:

@@
typedef int8, int_fast8_t;
@@
-int8
+int_fast8_t

Add typedef for pre-10 Solaris.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
---
 fpu/softfloat-macros.h     |   26 +++++++++---------
 fpu/softfloat-specialize.h |    2 +-
 fpu/softfloat.c            |   62 ++++++++++++++++++++++----------------------
 fpu/softfloat.h            |    3 +-
 osdep.h                    |    1 +
 5 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/fpu/softfloat-macros.h b/fpu/softfloat-macros.h
index b5164af..b82871a 100644
--- a/fpu/softfloat-macros.h
+++ b/fpu/softfloat-macros.h
@@ -120,7 +120,7 @@ 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;
+    int_fast8_t negCount = (-count) & 63;
 
     if ( count == 0 ) {
         z1 = a1;
@@ -157,7 +157,7 @@ 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;
+    int_fast8_t negCount = (-count) & 63;
 
     if ( count == 0 ) {
         z1 = a1;
@@ -192,7 +192,7 @@ 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;
+    int_fast8_t negCount = (-count) & 63;
 
     if ( count == 0 ) {
         z1 = a1;
@@ -250,7 +250,7 @@ INLINE void
  )
 {
     uint64_t z0, z1, z2;
-    int8 negCount = ( - count ) & 63;
+    int_fast8_t negCount = (-count) & 63;
 
     if ( count == 0 ) {
         z2 = a2;
@@ -327,7 +327,7 @@ INLINE void
  )
 {
     uint64_t z0, z1, z2;
-    int8 negCount;
+    int_fast8_t negCount;
 
     z2 = a2<<count;
     z1 = a1<<count;
@@ -384,7 +384,7 @@ INLINE void
  )
 {
     uint64_t z0, z1, z2;
-    int8 carry0, carry1;
+    int_fast8_t carry0, carry1;
 
     z2 = a2 + b2;
     carry1 = ( z2 < a2 );
@@ -440,7 +440,7 @@ INLINE void
  )
 {
     uint64_t z0, z1, z2;
-    int8 borrow0, borrow1;
+    int_fast8_t borrow0, borrow1;
 
     z2 = a2 - b2;
     borrow1 = ( a2 < b2 );
@@ -601,7 +601,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;
+    int_fast8_t index;
     uint32_t z;
 
     index = ( a>>27 ) & 15;
@@ -625,7 +625,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 int_fast8_t countLeadingZeros32(uint32_t a)
 {
 #if SOFTFLOAT_GNUC_PREREQ(3, 4)
     if (a) {
@@ -634,7 +634,7 @@ static int8 countLeadingZeros32( uint32_t a )
         return 32;
     }
 #else
-    static const int8 countLeadingZerosHigh[] = {
+    static const int_fast8_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,
@@ -652,7 +652,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;
+    int_fast8_t shiftCount;
 
     shiftCount = 0;
     if ( a < 0x10000 ) {
@@ -673,7 +673,7 @@ static int8 countLeadingZeros32( uint32_t a )
 | `a'.  If `a' is zero, 64 is returned.
 *----------------------------------------------------------------------------*/
 
-static int8 countLeadingZeros64( uint64_t a )
+static int_fast8_t countLeadingZeros64(uint64_t a)
 {
 #if SOFTFLOAT_GNUC_PREREQ(3, 4)
     if (a) {
@@ -682,7 +682,7 @@ static int8 countLeadingZeros64( uint64_t a )
         return 64;
     }
 #else
-    int8 shiftCount;
+    int_fast8_t shiftCount;
 
     shiftCount = 0;
     if ( a < ( (uint64_t) 1 )<<32 ) {
diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index c5e2dab..d57af1a 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -114,7 +114,7 @@ const float128 float128_default_nan = make_float128(float128_default_nan_high,
 | should be simply `float_exception_flags |= flags;'.
 *----------------------------------------------------------------------------*/
 
-void float_raise( int8 flags STATUS_PARAM )
+void float_raise(int_fast8_t flags STATUS_PARAM)
 {
     STATUS(float_exception_flags) |= flags;
 }
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index a406a35..b5fa3ef 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -114,9 +114,9 @@ INLINE flag extractFloat16Sign(float16 a)
 
 static int32 roundAndPackInt32( flag zSign, uint64_t absZ STATUS_PARAM)
 {
-    int8 roundingMode;
+    int_fast8_t roundingMode;
     flag roundNearestEven;
-    int8 roundIncrement, roundBits;
+    int_fast8_t roundIncrement, roundBits;
     int32 z;
 
     roundingMode = STATUS(float_rounding_mode);
@@ -164,7 +164,7 @@ static int32 roundAndPackInt32( flag zSign, uint64_t absZ STATUS_PARAM)
 
 static int64 roundAndPackInt64( flag zSign, uint64_t absZ0, uint64_t absZ1 STATUS_PARAM)
 {
-    int8 roundingMode;
+    int_fast8_t roundingMode;
     flag roundNearestEven, increment;
     int64 z;
 
@@ -261,7 +261,7 @@ static float32 float32_squash_input_denormal(float32 a STATUS_PARAM)
 static void
  normalizeFloat32Subnormal(uint32_t aSig, int_fast16_t *zExpPtr, uint32_t *zSigPtr)
 {
-    int8 shiftCount;
+    int_fast8_t shiftCount;
 
     shiftCount = countLeadingZeros32( aSig ) - 8;
     *zSigPtr = aSig<<shiftCount;
@@ -312,9 +312,9 @@ INLINE float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
 
 static float32 roundAndPackFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig STATUS_PARAM)
 {
-    int8 roundingMode;
+    int_fast8_t roundingMode;
     flag roundNearestEven;
-    int8 roundIncrement, roundBits;
+    int_fast8_t roundIncrement, roundBits;
     flag isTiny;
 
     roundingMode = STATUS(float_rounding_mode);
@@ -378,7 +378,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 STATUS_PARAM)
 {
-    int8 shiftCount;
+    int_fast8_t shiftCount;
 
     shiftCount = countLeadingZeros32( zSig ) - 1;
     return roundAndPackFloat32( zSign, zExp - shiftCount, zSig<<shiftCount STATUS_VAR);
@@ -443,7 +443,7 @@ static float64 float64_squash_input_denormal(float64 a STATUS_PARAM)
 static void
  normalizeFloat64Subnormal(uint64_t aSig, int_fast16_t *zExpPtr, uint64_t *zSigPtr)
 {
-    int8 shiftCount;
+    int_fast8_t shiftCount;
 
     shiftCount = countLeadingZeros64( aSig ) - 11;
     *zSigPtr = aSig<<shiftCount;
@@ -494,7 +494,7 @@ INLINE float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
 
 static float64 roundAndPackFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig STATUS_PARAM)
 {
-    int8 roundingMode;
+    int_fast8_t roundingMode;
     flag roundNearestEven;
     int_fast16_t roundIncrement, roundBits;
     flag isTiny;
@@ -560,7 +560,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 STATUS_PARAM)
 {
-    int8 shiftCount;
+    int_fast8_t shiftCount;
 
     shiftCount = countLeadingZeros64( zSig ) - 1;
     return roundAndPackFloat64( zSign, zExp - shiftCount, zSig<<shiftCount STATUS_VAR);
@@ -613,7 +613,7 @@ INLINE flag extractFloatx80Sign( floatx80 a )
 static void
  normalizeFloatx80Subnormal( uint64_t aSig, int32 *zExpPtr, uint64_t *zSigPtr )
 {
-    int8 shiftCount;
+    int_fast8_t shiftCount;
 
     shiftCount = countLeadingZeros64( aSig );
     *zSigPtr = aSig<<shiftCount;
@@ -662,10 +662,10 @@ 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
+     int_fast8_t roundingPrecision, flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1
  STATUS_PARAM)
 {
-    int8 roundingMode;
+    int_fast8_t roundingMode;
     flag roundNearestEven, increment, isTiny;
     int64 roundIncrement, roundMask, roundBits;
 
@@ -834,10 +834,10 @@ static floatx80
 
 static floatx80
  normalizeRoundAndPackFloatx80(
-     int8 roundingPrecision, flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1
+     int_fast8_t roundingPrecision, flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1
  STATUS_PARAM)
 {
-    int8 shiftCount;
+    int_fast8_t shiftCount;
 
     if ( zSig0 == 0 ) {
         zSig0 = zSig1;
@@ -918,7 +918,7 @@ static void
      uint64_t *zSig1Ptr
  )
 {
-    int8 shiftCount;
+    int_fast8_t shiftCount;
 
     if ( aSig0 == 0 ) {
         shiftCount = countLeadingZeros64( aSig1 ) - 15;
@@ -989,7 +989,7 @@ static float128
  roundAndPackFloat128(
      flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2 STATUS_PARAM)
 {
-    int8 roundingMode;
+    int_fast8_t roundingMode;
     flag roundNearestEven, increment, isTiny;
 
     roundingMode = STATUS(float_rounding_mode);
@@ -1093,7 +1093,7 @@ static float128
  normalizeRoundAndPackFloat128(
      flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 STATUS_PARAM)
 {
-    int8 shiftCount;
+    int_fast8_t shiftCount;
     uint64_t zSig2;
 
     if ( zSig0 == 0 ) {
@@ -1142,7 +1142,7 @@ float64 int32_to_float64( int32 a STATUS_PARAM )
 {
     flag zSign;
     uint32 absA;
-    int8 shiftCount;
+    int_fast8_t shiftCount;
     uint64_t zSig;
 
     if ( a == 0 ) return float64_zero;
@@ -1165,7 +1165,7 @@ floatx80 int32_to_floatx80( int32 a STATUS_PARAM )
 {
     flag zSign;
     uint32 absA;
-    int8 shiftCount;
+    int_fast8_t shiftCount;
     uint64_t zSig;
 
     if ( a == 0 ) return packFloatx80( 0, 0, 0 );
@@ -1187,7 +1187,7 @@ float128 int32_to_float128( int32 a STATUS_PARAM )
 {
     flag zSign;
     uint32 absA;
-    int8 shiftCount;
+    int_fast8_t shiftCount;
     uint64_t zSig0;
 
     if ( a == 0 ) return packFloat128( 0, 0, 0, 0 );
@@ -1209,7 +1209,7 @@ float32 int64_to_float32( int64 a STATUS_PARAM )
 {
     flag zSign;
     uint64 absA;
-    int8 shiftCount;
+    int_fast8_t shiftCount;
 
     if ( a == 0 ) return float32_zero;
     zSign = ( a < 0 );
@@ -1233,7 +1233,7 @@ float32 int64_to_float32( int64 a STATUS_PARAM )
 
 float32 uint64_to_float32( uint64 a STATUS_PARAM )
 {
-    int8 shiftCount;
+    int_fast8_t shiftCount;
 
     if ( a == 0 ) return float32_zero;
     shiftCount = countLeadingZeros64( a ) - 40;
@@ -1289,7 +1289,7 @@ floatx80 int64_to_floatx80( int64 a STATUS_PARAM )
 {
     flag zSign;
     uint64 absA;
-    int8 shiftCount;
+    int_fast8_t shiftCount;
 
     if ( a == 0 ) return packFloatx80( 0, 0, 0 );
     zSign = ( a < 0 );
@@ -1309,7 +1309,7 @@ float128 int64_to_float128( int64 a STATUS_PARAM )
 {
     flag zSign;
     uint64 absA;
-    int8 shiftCount;
+    int_fast8_t shiftCount;
     int32 zExp;
     uint64_t zSig0, zSig1;
 
@@ -1641,7 +1641,7 @@ float32 float32_round_to_int( float32 a STATUS_PARAM)
     flag aSign;
     int_fast16_t aExp;
     uint32_t lastBitMask, roundBitsMask;
-    int8 roundingMode;
+    int_fast8_t roundingMode;
     uint32_t z;
     a = float32_squash_input_denormal(a STATUS_VAR);
 
@@ -3010,7 +3010,7 @@ float32 float16_to_float32(float16 a, flag ieee STATUS_PARAM)
         return packFloat32(aSign, 0xff, aSig << 13);
     }
     if (aExp == 0) {
-        int8 shiftCount;
+        int_fast8_t shiftCount;
 
         if (aSig == 0) {
             return packFloat32(aSign, 0, 0);
@@ -3030,7 +3030,7 @@ float16 float32_to_float16(float32 a, flag ieee STATUS_PARAM)
     uint32_t aSig;
     uint32_t mask;
     uint32_t increment;
-    int8 roundingMode;
+    int_fast8_t roundingMode;
     a = float32_squash_input_denormal(a STATUS_VAR);
 
     aSig = extractFloat32Frac( a );
@@ -3191,7 +3191,7 @@ float64 float64_round_to_int( float64 a STATUS_PARAM )
     flag aSign;
     int_fast16_t aExp;
     uint64_t lastBitMask, roundBitsMask;
-    int8 roundingMode;
+    int_fast8_t roundingMode;
     uint64_t z;
     a = float64_squash_input_denormal(a STATUS_VAR);
 
@@ -4454,7 +4454,7 @@ floatx80 floatx80_round_to_int( floatx80 a STATUS_PARAM )
     flag aSign;
     int32 aExp;
     uint64_t lastBitMask, roundBitsMask;
-    int8 roundingMode;
+    int_fast8_t roundingMode;
     floatx80 z;
 
     aExp = extractFloatx80Exp( a );
@@ -5529,7 +5529,7 @@ float128 float128_round_to_int( float128 a STATUS_PARAM )
     flag aSign;
     int32 aExp;
     uint64_t lastBitMask, roundBitsMask;
-    int8 roundingMode;
+    int_fast8_t roundingMode;
     float128 z;
 
     aExp = extractFloat128Exp( a );
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 99ff44e..ea18a66 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -55,7 +55,6 @@ these four paragraphs for those parts of this code that are retained.
 | to the same as `int'.
 *----------------------------------------------------------------------------*/
 typedef uint8_t flag;
-typedef int8_t int8;
 typedef unsigned int uint32;
 typedef signed int int32;
 typedef uint64_t uint64;
@@ -205,7 +204,7 @@ void set_floatx80_rounding_precision(int val STATUS_PARAM);
 | Routine to raise any or all of the software IEC/IEEE floating-point
 | exception flags.
 *----------------------------------------------------------------------------*/
-void float_raise( int8 flags STATUS_PARAM);
+void float_raise(int_fast8_t flags STATUS_PARAM);
 
 /*----------------------------------------------------------------------------
 | Options to indicate which negations to perform in float*_muladd()
diff --git a/osdep.h b/osdep.h
index 0e560aa..b87b450 100644
--- a/osdep.h
+++ b/osdep.h
@@ -14,6 +14,7 @@
 /* uint_fast8_t and uint_fast16_t not in <sys/int_types.h> */
 typedef unsigned char           uint_fast8_t;
 typedef unsigned int            uint_fast16_t;
+typedef signed char             int_fast8_t;
 typedef signed int              int_fast16_t;
 #endif
 
-- 
1.7.7

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

* [Qemu-devel] [PATCH 10/14] softfloat: Replace uint32 type with uint_fast32_t
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (8 preceding siblings ...)
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 09/14] softfloat: Replace int8 type with int_fast8_t Andreas Färber
@ 2012-01-16  0:46 ` Andreas Färber
  2012-01-16  0:47 ` [Qemu-devel] [PATCH 11/14] softfloat: Replace int32 type with int_fast32_t Andreas Färber
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:46 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Anthony Liguori, Stefan Weil, Jan Kiszka,
	Blue Swirl, Christophe Lyon, Andreas Färber, Aurelien Jarno

Based on the following Coccinelle patch:

@@
typedef uint32, uint_fast32_t;
@@
-uint32
+uint_fast32_t

Add typedef for pre-10 Solaris.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
---
 fpu/softfloat.c |   26 +++++++++++++-------------
 fpu/softfloat.h |   13 ++++++-------
 osdep.h         |    1 +
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index b5fa3ef..b71e47a 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1141,7 +1141,7 @@ float32 int32_to_float32( int32 a STATUS_PARAM )
 float64 int32_to_float64( int32 a STATUS_PARAM )
 {
     flag zSign;
-    uint32 absA;
+    uint_fast32_t absA;
     int_fast8_t shiftCount;
     uint64_t zSig;
 
@@ -1164,7 +1164,7 @@ float64 int32_to_float64( int32 a STATUS_PARAM )
 floatx80 int32_to_floatx80( int32 a STATUS_PARAM )
 {
     flag zSign;
-    uint32 absA;
+    uint_fast32_t absA;
     int_fast8_t shiftCount;
     uint64_t zSig;
 
@@ -1186,7 +1186,7 @@ floatx80 int32_to_floatx80( int32 a STATUS_PARAM )
 float128 int32_to_float128( int32 a STATUS_PARAM )
 {
     flag zSign;
-    uint32 absA;
+    uint_fast32_t absA;
     int_fast8_t shiftCount;
     uint64_t zSig0;
 
@@ -6397,20 +6397,20 @@ int float128_unordered_quiet( float128 a, float128 b STATUS_PARAM )
 }
 
 /* misc functions */
-float32 uint32_to_float32( uint32 a STATUS_PARAM )
+float32 uint32_to_float32(uint_fast32_t a STATUS_PARAM)
 {
     return int64_to_float32(a STATUS_VAR);
 }
 
-float64 uint32_to_float64( uint32 a STATUS_PARAM )
+float64 uint32_to_float64(uint_fast32_t a STATUS_PARAM)
 {
     return int64_to_float64(a STATUS_VAR);
 }
 
-uint32 float32_to_uint32( float32 a STATUS_PARAM )
+uint_fast32_t float32_to_uint32(float32 a STATUS_PARAM)
 {
     int64_t v;
-    uint32 res;
+    uint_fast32_t res;
 
     v = float32_to_int64(a STATUS_VAR);
     if (v < 0) {
@@ -6425,10 +6425,10 @@ uint32 float32_to_uint32( float32 a STATUS_PARAM )
     return res;
 }
 
-uint32 float32_to_uint32_round_to_zero( float32 a STATUS_PARAM )
+uint_fast32_t float32_to_uint32_round_to_zero(float32 a STATUS_PARAM)
 {
     int64_t v;
-    uint32 res;
+    uint_fast32_t res;
 
     v = float32_to_int64_round_to_zero(a STATUS_VAR);
     if (v < 0) {
@@ -6461,10 +6461,10 @@ uint_fast16_t float32_to_uint16_round_to_zero(float32 a STATUS_PARAM)
     return res;
 }
 
-uint32 float64_to_uint32( float64 a STATUS_PARAM )
+uint_fast32_t float64_to_uint32(float64 a STATUS_PARAM)
 {
     int64_t v;
-    uint32 res;
+    uint_fast32_t res;
 
     v = float64_to_int64(a STATUS_VAR);
     if (v < 0) {
@@ -6479,10 +6479,10 @@ uint32 float64_to_uint32( float64 a STATUS_PARAM )
     return res;
 }
 
-uint32 float64_to_uint32_round_to_zero( float64 a STATUS_PARAM )
+uint_fast32_t float64_to_uint32_round_to_zero(float64 a STATUS_PARAM)
 {
     int64_t v;
-    uint32 res;
+    uint_fast32_t res;
 
     v = float64_to_int64_round_to_zero(a STATUS_VAR);
     if (v < 0) {
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index ea18a66..b29fd24 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -55,7 +55,6 @@ these four paragraphs for those parts of this code that are retained.
 | to the same as `int'.
 *----------------------------------------------------------------------------*/
 typedef uint8_t flag;
-typedef unsigned int uint32;
 typedef signed int int32;
 typedef uint64_t uint64;
 typedef int64_t int64;
@@ -223,8 +222,8 @@ enum {
 *----------------------------------------------------------------------------*/
 float32 int32_to_float32( int32 STATUS_PARAM );
 float64 int32_to_float64( int32 STATUS_PARAM );
-float32 uint32_to_float32( uint32 STATUS_PARAM );
-float64 uint32_to_float64( uint32 STATUS_PARAM );
+float32 uint32_to_float32(uint_fast32_t STATUS_PARAM);
+float64 uint32_to_float64(uint_fast32_t STATUS_PARAM);
 floatx80 int32_to_floatx80( int32 STATUS_PARAM );
 float128 int32_to_float128( int32 STATUS_PARAM );
 float32 int64_to_float32( int64 STATUS_PARAM );
@@ -259,8 +258,8 @@ int_fast16_t float32_to_int16_round_to_zero(float32 STATUS_PARAM);
 uint_fast16_t float32_to_uint16_round_to_zero(float32 STATUS_PARAM);
 int32 float32_to_int32( float32 STATUS_PARAM );
 int32 float32_to_int32_round_to_zero( float32 STATUS_PARAM );
-uint32 float32_to_uint32( float32 STATUS_PARAM );
-uint32 float32_to_uint32_round_to_zero( float32 STATUS_PARAM );
+uint_fast32_t float32_to_uint32(float32 STATUS_PARAM);
+uint_fast32_t float32_to_uint32_round_to_zero(float32 STATUS_PARAM);
 int64 float32_to_int64( float32 STATUS_PARAM );
 int64 float32_to_int64_round_to_zero( float32 STATUS_PARAM );
 float64 float32_to_float64( float32 STATUS_PARAM );
@@ -363,8 +362,8 @@ int_fast16_t float64_to_int16_round_to_zero(float64 STATUS_PARAM);
 uint_fast16_t float64_to_uint16_round_to_zero(float64 STATUS_PARAM);
 int32 float64_to_int32( float64 STATUS_PARAM );
 int32 float64_to_int32_round_to_zero( float64 STATUS_PARAM );
-uint32 float64_to_uint32( float64 STATUS_PARAM );
-uint32 float64_to_uint32_round_to_zero( float64 STATUS_PARAM );
+uint_fast32_t float64_to_uint32(float64 STATUS_PARAM);
+uint_fast32_t float64_to_uint32_round_to_zero(float64 STATUS_PARAM);
 int64 float64_to_int64( float64 STATUS_PARAM );
 int64 float64_to_int64_round_to_zero( float64 STATUS_PARAM );
 uint64 float64_to_uint64 (float64 a STATUS_PARAM);
diff --git a/osdep.h b/osdep.h
index b87b450..c7f3a4e 100644
--- a/osdep.h
+++ b/osdep.h
@@ -14,6 +14,7 @@
 /* uint_fast8_t and uint_fast16_t not in <sys/int_types.h> */
 typedef unsigned char           uint_fast8_t;
 typedef unsigned int            uint_fast16_t;
+typedef unsigned int            uint_fast32_t;
 typedef signed char             int_fast8_t;
 typedef signed int              int_fast16_t;
 #endif
-- 
1.7.7

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

* [Qemu-devel] [PATCH 11/14] softfloat: Replace int32 type with int_fast32_t
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (9 preceding siblings ...)
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 10/14] softfloat: Replace uint32 type with uint_fast32_t Andreas Färber
@ 2012-01-16  0:47 ` Andreas Färber
  2012-01-16  0:47 ` [Qemu-devel] [PATCH 12/14] softfloat: Replace uint64 type with uint_fast64_t Andreas Färber
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Anthony Liguori, Stefan Weil, Jan Kiszka,
	Blue Swirl, Christophe Lyon, Andreas Färber, Aurelien Jarno

Based on the following Coccinelle patch:

@@
typedef int32, int_fast32_t;
@@
-int32
+int_fast32_t

Add typedef for pre-10 Solaris.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
---
 fpu/softfloat.c |  124 +++++++++++++++++++++++++++---------------------------
 fpu/softfloat.h |   25 +++++------
 osdep.h         |    1 +
 3 files changed, 75 insertions(+), 75 deletions(-)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index b71e47a..b7cd589 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -112,12 +112,12 @@ INLINE flag extractFloat16Sign(float16 a)
 | positive or negative integer is returned.
 *----------------------------------------------------------------------------*/
 
-static int32 roundAndPackInt32( flag zSign, uint64_t absZ STATUS_PARAM)
+static int_fast32_t roundAndPackInt32(flag zSign, uint64_t absZ STATUS_PARAM)
 {
     int_fast8_t roundingMode;
     flag roundNearestEven;
     int_fast8_t roundIncrement, roundBits;
-    int32 z;
+    int_fast32_t z;
 
     roundingMode = STATUS(float_rounding_mode);
     roundNearestEven = ( roundingMode == float_round_nearest_even );
@@ -584,7 +584,7 @@ INLINE uint64_t extractFloatx80Frac( floatx80 a )
 | value `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE int32 extractFloatx80Exp( floatx80 a )
+INLINE int_fast32_t extractFloatx80Exp(floatx80 a)
 {
 
     return a.high & 0x7FFF;
@@ -611,7 +611,7 @@ INLINE flag extractFloatx80Sign( floatx80 a )
 *----------------------------------------------------------------------------*/
 
 static void
- normalizeFloatx80Subnormal( uint64_t aSig, int32 *zExpPtr, uint64_t *zSigPtr )
+ normalizeFloatx80Subnormal(uint64_t aSig, int_fast32_t *zExpPtr, uint64_t *zSigPtr)
 {
     int_fast8_t shiftCount;
 
@@ -626,7 +626,7 @@ static void
 | extended double-precision floating-point value, returning the result.
 *----------------------------------------------------------------------------*/
 
-INLINE floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig )
+INLINE floatx80 packFloatx80(flag zSign, int_fast32_t zExp, uint64_t zSig)
 {
     floatx80 z;
 
@@ -662,7 +662,7 @@ INLINE floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig )
 
 static floatx80
  roundAndPackFloatx80(
-     int_fast8_t roundingPrecision, flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1
+     int_fast8_t roundingPrecision, flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1
  STATUS_PARAM)
 {
     int_fast8_t roundingMode;
@@ -834,7 +834,7 @@ static floatx80
 
 static floatx80
  normalizeRoundAndPackFloatx80(
-     int_fast8_t roundingPrecision, flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1
+     int_fast8_t roundingPrecision, flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1
  STATUS_PARAM)
 {
     int_fast8_t shiftCount;
@@ -881,7 +881,7 @@ INLINE uint64_t extractFloat128Frac0( float128 a )
 | `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE int32 extractFloat128Exp( float128 a )
+INLINE int_fast32_t extractFloat128Exp(float128 a)
 {
 
     return ( a.high>>48 ) & 0x7FFF;
@@ -913,7 +913,7 @@ static void
  normalizeFloat128Subnormal(
      uint64_t aSig0,
      uint64_t aSig1,
-     int32 *zExpPtr,
+     int_fast32_t *zExpPtr,
      uint64_t *zSig0Ptr,
      uint64_t *zSig1Ptr
  )
@@ -954,7 +954,7 @@ static void
 *----------------------------------------------------------------------------*/
 
 INLINE float128
- packFloat128( flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 )
+ packFloat128(flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1)
 {
     float128 z;
 
@@ -987,7 +987,7 @@ INLINE float128
 
 static float128
  roundAndPackFloat128(
-     flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2 STATUS_PARAM)
+     flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2 STATUS_PARAM)
 {
     int_fast8_t roundingMode;
     flag roundNearestEven, increment, isTiny;
@@ -1091,7 +1091,7 @@ static float128
 
 static float128
  normalizeRoundAndPackFloat128(
-     flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 STATUS_PARAM)
+     flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1 STATUS_PARAM)
 {
     int_fast8_t shiftCount;
     uint64_t zSig2;
@@ -1121,7 +1121,7 @@ static float128
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float32 int32_to_float32( int32 a STATUS_PARAM )
+float32 int32_to_float32(int_fast32_t a STATUS_PARAM)
 {
     flag zSign;
 
@@ -1138,7 +1138,7 @@ float32 int32_to_float32( int32 a STATUS_PARAM )
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float64 int32_to_float64( int32 a STATUS_PARAM )
+float64 int32_to_float64(int_fast32_t a STATUS_PARAM)
 {
     flag zSign;
     uint_fast32_t absA;
@@ -1161,7 +1161,7 @@ float64 int32_to_float64( int32 a STATUS_PARAM )
 | Arithmetic.
 *----------------------------------------------------------------------------*/
 
-floatx80 int32_to_floatx80( int32 a STATUS_PARAM )
+floatx80 int32_to_floatx80(int_fast32_t a STATUS_PARAM)
 {
     flag zSign;
     uint_fast32_t absA;
@@ -1183,7 +1183,7 @@ floatx80 int32_to_floatx80( int32 a STATUS_PARAM )
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float128 int32_to_float128( int32 a STATUS_PARAM )
+float128 int32_to_float128(int_fast32_t a STATUS_PARAM)
 {
     flag zSign;
     uint_fast32_t absA;
@@ -1310,7 +1310,7 @@ float128 int64_to_float128( int64 a STATUS_PARAM )
     flag zSign;
     uint64 absA;
     int_fast8_t shiftCount;
-    int32 zExp;
+    int_fast32_t zExp;
     uint64_t zSig0, zSig1;
 
     if ( a == 0 ) return packFloat128( 0, 0, 0, 0 );
@@ -1342,7 +1342,7 @@ float128 int64_to_float128( int64 a STATUS_PARAM )
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int32 float32_to_int32( float32 a STATUS_PARAM )
+int_fast32_t float32_to_int32(float32 a STATUS_PARAM)
 {
     flag aSign;
     int_fast16_t aExp, shiftCount;
@@ -1373,12 +1373,12 @@ int32 float32_to_int32( float32 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int32 float32_to_int32_round_to_zero( float32 a STATUS_PARAM )
+int_fast32_t float32_to_int32_round_to_zero(float32 a STATUS_PARAM)
 {
     flag aSign;
     int_fast16_t aExp, shiftCount;
     uint32_t aSig;
-    int32 z;
+    int_fast32_t z;
     a = float32_squash_input_denormal(a STATUS_VAR);
 
     aSig = extractFloat32Frac( a );
@@ -1421,7 +1421,7 @@ int_fast16_t float32_to_int16_round_to_zero(float32 a STATUS_PARAM)
     flag aSign;
     int_fast16_t aExp, shiftCount;
     uint32_t aSig;
-    int32 z;
+    int_fast32_t z;
 
     aSig = extractFloat32Frac( a );
     aExp = extractFloat32Exp( a );
@@ -2729,7 +2729,7 @@ int float32_unordered_quiet( float32 a, float32 b STATUS_PARAM )
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int32 float64_to_int32( float64 a STATUS_PARAM )
+int_fast32_t float64_to_int32(float64 a STATUS_PARAM)
 {
     flag aSign;
     int_fast16_t aExp, shiftCount;
@@ -2757,12 +2757,12 @@ int32 float64_to_int32( float64 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int32 float64_to_int32_round_to_zero( float64 a STATUS_PARAM )
+int_fast32_t float64_to_int32_round_to_zero(float64 a STATUS_PARAM)
 {
     flag aSign;
     int_fast16_t aExp, shiftCount;
     uint64_t aSig, savedASig;
-    int32 z;
+    int_fast32_t z;
     a = float64_squash_input_denormal(a STATUS_VAR);
 
     aSig = extractFloat64Frac( a );
@@ -2809,7 +2809,7 @@ int_fast16_t float64_to_int16_round_to_zero(float64 a STATUS_PARAM)
     flag aSign;
     int_fast16_t aExp, shiftCount;
     uint64_t aSig, savedASig;
-    int32 z;
+    int_fast32_t z;
 
     aSig = extractFloat64Frac( a );
     aExp = extractFloat64Exp( a );
@@ -4216,10 +4216,10 @@ int float64_unordered_quiet( float64 a, float64 b STATUS_PARAM )
 | overflows, the largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int32 floatx80_to_int32( floatx80 a STATUS_PARAM )
+int_fast32_t floatx80_to_int32(floatx80 a STATUS_PARAM)
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int_fast32_t aExp, shiftCount;
     uint64_t aSig;
 
     aSig = extractFloatx80Frac( a );
@@ -4243,12 +4243,12 @@ int32 floatx80_to_int32( floatx80 a STATUS_PARAM )
 | sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int32 floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM )
+int_fast32_t floatx80_to_int32_round_to_zero(floatx80 a STATUS_PARAM)
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int_fast32_t aExp, shiftCount;
     uint64_t aSig, savedASig;
-    int32 z;
+    int_fast32_t z;
 
     aSig = extractFloatx80Frac( a );
     aExp = extractFloatx80Exp( a );
@@ -4291,7 +4291,7 @@ int32 floatx80_to_int32_round_to_zero( floatx80 a STATUS_PARAM )
 int64 floatx80_to_int64( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int_fast32_t aExp, shiftCount;
     uint64_t aSig, aSigExtra;
 
     aSig = extractFloatx80Frac( a );
@@ -4331,7 +4331,7 @@ int64 floatx80_to_int64( floatx80 a STATUS_PARAM )
 int64 floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int_fast32_t aExp, shiftCount;
     uint64_t aSig;
     int64 z;
 
@@ -4372,7 +4372,7 @@ int64 floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM )
 float32 floatx80_to_float32( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int_fast32_t aExp;
     uint64_t aSig;
 
     aSig = extractFloatx80Frac( a );
@@ -4400,7 +4400,7 @@ float32 floatx80_to_float32( floatx80 a STATUS_PARAM )
 float64 floatx80_to_float64( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int_fast32_t aExp;
     uint64_t aSig, zSig;
 
     aSig = extractFloatx80Frac( a );
@@ -4452,7 +4452,7 @@ float128 floatx80_to_float128( floatx80 a STATUS_PARAM )
 floatx80 floatx80_round_to_int( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int_fast32_t aExp;
     uint64_t lastBitMask, roundBitsMask;
     int_fast8_t roundingMode;
     floatx80 z;
@@ -4525,9 +4525,9 @@ floatx80 floatx80_round_to_int( floatx80 a STATUS_PARAM )
 
 static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM)
 {
-    int32 aExp, bExp, zExp;
+    int_fast32_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig0, zSig1;
-    int32 expDiff;
+    int_fast32_t expDiff;
 
     aSig = extractFloatx80Frac( a );
     aExp = extractFloatx80Exp( a );
@@ -4591,9 +4591,9 @@ static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM
 
 static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM )
 {
-    int32 aExp, bExp, zExp;
+    int_fast32_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig0, zSig1;
-    int32 expDiff;
+    int_fast32_t expDiff;
     floatx80 z;
 
     aSig = extractFloatx80Frac( a );
@@ -4700,7 +4700,7 @@ floatx80 floatx80_sub( floatx80 a, floatx80 b STATUS_PARAM )
 floatx80 floatx80_mul( floatx80 a, floatx80 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int32 aExp, bExp, zExp;
+    int_fast32_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig0, zSig1;
     floatx80 z;
 
@@ -4759,7 +4759,7 @@ floatx80 floatx80_mul( floatx80 a, floatx80 b STATUS_PARAM )
 floatx80 floatx80_div( floatx80 a, floatx80 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int32 aExp, bExp, zExp;
+    int_fast32_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig0, zSig1;
     uint64_t rem0, rem1, rem2, term0, term1, term2;
     floatx80 z;
@@ -4839,7 +4839,7 @@ floatx80 floatx80_div( floatx80 a, floatx80 b STATUS_PARAM )
 floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM )
 {
     flag aSign, zSign;
-    int32 aExp, bExp, expDiff;
+    int_fast32_t aExp, bExp, expDiff;
     uint64_t aSig0, aSig1, bSig;
     uint64_t q, term0, term1, alternateASig0, alternateASig1;
     floatx80 z;
@@ -4935,7 +4935,7 @@ floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM )
 floatx80 floatx80_sqrt( floatx80 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, zExp;
+    int_fast32_t aExp, zExp;
     uint64_t aSig0, aSig1, zSig0, zSig1, doubleZSig0;
     uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3;
     floatx80 z;
@@ -5243,10 +5243,10 @@ int floatx80_unordered_quiet( floatx80 a, floatx80 b STATUS_PARAM )
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int32 float128_to_int32( float128 a STATUS_PARAM )
+int_fast32_t float128_to_int32(float128 a STATUS_PARAM)
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int_fast32_t aExp, shiftCount;
     uint64_t aSig0, aSig1;
 
     aSig1 = extractFloat128Frac1( a );
@@ -5272,12 +5272,12 @@ int32 float128_to_int32( float128 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int32 float128_to_int32_round_to_zero( float128 a STATUS_PARAM )
+int_fast32_t float128_to_int32_round_to_zero(float128 a STATUS_PARAM)
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int_fast32_t aExp, shiftCount;
     uint64_t aSig0, aSig1, savedASig;
-    int32 z;
+    int_fast32_t z;
 
     aSig1 = extractFloat128Frac1( a );
     aSig0 = extractFloat128Frac0( a );
@@ -5323,7 +5323,7 @@ int32 float128_to_int32_round_to_zero( float128 a STATUS_PARAM )
 int64 float128_to_int64( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int_fast32_t aExp, shiftCount;
     uint64_t aSig0, aSig1;
 
     aSig1 = extractFloat128Frac1( a );
@@ -5366,7 +5366,7 @@ int64 float128_to_int64( float128 a STATUS_PARAM )
 int64 float128_to_int64_round_to_zero( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, shiftCount;
+    int_fast32_t aExp, shiftCount;
     uint64_t aSig0, aSig1;
     int64 z;
 
@@ -5424,7 +5424,7 @@ int64 float128_to_int64_round_to_zero( float128 a STATUS_PARAM )
 float32 float128_to_float32( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int_fast32_t aExp;
     uint64_t aSig0, aSig1;
     uint32_t zSig;
 
@@ -5459,7 +5459,7 @@ float32 float128_to_float32( float128 a STATUS_PARAM )
 float64 float128_to_float64( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int_fast32_t aExp;
     uint64_t aSig0, aSig1;
 
     aSig1 = extractFloat128Frac1( a );
@@ -5492,7 +5492,7 @@ float64 float128_to_float64( float128 a STATUS_PARAM )
 floatx80 float128_to_floatx80( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int_fast32_t aExp;
     uint64_t aSig0, aSig1;
 
     aSig1 = extractFloat128Frac1( a );
@@ -5527,7 +5527,7 @@ floatx80 float128_to_floatx80( float128 a STATUS_PARAM )
 float128 float128_round_to_int( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp;
+    int_fast32_t aExp;
     uint64_t lastBitMask, roundBitsMask;
     int_fast8_t roundingMode;
     float128 z;
@@ -5630,9 +5630,9 @@ float128 float128_round_to_int( float128 a STATUS_PARAM )
 
 static float128 addFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM)
 {
-    int32 aExp, bExp, zExp;
+    int_fast32_t aExp, bExp, zExp;
     uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2;
-    int32 expDiff;
+    int_fast32_t expDiff;
 
     aSig1 = extractFloat128Frac1( a );
     aSig0 = extractFloat128Frac0( a );
@@ -5716,9 +5716,9 @@ static float128 addFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM
 
 static float128 subFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM)
 {
-    int32 aExp, bExp, zExp;
+    int_fast32_t aExp, bExp, zExp;
     uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1;
-    int32 expDiff;
+    int_fast32_t expDiff;
     float128 z;
 
     aSig1 = extractFloat128Frac1( a );
@@ -5841,7 +5841,7 @@ float128 float128_sub( float128 a, float128 b STATUS_PARAM )
 float128 float128_mul( float128 a, float128 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int32 aExp, bExp, zExp;
+    int_fast32_t aExp, bExp, zExp;
     uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2, zSig3;
     float128 z;
 
@@ -5905,7 +5905,7 @@ float128 float128_mul( float128 a, float128 b STATUS_PARAM )
 float128 float128_div( float128 a, float128 b STATUS_PARAM )
 {
     flag aSign, bSign, zSign;
-    int32 aExp, bExp, zExp;
+    int_fast32_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;
@@ -5989,7 +5989,7 @@ float128 float128_div( float128 a, float128 b STATUS_PARAM )
 float128 float128_rem( float128 a, float128 b STATUS_PARAM )
 {
     flag aSign, zSign;
-    int32 aExp, bExp, expDiff;
+    int_fast32_t aExp, bExp, expDiff;
     uint64_t aSig0, aSig1, bSig0, bSig1, q, term0, term1, term2;
     uint64_t allZero, alternateASig0, alternateASig1, sigMean1;
     int64_t sigMean0;
@@ -6098,7 +6098,7 @@ float128 float128_rem( float128 a, float128 b STATUS_PARAM )
 float128 float128_sqrt( float128 a STATUS_PARAM )
 {
     flag aSign;
-    int32 aExp, zExp;
+    int_fast32_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/fpu/softfloat.h b/fpu/softfloat.h
index b29fd24..9987443 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -55,7 +55,6 @@ these four paragraphs for those parts of this code that are retained.
 | to the same as `int'.
 *----------------------------------------------------------------------------*/
 typedef uint8_t flag;
-typedef signed int int32;
 typedef uint64_t uint64;
 typedef int64_t int64;
 
@@ -220,12 +219,12 @@ enum {
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE integer-to-floating-point conversion routines.
 *----------------------------------------------------------------------------*/
-float32 int32_to_float32( int32 STATUS_PARAM );
-float64 int32_to_float64( int32 STATUS_PARAM );
+float32 int32_to_float32(int_fast32_t STATUS_PARAM);
+float64 int32_to_float64(int_fast32_t STATUS_PARAM);
 float32 uint32_to_float32(uint_fast32_t STATUS_PARAM);
 float64 uint32_to_float64(uint_fast32_t STATUS_PARAM);
-floatx80 int32_to_floatx80( int32 STATUS_PARAM );
-float128 int32_to_float128( int32 STATUS_PARAM );
+floatx80 int32_to_floatx80(int_fast32_t STATUS_PARAM);
+float128 int32_to_float128(int_fast32_t STATUS_PARAM);
 float32 int64_to_float32( int64 STATUS_PARAM );
 float32 uint64_to_float32( uint64 STATUS_PARAM );
 float64 int64_to_float64( int64 STATUS_PARAM );
@@ -256,8 +255,8 @@ extern const float16 float16_default_nan;
 *----------------------------------------------------------------------------*/
 int_fast16_t float32_to_int16_round_to_zero(float32 STATUS_PARAM);
 uint_fast16_t float32_to_uint16_round_to_zero(float32 STATUS_PARAM);
-int32 float32_to_int32( float32 STATUS_PARAM );
-int32 float32_to_int32_round_to_zero( float32 STATUS_PARAM );
+int_fast32_t float32_to_int32(float32 STATUS_PARAM);
+int_fast32_t float32_to_int32_round_to_zero(float32 STATUS_PARAM);
 uint_fast32_t float32_to_uint32(float32 STATUS_PARAM);
 uint_fast32_t float32_to_uint32_round_to_zero(float32 STATUS_PARAM);
 int64 float32_to_int64( float32 STATUS_PARAM );
@@ -360,8 +359,8 @@ extern const float32 float32_default_nan;
 *----------------------------------------------------------------------------*/
 int_fast16_t float64_to_int16_round_to_zero(float64 STATUS_PARAM);
 uint_fast16_t float64_to_uint16_round_to_zero(float64 STATUS_PARAM);
-int32 float64_to_int32( float64 STATUS_PARAM );
-int32 float64_to_int32_round_to_zero( float64 STATUS_PARAM );
+int_fast32_t float64_to_int32(float64 STATUS_PARAM);
+int_fast32_t float64_to_int32_round_to_zero(float64 STATUS_PARAM);
 uint_fast32_t float64_to_uint32(float64 STATUS_PARAM);
 uint_fast32_t float64_to_uint32_round_to_zero(float64 STATUS_PARAM);
 int64 float64_to_int64( float64 STATUS_PARAM );
@@ -464,8 +463,8 @@ extern const float64 float64_default_nan;
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE extended double-precision conversion routines.
 *----------------------------------------------------------------------------*/
-int32 floatx80_to_int32( floatx80 STATUS_PARAM );
-int32 floatx80_to_int32_round_to_zero( floatx80 STATUS_PARAM );
+int_fast32_t floatx80_to_int32(floatx80 STATUS_PARAM);
+int_fast32_t floatx80_to_int32_round_to_zero(floatx80 STATUS_PARAM);
 int64 floatx80_to_int64( floatx80 STATUS_PARAM );
 int64 floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM );
 float32 floatx80_to_float32( floatx80 STATUS_PARAM );
@@ -549,8 +548,8 @@ extern const floatx80 floatx80_default_nan;
 /*----------------------------------------------------------------------------
 | Software IEC/IEEE quadruple-precision conversion routines.
 *----------------------------------------------------------------------------*/
-int32 float128_to_int32( float128 STATUS_PARAM );
-int32 float128_to_int32_round_to_zero( float128 STATUS_PARAM );
+int_fast32_t float128_to_int32(float128 STATUS_PARAM);
+int_fast32_t float128_to_int32_round_to_zero(float128 STATUS_PARAM);
 int64 float128_to_int64( float128 STATUS_PARAM );
 int64 float128_to_int64_round_to_zero( float128 STATUS_PARAM );
 float32 float128_to_float32( float128 STATUS_PARAM );
diff --git a/osdep.h b/osdep.h
index c7f3a4e..935810f 100644
--- a/osdep.h
+++ b/osdep.h
@@ -17,6 +17,7 @@ typedef unsigned int            uint_fast16_t;
 typedef unsigned int            uint_fast32_t;
 typedef signed char             int_fast8_t;
 typedef signed int              int_fast16_t;
+typedef signed int              int_fast32_t;
 #endif
 
 #ifndef glue
-- 
1.7.7

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

* [Qemu-devel] [PATCH 12/14] softfloat: Replace uint64 type with uint_fast64_t
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (10 preceding siblings ...)
  2012-01-16  0:47 ` [Qemu-devel] [PATCH 11/14] softfloat: Replace int32 type with int_fast32_t Andreas Färber
@ 2012-01-16  0:47 ` Andreas Färber
  2012-01-16  0:47 ` [Qemu-devel] [PATCH 13/14] softfloat: Replace int64 type with int_fast64_t Andreas Färber
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Anthony Liguori, Stefan Weil, Jan Kiszka,
	Blue Swirl, Christophe Lyon, Andreas Färber, Aurelien Jarno

Based on the following Coccinelle patch:

@@
typedef uint64, uint_fast64_t;
@@
-uint64
+uint_fast_64_t

Add a typedef for pre-10 Solaris.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
---
 fpu/softfloat.c |   10 +++++-----
 fpu/softfloat.h |    9 ++++-----
 osdep.h         |    1 +
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index b7cd589..ace2ca2 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1208,7 +1208,7 @@ float128 int32_to_float128(int_fast32_t a STATUS_PARAM)
 float32 int64_to_float32( int64 a STATUS_PARAM )
 {
     flag zSign;
-    uint64 absA;
+    uint_fast64_t absA;
     int_fast8_t shiftCount;
 
     if ( a == 0 ) return float32_zero;
@@ -1231,7 +1231,7 @@ float32 int64_to_float32( int64 a STATUS_PARAM )
 
 }
 
-float32 uint64_to_float32( uint64 a STATUS_PARAM )
+float32 uint64_to_float32(uint_fast64_t a STATUS_PARAM)
 {
     int_fast8_t shiftCount;
 
@@ -1271,7 +1271,7 @@ float64 int64_to_float64( int64 a STATUS_PARAM )
 
 }
 
-float64 uint64_to_float64( uint64 a STATUS_PARAM )
+float64 uint64_to_float64(uint_fast64_t a STATUS_PARAM)
 {
     if ( a == 0 ) return float64_zero;
     return normalizeRoundAndPackFloat64( 0, 0x43C, a STATUS_VAR );
@@ -1288,7 +1288,7 @@ float64 uint64_to_float64( uint64 a STATUS_PARAM )
 floatx80 int64_to_floatx80( int64 a STATUS_PARAM )
 {
     flag zSign;
-    uint64 absA;
+    uint_fast64_t absA;
     int_fast8_t shiftCount;
 
     if ( a == 0 ) return packFloatx80( 0, 0, 0 );
@@ -1308,7 +1308,7 @@ floatx80 int64_to_floatx80( int64 a STATUS_PARAM )
 float128 int64_to_float128( int64 a STATUS_PARAM )
 {
     flag zSign;
-    uint64 absA;
+    uint_fast64_t absA;
     int_fast8_t shiftCount;
     int_fast32_t zExp;
     uint64_t zSig0, zSig1;
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 9987443..ce28906 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -55,7 +55,6 @@ these four paragraphs for those parts of this code that are retained.
 | to the same as `int'.
 *----------------------------------------------------------------------------*/
 typedef uint8_t flag;
-typedef uint64_t uint64;
 typedef int64_t int64;
 
 #define LIT64( a ) a##LL
@@ -226,9 +225,9 @@ float64 uint32_to_float64(uint_fast32_t STATUS_PARAM);
 floatx80 int32_to_floatx80(int_fast32_t STATUS_PARAM);
 float128 int32_to_float128(int_fast32_t STATUS_PARAM);
 float32 int64_to_float32( int64 STATUS_PARAM );
-float32 uint64_to_float32( uint64 STATUS_PARAM );
+float32 uint64_to_float32(uint_fast64_t STATUS_PARAM);
 float64 int64_to_float64( int64 STATUS_PARAM );
-float64 uint64_to_float64( uint64 STATUS_PARAM );
+float64 uint64_to_float64(uint_fast64_t STATUS_PARAM);
 floatx80 int64_to_floatx80( int64 STATUS_PARAM );
 float128 int64_to_float128( int64 STATUS_PARAM );
 
@@ -365,8 +364,8 @@ uint_fast32_t float64_to_uint32(float64 STATUS_PARAM);
 uint_fast32_t float64_to_uint32_round_to_zero(float64 STATUS_PARAM);
 int64 float64_to_int64( float64 STATUS_PARAM );
 int64 float64_to_int64_round_to_zero( float64 STATUS_PARAM );
-uint64 float64_to_uint64 (float64 a STATUS_PARAM);
-uint64 float64_to_uint64_round_to_zero (float64 a STATUS_PARAM);
+uint_fast64_t float64_to_uint64(float64 a STATUS_PARAM);
+uint_fast64_t float64_to_uint64_round_to_zero(float64 a STATUS_PARAM);
 float32 float64_to_float32( float64 STATUS_PARAM );
 floatx80 float64_to_floatx80( float64 STATUS_PARAM );
 float128 float64_to_float128( float64 STATUS_PARAM );
diff --git a/osdep.h b/osdep.h
index 935810f..a30bd6a 100644
--- a/osdep.h
+++ b/osdep.h
@@ -15,6 +15,7 @@
 typedef unsigned char           uint_fast8_t;
 typedef unsigned int            uint_fast16_t;
 typedef unsigned int            uint_fast32_t;
+typedef uint64_t                uint_fast64_t;
 typedef signed char             int_fast8_t;
 typedef signed int              int_fast16_t;
 typedef signed int              int_fast32_t;
-- 
1.7.7

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

* [Qemu-devel] [PATCH 13/14] softfloat: Replace int64 type with int_fast64_t
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (11 preceding siblings ...)
  2012-01-16  0:47 ` [Qemu-devel] [PATCH 12/14] softfloat: Replace uint64 type with uint_fast64_t Andreas Färber
@ 2012-01-16  0:47 ` Andreas Färber
  2012-01-16  0:47 ` [Qemu-devel] [PATCH 14/14] softfloat: Replace flag type with bool Andreas Färber
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Anthony Liguori, Stefan Weil, Jan Kiszka,
	Blue Swirl, Christophe Lyon, Andreas Färber, Aurelien Jarno

Based on the following Coccinelle patch:

@@
typedef int64, int_fast64_t;
@@
-int64
+int_fast64_t

Add a typedef for pre-10 Solaris.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
---
 fpu/softfloat.c |   38 +++++++++++++++++++-------------------
 fpu/softfloat.h |   25 ++++++++++++-------------
 osdep.h         |    1 +
 3 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index ace2ca2..e71a3c2 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -162,11 +162,11 @@ static int_fast32_t roundAndPackInt32(flag zSign, uint64_t absZ STATUS_PARAM)
 | returned.
 *----------------------------------------------------------------------------*/
 
-static int64 roundAndPackInt64( flag zSign, uint64_t absZ0, uint64_t absZ1 STATUS_PARAM)
+static int_fast64_t roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1 STATUS_PARAM)
 {
     int_fast8_t roundingMode;
     flag roundNearestEven, increment;
-    int64 z;
+    int_fast64_t z;
 
     roundingMode = STATUS(float_rounding_mode);
     roundNearestEven = ( roundingMode == float_round_nearest_even );
@@ -667,7 +667,7 @@ static floatx80
 {
     int_fast8_t roundingMode;
     flag roundNearestEven, increment, isTiny;
-    int64 roundIncrement, roundMask, roundBits;
+    int_fast64_t roundIncrement, roundMask, roundBits;
 
     roundingMode = STATUS(float_rounding_mode);
     roundNearestEven = ( roundingMode == float_round_nearest_even );
@@ -1205,7 +1205,7 @@ float128 int32_to_float128(int_fast32_t a STATUS_PARAM)
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float32 int64_to_float32( int64 a STATUS_PARAM )
+float32 int64_to_float32(int_fast64_t a STATUS_PARAM)
 {
     flag zSign;
     uint_fast64_t absA;
@@ -1258,7 +1258,7 @@ float32 uint64_to_float32(uint_fast64_t a STATUS_PARAM)
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float64 int64_to_float64( int64 a STATUS_PARAM )
+float64 int64_to_float64(int_fast64_t a STATUS_PARAM)
 {
     flag zSign;
 
@@ -1285,7 +1285,7 @@ float64 uint64_to_float64(uint_fast64_t a STATUS_PARAM)
 | Arithmetic.
 *----------------------------------------------------------------------------*/
 
-floatx80 int64_to_floatx80( int64 a STATUS_PARAM )
+floatx80 int64_to_floatx80(int_fast64_t a STATUS_PARAM)
 {
     flag zSign;
     uint_fast64_t absA;
@@ -1305,7 +1305,7 @@ floatx80 int64_to_floatx80( int64 a STATUS_PARAM )
 | according to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-float128 int64_to_float128( int64 a STATUS_PARAM )
+float128 int64_to_float128(int_fast64_t a STATUS_PARAM)
 {
     flag zSign;
     uint_fast64_t absA;
@@ -1465,7 +1465,7 @@ int_fast16_t float32_to_int16_round_to_zero(float32 a STATUS_PARAM)
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int64 float32_to_int64( float32 a STATUS_PARAM )
+int_fast64_t float32_to_int64(float32 a STATUS_PARAM)
 {
     flag aSign;
     int_fast16_t aExp, shiftCount;
@@ -1502,13 +1502,13 @@ int64 float32_to_int64( float32 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int64 float32_to_int64_round_to_zero( float32 a STATUS_PARAM )
+int_fast64_t float32_to_int64_round_to_zero(float32 a STATUS_PARAM)
 {
     flag aSign;
     int_fast16_t aExp, shiftCount;
     uint32_t aSig;
     uint64_t aSig64;
-    int64 z;
+    int_fast64_t z;
     a = float32_squash_input_denormal(a STATUS_VAR);
 
     aSig = extractFloat32Frac( a );
@@ -2855,7 +2855,7 @@ int_fast16_t float64_to_int16_round_to_zero(float64 a STATUS_PARAM)
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int64 float64_to_int64( float64 a STATUS_PARAM )
+int_fast64_t float64_to_int64(float64 a STATUS_PARAM)
 {
     flag aSign;
     int_fast16_t aExp, shiftCount;
@@ -2898,12 +2898,12 @@ int64 float64_to_int64( float64 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int64 float64_to_int64_round_to_zero( float64 a STATUS_PARAM )
+int_fast64_t float64_to_int64_round_to_zero(float64 a STATUS_PARAM)
 {
     flag aSign;
     int_fast16_t aExp, shiftCount;
     uint64_t aSig;
-    int64 z;
+    int_fast64_t z;
     a = float64_squash_input_denormal(a STATUS_VAR);
 
     aSig = extractFloat64Frac( a );
@@ -4288,7 +4288,7 @@ int_fast32_t floatx80_to_int32_round_to_zero(floatx80 a STATUS_PARAM)
 | overflows, the largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int64 floatx80_to_int64( floatx80 a STATUS_PARAM )
+int_fast64_t floatx80_to_int64(floatx80 a STATUS_PARAM)
 {
     flag aSign;
     int_fast32_t aExp, shiftCount;
@@ -4328,12 +4328,12 @@ int64 floatx80_to_int64( floatx80 a STATUS_PARAM )
 | sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int64 floatx80_to_int64_round_to_zero( floatx80 a STATUS_PARAM )
+int_fast64_t floatx80_to_int64_round_to_zero(floatx80 a STATUS_PARAM)
 {
     flag aSign;
     int_fast32_t aExp, shiftCount;
     uint64_t aSig;
-    int64 z;
+    int_fast64_t z;
 
     aSig = extractFloatx80Frac( a );
     aExp = extractFloatx80Exp( a );
@@ -5320,7 +5320,7 @@ int_fast32_t float128_to_int32_round_to_zero(float128 a STATUS_PARAM)
 | largest integer with the same sign as `a' is returned.
 *----------------------------------------------------------------------------*/
 
-int64 float128_to_int64( float128 a STATUS_PARAM )
+int_fast64_t float128_to_int64(float128 a STATUS_PARAM)
 {
     flag aSign;
     int_fast32_t aExp, shiftCount;
@@ -5363,12 +5363,12 @@ int64 float128_to_int64( float128 a STATUS_PARAM )
 | returned.
 *----------------------------------------------------------------------------*/
 
-int64 float128_to_int64_round_to_zero( float128 a STATUS_PARAM )
+int_fast64_t float128_to_int64_round_to_zero(float128 a STATUS_PARAM)
 {
     flag aSign;
     int_fast32_t aExp, shiftCount;
     uint64_t aSig0, aSig1;
-    int64 z;
+    int_fast64_t z;
 
     aSig1 = extractFloat128Frac1( a );
     aSig0 = extractFloat128Frac0( a );
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index ce28906..0c43436 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -55,7 +55,6 @@ these four paragraphs for those parts of this code that are retained.
 | to the same as `int'.
 *----------------------------------------------------------------------------*/
 typedef uint8_t flag;
-typedef int64_t int64;
 
 #define LIT64( a ) a##LL
 #define INLINE static inline
@@ -224,12 +223,12 @@ float32 uint32_to_float32(uint_fast32_t STATUS_PARAM);
 float64 uint32_to_float64(uint_fast32_t STATUS_PARAM);
 floatx80 int32_to_floatx80(int_fast32_t STATUS_PARAM);
 float128 int32_to_float128(int_fast32_t STATUS_PARAM);
-float32 int64_to_float32( int64 STATUS_PARAM );
+float32 int64_to_float32(int_fast64_t STATUS_PARAM);
 float32 uint64_to_float32(uint_fast64_t STATUS_PARAM);
-float64 int64_to_float64( int64 STATUS_PARAM );
+float64 int64_to_float64(int_fast64_t STATUS_PARAM);
 float64 uint64_to_float64(uint_fast64_t STATUS_PARAM);
-floatx80 int64_to_floatx80( int64 STATUS_PARAM );
-float128 int64_to_float128( int64 STATUS_PARAM );
+floatx80 int64_to_floatx80(int_fast64_t STATUS_PARAM);
+float128 int64_to_float128(int_fast64_t STATUS_PARAM);
 
 /*----------------------------------------------------------------------------
 | Software half-precision conversion routines.
@@ -258,8 +257,8 @@ int_fast32_t float32_to_int32(float32 STATUS_PARAM);
 int_fast32_t float32_to_int32_round_to_zero(float32 STATUS_PARAM);
 uint_fast32_t float32_to_uint32(float32 STATUS_PARAM);
 uint_fast32_t float32_to_uint32_round_to_zero(float32 STATUS_PARAM);
-int64 float32_to_int64( float32 STATUS_PARAM );
-int64 float32_to_int64_round_to_zero( float32 STATUS_PARAM );
+int_fast64_t float32_to_int64(float32 STATUS_PARAM);
+int_fast64_t float32_to_int64_round_to_zero(float32 STATUS_PARAM);
 float64 float32_to_float64( float32 STATUS_PARAM );
 floatx80 float32_to_floatx80( float32 STATUS_PARAM );
 float128 float32_to_float128( float32 STATUS_PARAM );
@@ -362,8 +361,8 @@ int_fast32_t float64_to_int32(float64 STATUS_PARAM);
 int_fast32_t float64_to_int32_round_to_zero(float64 STATUS_PARAM);
 uint_fast32_t float64_to_uint32(float64 STATUS_PARAM);
 uint_fast32_t float64_to_uint32_round_to_zero(float64 STATUS_PARAM);
-int64 float64_to_int64( float64 STATUS_PARAM );
-int64 float64_to_int64_round_to_zero( float64 STATUS_PARAM );
+int_fast64_t float64_to_int64(float64 STATUS_PARAM);
+int_fast64_t float64_to_int64_round_to_zero(float64 STATUS_PARAM);
 uint_fast64_t float64_to_uint64(float64 a STATUS_PARAM);
 uint_fast64_t float64_to_uint64_round_to_zero(float64 a STATUS_PARAM);
 float32 float64_to_float32( float64 STATUS_PARAM );
@@ -464,8 +463,8 @@ extern const float64 float64_default_nan;
 *----------------------------------------------------------------------------*/
 int_fast32_t floatx80_to_int32(floatx80 STATUS_PARAM);
 int_fast32_t floatx80_to_int32_round_to_zero(floatx80 STATUS_PARAM);
-int64 floatx80_to_int64( floatx80 STATUS_PARAM );
-int64 floatx80_to_int64_round_to_zero( floatx80 STATUS_PARAM );
+int_fast64_t floatx80_to_int64(floatx80 STATUS_PARAM);
+int_fast64_t floatx80_to_int64_round_to_zero(floatx80 STATUS_PARAM);
 float32 floatx80_to_float32( floatx80 STATUS_PARAM );
 float64 floatx80_to_float64( floatx80 STATUS_PARAM );
 float128 floatx80_to_float128( floatx80 STATUS_PARAM );
@@ -549,8 +548,8 @@ extern const floatx80 floatx80_default_nan;
 *----------------------------------------------------------------------------*/
 int_fast32_t float128_to_int32(float128 STATUS_PARAM);
 int_fast32_t float128_to_int32_round_to_zero(float128 STATUS_PARAM);
-int64 float128_to_int64( float128 STATUS_PARAM );
-int64 float128_to_int64_round_to_zero( float128 STATUS_PARAM );
+int_fast64_t float128_to_int64(float128 STATUS_PARAM);
+int_fast64_t float128_to_int64_round_to_zero(float128 STATUS_PARAM);
 float32 float128_to_float32( float128 STATUS_PARAM );
 float64 float128_to_float64( float128 STATUS_PARAM );
 floatx80 float128_to_floatx80( float128 STATUS_PARAM );
diff --git a/osdep.h b/osdep.h
index a30bd6a..6ee9f8b 100644
--- a/osdep.h
+++ b/osdep.h
@@ -19,6 +19,7 @@ typedef uint64_t                uint_fast64_t;
 typedef signed char             int_fast8_t;
 typedef signed int              int_fast16_t;
 typedef signed int              int_fast32_t;
+typedef int64_t                 int_fast64_t;
 #endif
 
 #ifndef glue
-- 
1.7.7

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

* [Qemu-devel] [PATCH 14/14] softfloat: Replace flag type with bool
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (12 preceding siblings ...)
  2012-01-16  0:47 ` [Qemu-devel] [PATCH 13/14] softfloat: Replace int64 type with int_fast64_t Andreas Färber
@ 2012-01-16  0:47 ` Andreas Färber
  2012-01-16 19:02 ` [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Peter Maydell
  2012-01-20 13:05 ` Peter Maydell
  15 siblings, 0 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16  0:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Anthony Liguori, Blue Swirl, Christophe Lyon,
	Andreas Färber, Aurelien Jarno

Based on the following Coccinelle patch:

@@
typedef flag, bool;
@@
-flag
+bool

Also drop the comment block now that the last typedef is removed.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 fpu/softfloat-macros.h     |    8 +-
 fpu/softfloat-specialize.h |   54 +++++-----
 fpu/softfloat.c            |  278 ++++++++++++++++++++++----------------------
 fpu/softfloat.h            |   27 ++---
 4 files changed, 179 insertions(+), 188 deletions(-)

diff --git a/fpu/softfloat-macros.h b/fpu/softfloat-macros.h
index b82871a..fe68176 100644
--- a/fpu/softfloat-macros.h
+++ b/fpu/softfloat-macros.h
@@ -702,7 +702,7 @@ static int_fast8_t countLeadingZeros64(uint64_t a)
 | Otherwise, returns 0.
 *----------------------------------------------------------------------------*/
 
-INLINE flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
+INLINE bool eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
 {
 
     return ( a0 == b0 ) && ( a1 == b1 );
@@ -715,7 +715,7 @@ INLINE flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
 | Otherwise, returns 0.
 *----------------------------------------------------------------------------*/
 
-INLINE flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
+INLINE bool le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
 {
 
     return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 <= b1 ) );
@@ -728,7 +728,7 @@ INLINE flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
 | returns 0.
 *----------------------------------------------------------------------------*/
 
-INLINE flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
+INLINE bool lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
 {
 
     return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 < b1 ) );
@@ -741,7 +741,7 @@ INLINE flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
 | Otherwise, returns 0.
 *----------------------------------------------------------------------------*/
 
-INLINE flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
+INLINE bool ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
 {
 
     return ( a0 != b0 ) || ( a1 != b1 );
diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index d57af1a..6fc24cf 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -123,7 +123,7 @@ void float_raise(int_fast8_t flags STATUS_PARAM)
 | Internal canonical NaN format.
 *----------------------------------------------------------------------------*/
 typedef struct {
-    flag sign;
+    bool sign;
     uint64_t high, low;
 } commonNaNT;
 
@@ -325,8 +325,8 @@ static float32 commonNaNToFloat32( commonNaNT a STATUS_PARAM)
 *----------------------------------------------------------------------------*/
 
 #if defined(TARGET_ARM)
-static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
-                    flag aIsLargerSignificand)
+static int pickNaN(bool aIsQNaN, bool aIsSNaN, bool bIsQNaN, bool bIsSNaN,
+                    bool aIsLargerSignificand)
 {
     /* ARM mandated NaN propagation rules: take the first of:
      *  1. A if it is signaling
@@ -346,8 +346,8 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
     }
 }
 #elif defined(TARGET_MIPS)
-static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
-                    flag aIsLargerSignificand)
+static int pickNaN(bool aIsQNaN, bool aIsSNaN, bool bIsQNaN, bool bIsSNaN,
+                    bool aIsLargerSignificand)
 {
     /* According to MIPS specifications, if one of the two operands is
      * a sNaN, a new qNaN has to be generated. This is done in
@@ -373,8 +373,8 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
     }
 }
 #elif defined(TARGET_PPC)
-static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
-                   flag aIsLargerSignificand)
+static int pickNaN(bool aIsQNaN, bool aIsSNaN, bool bIsQNaN, bool bIsSNaN,
+                   bool aIsLargerSignificand)
 {
     /* PowerPC propagation rules:
      *  1. A if it sNaN or qNaN
@@ -388,8 +388,8 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
     }
 }
 #else
-static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
-                    flag aIsLargerSignificand)
+static int pickNaN(bool aIsQNaN, bool aIsSNaN, bool bIsQNaN, bool bIsSNaN,
+                    bool aIsLargerSignificand)
 {
     /* This implements x87 NaN propagation rules:
      * SNaN + QNaN => return the QNaN
@@ -426,8 +426,8 @@ static int pickNaN(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
 | Return values : 0 : a; 1 : b; 2 : c; 3 : default-NaN
 *----------------------------------------------------------------------------*/
 #if defined(TARGET_ARM)
-static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
-                         flag cIsQNaN, flag cIsSNaN, flag infzero STATUS_PARAM)
+static int pickNaNMulAdd(bool aIsQNaN, bool aIsSNaN, bool bIsQNaN, bool bIsSNaN,
+                         bool cIsQNaN, bool cIsSNaN, bool infzero STATUS_PARAM)
 {
     /* For ARM, the (inf,zero,qnan) case sets InvalidOp and returns
      * the default NaN
@@ -455,8 +455,8 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
     }
 }
 #elif defined(TARGET_PPC)
-static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
-                         flag cIsQNaN, flag cIsSNaN, flag infzero STATUS_PARAM)
+static int pickNaNMulAdd(bool aIsQNaN, bool aIsSNaN, bool bIsQNaN, bool bIsSNaN,
+                         bool cIsQNaN, bool cIsSNaN, bool infzero STATUS_PARAM)
 {
     /* For PPC, the (inf,zero,qnan) case sets InvalidOp, but we prefer
      * to return an input NaN if we have one (ie c) rather than generating
@@ -482,8 +482,8 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
 /* A default implementation: prefer a to b to c.
  * This is unlikely to actually match any real implementation.
  */
-static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
-                         flag cIsQNaN, flag cIsSNaN, flag infzero STATUS_PARAM)
+static int pickNaNMulAdd(bool aIsQNaN, bool aIsSNaN, bool bIsQNaN, bool bIsSNaN,
+                         bool cIsQNaN, bool cIsSNaN, bool infzero STATUS_PARAM)
 {
     if (aIsSNaN || aIsQNaN) {
         return 0;
@@ -503,8 +503,8 @@ static int pickNaNMulAdd(flag aIsQNaN, flag aIsSNaN, flag bIsQNaN, flag bIsSNaN,
 
 static float32 propagateFloat32NaN( float32 a, float32 b STATUS_PARAM)
 {
-    flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
-    flag aIsLargerSignificand;
+    bool aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
+    bool aIsLargerSignificand;
     uint32_t av, bv;
 
     aIsQuietNaN = float32_is_quiet_nan( a );
@@ -545,9 +545,9 @@ static float32 propagateFloat32NaN( float32 a, float32 b STATUS_PARAM)
 *----------------------------------------------------------------------------*/
 
 static float32 propagateFloat32MulAddNaN(float32 a, float32 b,
-                                         float32 c, flag infzero STATUS_PARAM)
+                                         float32 c, bool infzero STATUS_PARAM)
 {
-    flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN,
+    bool aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN,
         cIsQuietNaN, cIsSignalingNaN;
     int which;
 
@@ -690,8 +690,8 @@ static float64 commonNaNToFloat64( commonNaNT a STATUS_PARAM)
 
 static float64 propagateFloat64NaN( float64 a, float64 b STATUS_PARAM)
 {
-    flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
-    flag aIsLargerSignificand;
+    bool aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
+    bool aIsLargerSignificand;
     uint64_t av, bv;
 
     aIsQuietNaN = float64_is_quiet_nan( a );
@@ -732,9 +732,9 @@ static float64 propagateFloat64NaN( float64 a, float64 b STATUS_PARAM)
 *----------------------------------------------------------------------------*/
 
 static float64 propagateFloat64MulAddNaN(float64 a, float64 b,
-                                         float64 c, flag infzero STATUS_PARAM)
+                                         float64 c, bool infzero STATUS_PARAM)
 {
-    flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN,
+    bool aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN,
         cIsQuietNaN, cIsSignalingNaN;
     int which;
 
@@ -897,8 +897,8 @@ static floatx80 commonNaNToFloatx80( commonNaNT a STATUS_PARAM)
 
 static floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b STATUS_PARAM)
 {
-    flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
-    flag aIsLargerSignificand;
+    bool aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
+    bool aIsLargerSignificand;
 
     aIsQuietNaN = floatx80_is_quiet_nan( a );
     aIsSignalingNaN = floatx80_is_signaling_nan( a );
@@ -1032,8 +1032,8 @@ static float128 commonNaNToFloat128( commonNaNT a STATUS_PARAM)
 
 static float128 propagateFloat128NaN( float128 a, float128 b STATUS_PARAM)
 {
-    flag aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
-    flag aIsLargerSignificand;
+    bool aIsQuietNaN, aIsSignalingNaN, bIsQuietNaN, bIsSignalingNaN;
+    bool aIsLargerSignificand;
 
     aIsQuietNaN = float128_is_quiet_nan( a );
     aIsSignalingNaN = float128_is_signaling_nan( a );
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index e71a3c2..d5e2f8d 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -96,7 +96,7 @@ INLINE int_fast16_t extractFloat16Exp(float16 a)
 | Returns the sign bit of the single-precision floating-point value `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE flag extractFloat16Sign(float16 a)
+INLINE bool extractFloat16Sign(float16 a)
 {
     return float16_val(a)>>15;
 }
@@ -112,10 +112,10 @@ INLINE flag extractFloat16Sign(float16 a)
 | positive or negative integer is returned.
 *----------------------------------------------------------------------------*/
 
-static int_fast32_t roundAndPackInt32(flag zSign, uint64_t absZ STATUS_PARAM)
+static int_fast32_t roundAndPackInt32(bool zSign, uint64_t absZ STATUS_PARAM)
 {
     int_fast8_t roundingMode;
-    flag roundNearestEven;
+    bool roundNearestEven;
     int_fast8_t roundIncrement, roundBits;
     int_fast32_t z;
 
@@ -162,10 +162,10 @@ static int_fast32_t roundAndPackInt32(flag zSign, uint64_t absZ STATUS_PARAM)
 | returned.
 *----------------------------------------------------------------------------*/
 
-static int_fast64_t roundAndPackInt64(flag zSign, uint64_t absZ0, uint64_t absZ1 STATUS_PARAM)
+static int_fast64_t roundAndPackInt64(bool zSign, uint64_t absZ0, uint64_t absZ1 STATUS_PARAM)
 {
     int_fast8_t roundingMode;
-    flag roundNearestEven, increment;
+    bool roundNearestEven, increment;
     int_fast64_t z;
 
     roundingMode = STATUS(float_rounding_mode);
@@ -229,7 +229,7 @@ INLINE int_fast16_t extractFloat32Exp(float32 a)
 | Returns the sign bit of the single-precision floating-point value `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE flag extractFloat32Sign( float32 a )
+INLINE bool extractFloat32Sign( float32 a )
 {
 
     return float32_val(a)>>31;
@@ -280,7 +280,7 @@ static void
 | significand.
 *----------------------------------------------------------------------------*/
 
-INLINE float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
+INLINE float32 packFloat32(bool zSign, int_fast16_t zExp, uint32_t zSig)
 {
 
     return make_float32(
@@ -310,12 +310,12 @@ 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 STATUS_PARAM)
+static float32 roundAndPackFloat32(bool zSign, int_fast16_t zExp, uint32_t zSig STATUS_PARAM)
 {
     int_fast8_t roundingMode;
-    flag roundNearestEven;
+    bool roundNearestEven;
     int_fast8_t roundIncrement, roundBits;
-    flag isTiny;
+    bool isTiny;
 
     roundingMode = STATUS(float_rounding_mode);
     roundNearestEven = ( roundingMode == float_round_nearest_even );
@@ -376,7 +376,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 STATUS_PARAM)
+ normalizeRoundAndPackFloat32(bool zSign, int_fast16_t zExp, uint32_t zSig STATUS_PARAM)
 {
     int_fast8_t shiftCount;
 
@@ -411,7 +411,7 @@ INLINE int_fast16_t extractFloat64Exp(float64 a)
 | Returns the sign bit of the double-precision floating-point value `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE flag extractFloat64Sign( float64 a )
+INLINE bool extractFloat64Sign( float64 a )
 {
 
     return float64_val(a)>>63;
@@ -462,7 +462,7 @@ static void
 | significand.
 *----------------------------------------------------------------------------*/
 
-INLINE float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
+INLINE float64 packFloat64(bool zSign, int_fast16_t zExp, uint64_t zSig)
 {
 
     return make_float64(
@@ -492,12 +492,12 @@ 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 STATUS_PARAM)
+static float64 roundAndPackFloat64(bool zSign, int_fast16_t zExp, uint64_t zSig STATUS_PARAM)
 {
     int_fast8_t roundingMode;
-    flag roundNearestEven;
+    bool roundNearestEven;
     int_fast16_t roundIncrement, roundBits;
-    flag isTiny;
+    bool isTiny;
 
     roundingMode = STATUS(float_rounding_mode);
     roundNearestEven = ( roundingMode == float_round_nearest_even );
@@ -558,7 +558,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 STATUS_PARAM)
+ normalizeRoundAndPackFloat64(bool zSign, int_fast16_t zExp, uint64_t zSig STATUS_PARAM)
 {
     int_fast8_t shiftCount;
 
@@ -596,7 +596,7 @@ INLINE int_fast32_t extractFloatx80Exp(floatx80 a)
 | `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE flag extractFloatx80Sign( floatx80 a )
+INLINE bool extractFloatx80Sign( floatx80 a )
 {
 
     return a.high>>15;
@@ -626,7 +626,7 @@ static void
 | extended double-precision floating-point value, returning the result.
 *----------------------------------------------------------------------------*/
 
-INLINE floatx80 packFloatx80(flag zSign, int_fast32_t zExp, uint64_t zSig)
+INLINE floatx80 packFloatx80(bool zSign, int_fast32_t zExp, uint64_t zSig)
 {
     floatx80 z;
 
@@ -662,11 +662,11 @@ INLINE floatx80 packFloatx80(flag zSign, int_fast32_t zExp, uint64_t zSig)
 
 static floatx80
  roundAndPackFloatx80(
-     int_fast8_t roundingPrecision, flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1
+     int_fast8_t roundingPrecision, bool zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1
  STATUS_PARAM)
 {
     int_fast8_t roundingMode;
-    flag roundNearestEven, increment, isTiny;
+    bool roundNearestEven, increment, isTiny;
     int_fast64_t roundIncrement, roundMask, roundBits;
 
     roundingMode = STATUS(float_rounding_mode);
@@ -834,7 +834,7 @@ static floatx80
 
 static floatx80
  normalizeRoundAndPackFloatx80(
-     int_fast8_t roundingPrecision, flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1
+     int_fast8_t roundingPrecision, bool zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1
  STATUS_PARAM)
 {
     int_fast8_t shiftCount;
@@ -892,7 +892,7 @@ INLINE int_fast32_t extractFloat128Exp(float128 a)
 | Returns the sign bit of the quadruple-precision floating-point value `a'.
 *----------------------------------------------------------------------------*/
 
-INLINE flag extractFloat128Sign( float128 a )
+INLINE bool extractFloat128Sign(float128 a)
 {
 
     return a.high>>63;
@@ -954,7 +954,7 @@ static void
 *----------------------------------------------------------------------------*/
 
 INLINE float128
- packFloat128(flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1)
+ packFloat128(bool zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1)
 {
     float128 z;
 
@@ -987,10 +987,10 @@ INLINE float128
 
 static float128
  roundAndPackFloat128(
-     flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2 STATUS_PARAM)
+     bool zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1, uint64_t zSig2 STATUS_PARAM)
 {
     int_fast8_t roundingMode;
-    flag roundNearestEven, increment, isTiny;
+    bool roundNearestEven, increment, isTiny;
 
     roundingMode = STATUS(float_rounding_mode);
     roundNearestEven = ( roundingMode == float_round_nearest_even );
@@ -1091,7 +1091,7 @@ static float128
 
 static float128
  normalizeRoundAndPackFloat128(
-     flag zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1 STATUS_PARAM)
+     bool zSign, int_fast32_t zExp, uint64_t zSig0, uint64_t zSig1 STATUS_PARAM)
 {
     int_fast8_t shiftCount;
     uint64_t zSig2;
@@ -1123,7 +1123,7 @@ static float128
 
 float32 int32_to_float32(int_fast32_t a STATUS_PARAM)
 {
-    flag zSign;
+    bool zSign;
 
     if ( a == 0 ) return float32_zero;
     if ( a == (int32_t) 0x80000000 ) return packFloat32( 1, 0x9E, 0 );
@@ -1140,7 +1140,7 @@ float32 int32_to_float32(int_fast32_t a STATUS_PARAM)
 
 float64 int32_to_float64(int_fast32_t a STATUS_PARAM)
 {
-    flag zSign;
+    bool zSign;
     uint_fast32_t absA;
     int_fast8_t shiftCount;
     uint64_t zSig;
@@ -1163,7 +1163,7 @@ float64 int32_to_float64(int_fast32_t a STATUS_PARAM)
 
 floatx80 int32_to_floatx80(int_fast32_t a STATUS_PARAM)
 {
-    flag zSign;
+    bool zSign;
     uint_fast32_t absA;
     int_fast8_t shiftCount;
     uint64_t zSig;
@@ -1185,7 +1185,7 @@ floatx80 int32_to_floatx80(int_fast32_t a STATUS_PARAM)
 
 float128 int32_to_float128(int_fast32_t a STATUS_PARAM)
 {
-    flag zSign;
+    bool zSign;
     uint_fast32_t absA;
     int_fast8_t shiftCount;
     uint64_t zSig0;
@@ -1207,7 +1207,7 @@ float128 int32_to_float128(int_fast32_t a STATUS_PARAM)
 
 float32 int64_to_float32(int_fast64_t a STATUS_PARAM)
 {
-    flag zSign;
+    bool zSign;
     uint_fast64_t absA;
     int_fast8_t shiftCount;
 
@@ -1260,7 +1260,7 @@ float32 uint64_to_float32(uint_fast64_t a STATUS_PARAM)
 
 float64 int64_to_float64(int_fast64_t a STATUS_PARAM)
 {
-    flag zSign;
+    bool zSign;
 
     if ( a == 0 ) return float64_zero;
     if ( a == (int64_t) LIT64( 0x8000000000000000 ) ) {
@@ -1287,7 +1287,7 @@ float64 uint64_to_float64(uint_fast64_t a STATUS_PARAM)
 
 floatx80 int64_to_floatx80(int_fast64_t a STATUS_PARAM)
 {
-    flag zSign;
+    bool zSign;
     uint_fast64_t absA;
     int_fast8_t shiftCount;
 
@@ -1307,7 +1307,7 @@ floatx80 int64_to_floatx80(int_fast64_t a STATUS_PARAM)
 
 float128 int64_to_float128(int_fast64_t a STATUS_PARAM)
 {
-    flag zSign;
+    bool zSign;
     uint_fast64_t absA;
     int_fast8_t shiftCount;
     int_fast32_t zExp;
@@ -1344,7 +1344,7 @@ float128 int64_to_float128(int_fast64_t a STATUS_PARAM)
 
 int_fast32_t float32_to_int32(float32 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, shiftCount;
     uint32_t aSig;
     uint64_t aSig64;
@@ -1375,7 +1375,7 @@ int_fast32_t float32_to_int32(float32 a STATUS_PARAM)
 
 int_fast32_t float32_to_int32_round_to_zero(float32 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, shiftCount;
     uint32_t aSig;
     int_fast32_t z;
@@ -1418,7 +1418,7 @@ int_fast32_t float32_to_int32_round_to_zero(float32 a STATUS_PARAM)
 
 int_fast16_t float32_to_int16_round_to_zero(float32 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, shiftCount;
     uint32_t aSig;
     int_fast32_t z;
@@ -1467,7 +1467,7 @@ int_fast16_t float32_to_int16_round_to_zero(float32 a STATUS_PARAM)
 
 int_fast64_t float32_to_int64(float32 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, shiftCount;
     uint32_t aSig;
     uint64_t aSig64, aSigExtra;
@@ -1504,7 +1504,7 @@ int_fast64_t float32_to_int64(float32 a STATUS_PARAM)
 
 int_fast64_t float32_to_int64_round_to_zero(float32 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, shiftCount;
     uint32_t aSig;
     uint64_t aSig64;
@@ -1548,7 +1548,7 @@ int_fast64_t float32_to_int64_round_to_zero(float32 a STATUS_PARAM)
 
 float64 float32_to_float64( float32 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint32_t aSig;
     a = float32_squash_input_denormal(a STATUS_VAR);
@@ -1578,7 +1578,7 @@ float64 float32_to_float64( float32 a STATUS_PARAM )
 
 floatx80 float32_to_floatx80( float32 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint32_t aSig;
 
@@ -1608,7 +1608,7 @@ floatx80 float32_to_floatx80( float32 a STATUS_PARAM )
 
 float128 float32_to_float128( float32 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint32_t aSig;
 
@@ -1638,7 +1638,7 @@ float128 float32_to_float128( float32 a STATUS_PARAM )
 
 float32 float32_round_to_int( float32 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint32_t lastBitMask, roundBitsMask;
     int_fast8_t roundingMode;
@@ -1697,7 +1697,7 @@ float32 float32_round_to_int( float32 a STATUS_PARAM)
 | Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static float32 addFloat32Sigs( float32 a, float32 b, flag zSign STATUS_PARAM)
+static float32 addFloat32Sigs(float32 a, float32 b, bool zSign STATUS_PARAM)
 {
     int_fast16_t aExp, bExp, zExp;
     uint32_t aSig, bSig, zSig;
@@ -1776,7 +1776,7 @@ static float32 addFloat32Sigs( float32 a, float32 b, flag zSign STATUS_PARAM)
 | Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static float32 subFloat32Sigs( float32 a, float32 b, flag zSign STATUS_PARAM)
+static float32 subFloat32Sigs(float32 a, float32 b, bool zSign STATUS_PARAM)
 {
     int_fast16_t aExp, bExp, zExp;
     uint32_t aSig, bSig, zSig;
@@ -1851,7 +1851,7 @@ static float32 subFloat32Sigs( float32 a, float32 b, flag zSign STATUS_PARAM)
 
 float32 float32_add( float32 a, float32 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     a = float32_squash_input_denormal(a STATUS_VAR);
     b = float32_squash_input_denormal(b STATUS_VAR);
 
@@ -1874,7 +1874,7 @@ float32 float32_add( float32 a, float32 b STATUS_PARAM )
 
 float32 float32_sub( float32 a, float32 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     a = float32_squash_input_denormal(a STATUS_VAR);
     b = float32_squash_input_denormal(b STATUS_VAR);
 
@@ -1897,7 +1897,7 @@ float32 float32_sub( float32 a, float32 b STATUS_PARAM )
 
 float32 float32_mul( float32 a, float32 b STATUS_PARAM )
 {
-    flag aSign, bSign, zSign;
+    bool aSign, bSign, zSign;
     int_fast16_t aExp, bExp, zExp;
     uint32_t aSig, bSig;
     uint64_t zSig64;
@@ -1960,7 +1960,7 @@ float32 float32_mul( float32 a, float32 b STATUS_PARAM )
 
 float32 float32_div( float32 a, float32 b STATUS_PARAM )
 {
-    flag aSign, bSign, zSign;
+    bool aSign, bSign, zSign;
     int_fast16_t aExp, bExp, zExp;
     uint32_t aSig, bSig, zSig;
     a = float32_squash_input_denormal(a STATUS_VAR);
@@ -2024,7 +2024,7 @@ float32 float32_div( float32 a, float32 b STATUS_PARAM )
 
 float32 float32_rem( float32 a, float32 b STATUS_PARAM )
 {
-    flag aSign, zSign;
+    bool aSign, zSign;
     int_fast16_t aExp, bExp, expDiff;
     uint32_t aSig, bSig;
     uint32_t q;
@@ -2130,14 +2130,14 @@ float32 float32_rem( float32 a, float32 b STATUS_PARAM )
 
 float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
 {
-    flag aSign, bSign, cSign, zSign;
+    bool aSign, bSign, cSign, zSign;
     int_fast16_t aExp, bExp, cExp, pExp, zExp, expDiff;
     uint32_t aSig, bSig, cSig;
-    flag pInf, pZero, pSign;
+    bool pInf, pZero, pSign;
     uint64_t pSig64, cSig64, zSig64;
     uint32_t pSig;
     int shiftcount;
-    flag signflip, infzero;
+    bool signflip, infzero;
 
     a = float32_squash_input_denormal(a STATUS_VAR);
     b = float32_squash_input_denormal(b STATUS_VAR);
@@ -2332,7 +2332,7 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
 
 float32 float32_sqrt( float32 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, zExp;
     uint32_t aSig, zSig;
     uint64_t rem, term;
@@ -2418,7 +2418,7 @@ static const float64 float32_exp2_coefficients[15] =
 
 float32 float32_exp2( float32 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint32_t aSig;
     float64 r, x, xn;
@@ -2466,7 +2466,7 @@ float32 float32_exp2( float32 a STATUS_PARAM )
 *----------------------------------------------------------------------------*/
 float32 float32_log2( float32 a STATUS_PARAM )
 {
-    flag aSign, zSign;
+    bool aSign, zSign;
     int_fast16_t aExp;
     uint32_t aSig, zSig, i;
 
@@ -2540,7 +2540,7 @@ int float32_eq( float32 a, float32 b STATUS_PARAM )
 
 int float32_le( float32 a, float32 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     uint32_t av, bv;
     a = float32_squash_input_denormal(a STATUS_VAR);
     b = float32_squash_input_denormal(b STATUS_VAR);
@@ -2569,7 +2569,7 @@ int float32_le( float32 a, float32 b STATUS_PARAM )
 
 int float32_lt( float32 a, float32 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     uint32_t av, bv;
     a = float32_squash_input_denormal(a STATUS_VAR);
     b = float32_squash_input_denormal(b STATUS_VAR);
@@ -2643,7 +2643,7 @@ int float32_eq_quiet( float32 a, float32 b STATUS_PARAM )
 
 int float32_le_quiet( float32 a, float32 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     uint32_t av, bv;
     a = float32_squash_input_denormal(a STATUS_VAR);
     b = float32_squash_input_denormal(b STATUS_VAR);
@@ -2674,7 +2674,7 @@ int float32_le_quiet( float32 a, float32 b STATUS_PARAM )
 
 int float32_lt_quiet( float32 a, float32 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     uint32_t av, bv;
     a = float32_squash_input_denormal(a STATUS_VAR);
     b = float32_squash_input_denormal(b STATUS_VAR);
@@ -2731,7 +2731,7 @@ int float32_unordered_quiet( float32 a, float32 b STATUS_PARAM )
 
 int_fast32_t float64_to_int32(float64 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, shiftCount;
     uint64_t aSig;
     a = float64_squash_input_denormal(a STATUS_VAR);
@@ -2759,7 +2759,7 @@ int_fast32_t float64_to_int32(float64 a STATUS_PARAM)
 
 int_fast32_t float64_to_int32_round_to_zero(float64 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, shiftCount;
     uint64_t aSig, savedASig;
     int_fast32_t z;
@@ -2806,7 +2806,7 @@ int_fast32_t float64_to_int32_round_to_zero(float64 a STATUS_PARAM)
 
 int_fast16_t float64_to_int16_round_to_zero(float64 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, shiftCount;
     uint64_t aSig, savedASig;
     int_fast32_t z;
@@ -2857,7 +2857,7 @@ int_fast16_t float64_to_int16_round_to_zero(float64 a STATUS_PARAM)
 
 int_fast64_t float64_to_int64(float64 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, shiftCount;
     uint64_t aSig, aSigExtra;
     a = float64_squash_input_denormal(a STATUS_VAR);
@@ -2900,7 +2900,7 @@ int_fast64_t float64_to_int64(float64 a STATUS_PARAM)
 
 int_fast64_t float64_to_int64_round_to_zero(float64 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, shiftCount;
     uint64_t aSig;
     int_fast64_t z;
@@ -2950,7 +2950,7 @@ int_fast64_t float64_to_int64_round_to_zero(float64 a STATUS_PARAM)
 
 float32 float64_to_float32( float64 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint64_t aSig;
     uint32_t zSig;
@@ -2984,7 +2984,7 @@ float32 float64_to_float32( float64 a STATUS_PARAM )
 | 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(bool zSign, int_fast16_t zExp, uint16_t zSig)
 {
     return make_float16(
         (((uint32_t)zSign) << 15) + (((uint32_t)zExp) << 10) + zSig);
@@ -2993,9 +2993,9 @@ static float16 packFloat16(flag zSign, int_fast16_t zExp, uint16_t zSig)
 /* Half precision floats come in two formats: standard IEEE and "ARM" format.
    The latter gains extra exponent range by omitting the NaN/Inf encodings.  */
 
-float32 float16_to_float32(float16 a, flag ieee STATUS_PARAM)
+float32 float16_to_float32(float16 a, bool ieee STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint32_t aSig;
 
@@ -3023,9 +3023,9 @@ float32 float16_to_float32(float16 a, flag ieee STATUS_PARAM)
     return packFloat32( aSign, aExp + 0x70, aSig << 13);
 }
 
-float16 float32_to_float16(float32 a, flag ieee STATUS_PARAM)
+float16 float32_to_float16(float32 a, bool ieee STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint32_t aSig;
     uint32_t mask;
@@ -3126,7 +3126,7 @@ float16 float32_to_float16(float32 a, flag ieee STATUS_PARAM)
 
 floatx80 float64_to_floatx80( float64 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint64_t aSig;
 
@@ -3157,7 +3157,7 @@ floatx80 float64_to_floatx80( float64 a STATUS_PARAM )
 
 float128 float64_to_float128( float64 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint64_t aSig, zSig0, zSig1;
 
@@ -3188,7 +3188,7 @@ float128 float64_to_float128( float64 a STATUS_PARAM )
 
 float64 float64_round_to_int( float64 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint64_t lastBitMask, roundBitsMask;
     int_fast8_t roundingMode;
@@ -3260,7 +3260,7 @@ float64 float64_trunc_to_int( float64 a STATUS_PARAM)
 | Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static float64 addFloat64Sigs( float64 a, float64 b, flag zSign STATUS_PARAM )
+static float64 addFloat64Sigs(float64 a, float64 b, bool zSign STATUS_PARAM)
 {
     int_fast16_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig;
@@ -3339,7 +3339,7 @@ static float64 addFloat64Sigs( float64 a, float64 b, flag zSign STATUS_PARAM )
 | Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static float64 subFloat64Sigs( float64 a, float64 b, flag zSign STATUS_PARAM )
+static float64 subFloat64Sigs(float64 a, float64 b, bool zSign STATUS_PARAM)
 {
     int_fast16_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig;
@@ -3414,7 +3414,7 @@ static float64 subFloat64Sigs( float64 a, float64 b, flag zSign STATUS_PARAM )
 
 float64 float64_add( float64 a, float64 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     a = float64_squash_input_denormal(a STATUS_VAR);
     b = float64_squash_input_denormal(b STATUS_VAR);
 
@@ -3437,7 +3437,7 @@ float64 float64_add( float64 a, float64 b STATUS_PARAM )
 
 float64 float64_sub( float64 a, float64 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     a = float64_squash_input_denormal(a STATUS_VAR);
     b = float64_squash_input_denormal(b STATUS_VAR);
 
@@ -3460,7 +3460,7 @@ float64 float64_sub( float64 a, float64 b STATUS_PARAM )
 
 float64 float64_mul( float64 a, float64 b STATUS_PARAM )
 {
-    flag aSign, bSign, zSign;
+    bool aSign, bSign, zSign;
     int_fast16_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig0, zSig1;
 
@@ -3521,7 +3521,7 @@ float64 float64_mul( float64 a, float64 b STATUS_PARAM )
 
 float64 float64_div( float64 a, float64 b STATUS_PARAM )
 {
-    flag aSign, bSign, zSign;
+    bool aSign, bSign, zSign;
     int_fast16_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig;
     uint64_t rem0, rem1;
@@ -3593,7 +3593,7 @@ float64 float64_div( float64 a, float64 b STATUS_PARAM )
 
 float64 float64_rem( float64 a, float64 b STATUS_PARAM )
 {
-    flag aSign, zSign;
+    bool aSign, zSign;
     int_fast16_t aExp, bExp, expDiff;
     uint64_t aSig, bSig;
     uint64_t q, alternateASig;
@@ -3684,13 +3684,13 @@ float64 float64_rem( float64 a, float64 b STATUS_PARAM )
 
 float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
 {
-    flag aSign, bSign, cSign, zSign;
+    bool aSign, bSign, cSign, zSign;
     int_fast16_t aExp, bExp, cExp, pExp, zExp, expDiff;
     uint64_t aSig, bSig, cSig;
-    flag pInf, pZero, pSign;
+    bool pInf, pZero, pSign;
     uint64_t pSig0, pSig1, cSig0, cSig1, zSig0, zSig1;
     int shiftcount;
-    flag signflip, infzero;
+    bool signflip, infzero;
 
     a = float64_squash_input_denormal(a STATUS_VAR);
     b = float64_squash_input_denormal(b STATUS_VAR);
@@ -3899,7 +3899,7 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
 
 float64 float64_sqrt( float64 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp, zExp;
     uint64_t aSig, zSig, doubleZSig;
     uint64_t rem0, rem1, term0, term1;
@@ -3950,7 +3950,7 @@ float64 float64_sqrt( float64 a STATUS_PARAM )
 *----------------------------------------------------------------------------*/
 float64 float64_log2( float64 a STATUS_PARAM )
 {
-    flag aSign, zSign;
+    bool aSign, zSign;
     int_fast16_t aExp;
     uint64_t aSig, aSig0, aSig1, zSig, i;
     a = float64_squash_input_denormal(a STATUS_VAR);
@@ -4024,7 +4024,7 @@ int float64_eq( float64 a, float64 b STATUS_PARAM )
 
 int float64_le( float64 a, float64 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     uint64_t av, bv;
     a = float64_squash_input_denormal(a STATUS_VAR);
     b = float64_squash_input_denormal(b STATUS_VAR);
@@ -4053,7 +4053,7 @@ int float64_le( float64 a, float64 b STATUS_PARAM )
 
 int float64_lt( float64 a, float64 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     uint64_t av, bv;
 
     a = float64_squash_input_denormal(a STATUS_VAR);
@@ -4130,7 +4130,7 @@ int float64_eq_quiet( float64 a, float64 b STATUS_PARAM )
 
 int float64_le_quiet( float64 a, float64 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     uint64_t av, bv;
     a = float64_squash_input_denormal(a STATUS_VAR);
     b = float64_squash_input_denormal(b STATUS_VAR);
@@ -4161,7 +4161,7 @@ int float64_le_quiet( float64 a, float64 b STATUS_PARAM )
 
 int float64_lt_quiet( float64 a, float64 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
     uint64_t av, bv;
     a = float64_squash_input_denormal(a STATUS_VAR);
     b = float64_squash_input_denormal(b STATUS_VAR);
@@ -4218,7 +4218,7 @@ int float64_unordered_quiet( float64 a, float64 b STATUS_PARAM )
 
 int_fast32_t floatx80_to_int32(floatx80 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp, shiftCount;
     uint64_t aSig;
 
@@ -4245,7 +4245,7 @@ int_fast32_t floatx80_to_int32(floatx80 a STATUS_PARAM)
 
 int_fast32_t floatx80_to_int32_round_to_zero(floatx80 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp, shiftCount;
     uint64_t aSig, savedASig;
     int_fast32_t z;
@@ -4290,7 +4290,7 @@ int_fast32_t floatx80_to_int32_round_to_zero(floatx80 a STATUS_PARAM)
 
 int_fast64_t floatx80_to_int64(floatx80 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp, shiftCount;
     uint64_t aSig, aSigExtra;
 
@@ -4330,7 +4330,7 @@ int_fast64_t floatx80_to_int64(floatx80 a STATUS_PARAM)
 
 int_fast64_t floatx80_to_int64_round_to_zero(floatx80 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp, shiftCount;
     uint64_t aSig;
     int_fast64_t z;
@@ -4371,7 +4371,7 @@ int_fast64_t floatx80_to_int64_round_to_zero(floatx80 a STATUS_PARAM)
 
 float32 floatx80_to_float32( floatx80 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp;
     uint64_t aSig;
 
@@ -4399,7 +4399,7 @@ float32 floatx80_to_float32( floatx80 a STATUS_PARAM )
 
 float64 floatx80_to_float64( floatx80 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp;
     uint64_t aSig, zSig;
 
@@ -4427,7 +4427,7 @@ float64 floatx80_to_float64( floatx80 a STATUS_PARAM )
 
 float128 floatx80_to_float128( floatx80 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast16_t aExp;
     uint64_t aSig, zSig0, zSig1;
 
@@ -4451,7 +4451,7 @@ float128 floatx80_to_float128( floatx80 a STATUS_PARAM )
 
 floatx80 floatx80_round_to_int( floatx80 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp;
     uint64_t lastBitMask, roundBitsMask;
     int_fast8_t roundingMode;
@@ -4523,7 +4523,7 @@ floatx80 floatx80_round_to_int( floatx80 a STATUS_PARAM )
 | Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM)
+static floatx80 addFloatx80Sigs(floatx80 a, floatx80 b, bool zSign STATUS_PARAM)
 {
     int_fast32_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig0, zSig1;
@@ -4589,7 +4589,7 @@ static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM
 | Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM )
+static floatx80 subFloatx80Sigs(floatx80 a, floatx80 b, bool zSign STATUS_PARAM)
 {
     int_fast32_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig0, zSig1;
@@ -4657,7 +4657,7 @@ static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign STATUS_PARAM
 
 floatx80 floatx80_add( floatx80 a, floatx80 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     aSign = extractFloatx80Sign( a );
     bSign = extractFloatx80Sign( b );
@@ -4678,7 +4678,7 @@ floatx80 floatx80_add( floatx80 a, floatx80 b STATUS_PARAM )
 
 floatx80 floatx80_sub( floatx80 a, floatx80 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     aSign = extractFloatx80Sign( a );
     bSign = extractFloatx80Sign( b );
@@ -4699,7 +4699,7 @@ floatx80 floatx80_sub( floatx80 a, floatx80 b STATUS_PARAM )
 
 floatx80 floatx80_mul( floatx80 a, floatx80 b STATUS_PARAM )
 {
-    flag aSign, bSign, zSign;
+    bool aSign, bSign, zSign;
     int_fast32_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig0, zSig1;
     floatx80 z;
@@ -4758,7 +4758,7 @@ floatx80 floatx80_mul( floatx80 a, floatx80 b STATUS_PARAM )
 
 floatx80 floatx80_div( floatx80 a, floatx80 b STATUS_PARAM )
 {
-    flag aSign, bSign, zSign;
+    bool aSign, bSign, zSign;
     int_fast32_t aExp, bExp, zExp;
     uint64_t aSig, bSig, zSig0, zSig1;
     uint64_t rem0, rem1, rem2, term0, term1, term2;
@@ -4838,7 +4838,7 @@ floatx80 floatx80_div( floatx80 a, floatx80 b STATUS_PARAM )
 
 floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM )
 {
-    flag aSign, zSign;
+    bool aSign, zSign;
     int_fast32_t aExp, bExp, expDiff;
     uint64_t aSig0, aSig1, bSig;
     uint64_t q, term0, term1, alternateASig0, alternateASig1;
@@ -4934,7 +4934,7 @@ floatx80 floatx80_rem( floatx80 a, floatx80 b STATUS_PARAM )
 
 floatx80 floatx80_sqrt( floatx80 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp, zExp;
     uint64_t aSig0, aSig1, zSig0, zSig1, doubleZSig0;
     uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3;
@@ -5033,7 +5033,7 @@ int floatx80_eq( floatx80 a, floatx80 b STATUS_PARAM )
 
 int floatx80_le( floatx80 a, floatx80 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
               && (uint64_t) ( extractFloatx80Frac( a )<<1 ) )
@@ -5066,7 +5066,7 @@ int floatx80_le( floatx80 a, floatx80 b STATUS_PARAM )
 
 int floatx80_lt( floatx80 a, floatx80 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
               && (uint64_t) ( extractFloatx80Frac( a )<<1 ) )
@@ -5148,7 +5148,7 @@ int floatx80_eq_quiet( floatx80 a, floatx80 b STATUS_PARAM )
 
 int floatx80_le_quiet( floatx80 a, floatx80 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
               && (uint64_t) ( extractFloatx80Frac( a )<<1 ) )
@@ -5184,7 +5184,7 @@ int floatx80_le_quiet( floatx80 a, floatx80 b STATUS_PARAM )
 
 int floatx80_lt_quiet( floatx80 a, floatx80 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
               && (uint64_t) ( extractFloatx80Frac( a )<<1 ) )
@@ -5245,7 +5245,7 @@ int floatx80_unordered_quiet( floatx80 a, floatx80 b STATUS_PARAM )
 
 int_fast32_t float128_to_int32(float128 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp, shiftCount;
     uint64_t aSig0, aSig1;
 
@@ -5274,7 +5274,7 @@ int_fast32_t float128_to_int32(float128 a STATUS_PARAM)
 
 int_fast32_t float128_to_int32_round_to_zero(float128 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp, shiftCount;
     uint64_t aSig0, aSig1, savedASig;
     int_fast32_t z;
@@ -5322,7 +5322,7 @@ int_fast32_t float128_to_int32_round_to_zero(float128 a STATUS_PARAM)
 
 int_fast64_t float128_to_int64(float128 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp, shiftCount;
     uint64_t aSig0, aSig1;
 
@@ -5365,7 +5365,7 @@ int_fast64_t float128_to_int64(float128 a STATUS_PARAM)
 
 int_fast64_t float128_to_int64_round_to_zero(float128 a STATUS_PARAM)
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp, shiftCount;
     uint64_t aSig0, aSig1;
     int_fast64_t z;
@@ -5423,7 +5423,7 @@ int_fast64_t float128_to_int64_round_to_zero(float128 a STATUS_PARAM)
 
 float32 float128_to_float32( float128 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp;
     uint64_t aSig0, aSig1;
     uint32_t zSig;
@@ -5458,7 +5458,7 @@ float32 float128_to_float32( float128 a STATUS_PARAM )
 
 float64 float128_to_float64( float128 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp;
     uint64_t aSig0, aSig1;
 
@@ -5491,7 +5491,7 @@ float64 float128_to_float64( float128 a STATUS_PARAM )
 
 floatx80 float128_to_floatx80( float128 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp;
     uint64_t aSig0, aSig1;
 
@@ -5526,7 +5526,7 @@ floatx80 float128_to_floatx80( float128 a STATUS_PARAM )
 
 float128 float128_round_to_int( float128 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp;
     uint64_t lastBitMask, roundBitsMask;
     int_fast8_t roundingMode;
@@ -5628,7 +5628,7 @@ float128 float128_round_to_int( float128 a STATUS_PARAM )
 | Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static float128 addFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM)
+static float128 addFloat128Sigs(float128 a, float128 b, bool zSign STATUS_PARAM)
 {
     int_fast32_t aExp, bExp, zExp;
     uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2;
@@ -5714,7 +5714,7 @@ static float128 addFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM
 | Standard for Binary Floating-Point Arithmetic.
 *----------------------------------------------------------------------------*/
 
-static float128 subFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM)
+static float128 subFloat128Sigs(float128 a, float128 b, bool zSign STATUS_PARAM)
 {
     int_fast32_t aExp, bExp, zExp;
     uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1;
@@ -5798,7 +5798,7 @@ static float128 subFloat128Sigs( float128 a, float128 b, flag zSign STATUS_PARAM
 
 float128 float128_add( float128 a, float128 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     aSign = extractFloat128Sign( a );
     bSign = extractFloat128Sign( b );
@@ -5819,7 +5819,7 @@ float128 float128_add( float128 a, float128 b STATUS_PARAM )
 
 float128 float128_sub( float128 a, float128 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     aSign = extractFloat128Sign( a );
     bSign = extractFloat128Sign( b );
@@ -5840,7 +5840,7 @@ float128 float128_sub( float128 a, float128 b STATUS_PARAM )
 
 float128 float128_mul( float128 a, float128 b STATUS_PARAM )
 {
-    flag aSign, bSign, zSign;
+    bool aSign, bSign, zSign;
     int_fast32_t aExp, bExp, zExp;
     uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2, zSig3;
     float128 z;
@@ -5904,7 +5904,7 @@ float128 float128_mul( float128 a, float128 b STATUS_PARAM )
 
 float128 float128_div( float128 a, float128 b STATUS_PARAM )
 {
-    flag aSign, bSign, zSign;
+    bool aSign, bSign, zSign;
     int_fast32_t aExp, bExp, zExp;
     uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2;
     uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3;
@@ -5988,7 +5988,7 @@ float128 float128_div( float128 a, float128 b STATUS_PARAM )
 
 float128 float128_rem( float128 a, float128 b STATUS_PARAM )
 {
-    flag aSign, zSign;
+    bool aSign, zSign;
     int_fast32_t aExp, bExp, expDiff;
     uint64_t aSig0, aSig1, bSig0, bSig1, q, term0, term1, term2;
     uint64_t allZero, alternateASig0, alternateASig1, sigMean1;
@@ -6097,7 +6097,7 @@ float128 float128_rem( float128 a, float128 b STATUS_PARAM )
 
 float128 float128_sqrt( float128 a STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int_fast32_t aExp, zExp;
     uint64_t aSig0, aSig1, zSig0, zSig1, zSig2, doubleZSig0;
     uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3;
@@ -6194,7 +6194,7 @@ int float128_eq( float128 a, float128 b STATUS_PARAM )
 
 int float128_le( float128 a, float128 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     if (    (    ( extractFloat128Exp( a ) == 0x7FFF )
               && ( extractFloat128Frac0( a ) | extractFloat128Frac1( a ) ) )
@@ -6227,7 +6227,7 @@ int float128_le( float128 a, float128 b STATUS_PARAM )
 
 int float128_lt( float128 a, float128 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     if (    (    ( extractFloat128Exp( a ) == 0x7FFF )
               && ( extractFloat128Frac0( a ) | extractFloat128Frac1( a ) ) )
@@ -6310,7 +6310,7 @@ int float128_eq_quiet( float128 a, float128 b STATUS_PARAM )
 
 int float128_le_quiet( float128 a, float128 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     if (    (    ( extractFloat128Exp( a ) == 0x7FFF )
               && ( extractFloat128Frac0( a ) | extractFloat128Frac1( a ) ) )
@@ -6346,7 +6346,7 @@ int float128_le_quiet( float128 a, float128 b STATUS_PARAM )
 
 int float128_lt_quiet( float128 a, float128 b STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     if (    (    ( extractFloat128Exp( a ) == 0x7FFF )
               && ( extractFloat128Frac0( a ) | extractFloat128Frac1( a ) ) )
@@ -6542,7 +6542,7 @@ uint64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
 INLINE int float ## s ## _compare_internal( float ## s a, float ## s b,      \
                                       int is_quiet STATUS_PARAM )            \
 {                                                                            \
-    flag aSign, bSign;                                                       \
+    bool aSign, bSign;                                                       \
     uint ## s ## _t av, bv;                                                  \
     a = float ## s ## _squash_input_denormal(a STATUS_VAR);                  \
     b = float ## s ## _squash_input_denormal(b STATUS_VAR);                  \
@@ -6594,7 +6594,7 @@ COMPARE(64, 0x7ff)
 INLINE int floatx80_compare_internal( floatx80 a, floatx80 b,
                                       int is_quiet STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     if (( ( extractFloatx80Exp( a ) == 0x7fff ) &&
           ( extractFloatx80Frac( a )<<1 ) ) ||
@@ -6640,7 +6640,7 @@ int floatx80_compare_quiet( floatx80 a, floatx80 b STATUS_PARAM )
 INLINE int float128_compare_internal( float128 a, float128 b,
                                       int is_quiet STATUS_PARAM )
 {
-    flag aSign, bSign;
+    bool aSign, bSign;
 
     if (( ( extractFloat128Exp( a ) == 0x7fff ) &&
           ( extractFloat128Frac0( a ) | extractFloat128Frac1( a ) ) ) ||
@@ -6689,7 +6689,7 @@ int float128_compare_quiet( float128 a, float128 b STATUS_PARAM )
 INLINE float ## s float ## s ## _minmax(float ## s a, float ## s b,     \
                                         int ismin STATUS_PARAM )        \
 {                                                                       \
-    flag aSign, bSign;                                                  \
+    bool aSign, bSign;                                                  \
     uint ## s ## _t av, bv;                                             \
     a = float ## s ## _squash_input_denormal(a STATUS_VAR);             \
     b = float ## s ## _squash_input_denormal(b STATUS_VAR);             \
@@ -6733,7 +6733,7 @@ MINMAX(64, 0x7ff)
 /* Multiply A by 2 raised to the power N.  */
 float32 float32_scalbn( float32 a, int n STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int16_t aExp;
     uint32_t aSig;
 
@@ -6766,7 +6766,7 @@ float32 float32_scalbn( float32 a, int n STATUS_PARAM )
 
 float64 float64_scalbn( float64 a, int n STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int16_t aExp;
     uint64_t aSig;
 
@@ -6799,7 +6799,7 @@ float64 float64_scalbn( float64 a, int n STATUS_PARAM )
 
 floatx80 floatx80_scalbn( floatx80 a, int n STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int32_t aExp;
     uint64_t aSig;
 
@@ -6830,7 +6830,7 @@ floatx80 floatx80_scalbn( floatx80 a, int n STATUS_PARAM )
 
 float128 float128_scalbn( float128 a, int n STATUS_PARAM )
 {
-    flag aSign;
+    bool aSign;
     int32_t aExp;
     uint64_t aSig0, aSig1;
 
diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 0c43436..257733d 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -43,19 +43,10 @@ these four paragraphs for those parts of this code that are retained.
 #endif
 
 #include <inttypes.h>
+#include <stdbool.h>
 #include "config-host.h"
 #include "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'.
-*----------------------------------------------------------------------------*/
-typedef uint8_t flag;
-
 #define LIT64( a ) a##LL
 #define INLINE static inline
 
@@ -166,10 +157,10 @@ typedef struct float_status {
     signed char float_exception_flags;
     signed char floatx80_rounding_precision;
     /* should denormalised results go to zero and set the inexact flag? */
-    flag flush_to_zero;
+    bool flush_to_zero;
     /* should denormalised inputs go to zero and set the input_denormal flag? */
-    flag flush_inputs_to_zero;
-    flag default_nan_mode;
+    bool flush_inputs_to_zero;
+    bool default_nan_mode;
 } float_status;
 
 void set_float_rounding_mode(int val STATUS_PARAM);
@@ -178,15 +169,15 @@ INLINE void set_float_detect_tininess(int val STATUS_PARAM)
 {
     STATUS(float_detect_tininess) = val;
 }
-INLINE void set_flush_to_zero(flag val STATUS_PARAM)
+INLINE void set_flush_to_zero(bool val STATUS_PARAM)
 {
     STATUS(flush_to_zero) = val;
 }
-INLINE void set_flush_inputs_to_zero(flag val STATUS_PARAM)
+INLINE void set_flush_inputs_to_zero(bool val STATUS_PARAM)
 {
     STATUS(flush_inputs_to_zero) = val;
 }
-INLINE void set_default_nan_mode(flag val STATUS_PARAM)
+INLINE void set_default_nan_mode(bool val STATUS_PARAM)
 {
     STATUS(default_nan_mode) = val;
 }
@@ -233,8 +224,8 @@ float128 int64_to_float128(int_fast64_t STATUS_PARAM);
 /*----------------------------------------------------------------------------
 | Software half-precision conversion routines.
 *----------------------------------------------------------------------------*/
-float16 float32_to_float16( float32, flag STATUS_PARAM );
-float32 float16_to_float32( float16, flag STATUS_PARAM );
+float16 float32_to_float16(float32, bool STATUS_PARAM);
+float32 float16_to_float32(float16, bool STATUS_PARAM);
 
 /*----------------------------------------------------------------------------
 | Software half-precision operations.
-- 
1.7.7

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

* Re: [Qemu-devel] [PATCH 03/14] qemu-tool: Fix mixup of int64 and int64_t
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 03/14] qemu-tool: Fix mixup of int64 and int64_t Andreas Färber
@ 2012-01-16  8:11   ` Stefan Hajnoczi
  0 siblings, 0 replies; 40+ messages in thread
From: Stefan Hajnoczi @ 2012-01-16  8:11 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Kevin Wolf, Paolo Bonzini, Anthony Liguori, qemu-devel, Frediano Ziglio

On Mon, Jan 16, 2012 at 01:46:52AM +0100, Andreas Färber wrote:
> Commit cbcfa0418f0c196afa765f5c9837b9344d1adcf3 (link the main loop and
> its dependencies into the tools) introduced stray usages of int64.
> 
> Use int64_t instead.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  qemu-tool.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

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

* Re: [Qemu-devel] [PATCH 01/14] lm32: Fix mixup of uint32 and uint32_t
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 01/14] lm32: Fix mixup of uint32 and uint32_t Andreas Färber
@ 2012-01-16 11:27   ` Peter Maydell
  2012-01-16 12:18     ` Andreas Färber
  2012-01-16 21:39     ` Michael Walle
  2012-01-17  9:44   ` [Qemu-devel] [PATCH v2] " Andreas Färber
  1 sibling, 2 replies; 40+ messages in thread
From: Peter Maydell @ 2012-01-16 11:27 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Edgar E. Iglesias, Michael Walle, qemu-devel

On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
> diff --git a/hw/milkymist-vgafb_template.h b/hw/milkymist-vgafb_template.h
> index 69af9ef..544b55e 100644
> --- a/hw/milkymist-vgafb_template.h
> +++ b/hw/milkymist-vgafb_template.h
> @@ -39,7 +39,7 @@
>  #elif BITS == 24
>  #define COPY_PIXEL(to, r, g, b)                    \
>     do {                                           \
> -        uint32 tmp = rgb_to_pixel24(r, g, b);      \
> +        uint32_t tmp = rgb_to_pixel24(r, g, b);      \
>         *(to++) =         tmp & 0xff;              \
>         *(to++) =  (tmp >> 8) & 0xff;              \
>         *(to++) = (tmp >> 16) & 0xff;              \

This change breaks the otherwise consistent alignment of the '\'
characters in column 51...

-- PMM

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

* Re: [Qemu-devel] [PATCH 05/14] target-mips: Move definition of uint_fast{8, 16}_t to osdep.h
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 05/14] target-mips: Move definition of uint_fast{8, 16}_t to osdep.h Andreas Färber
@ 2012-01-16 11:38   ` Peter Maydell
  2012-01-16 12:13     ` Andreas Färber
  0 siblings, 1 reply; 40+ messages in thread
From: Peter Maydell @ 2012-01-16 11:38 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Anthony Liguori, Jan Kiszka, qemu-devel, Blue Swirl, Stefan Weil,
	Aurélien Jarno

On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
> +#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
> +/* uint_fast8_t and uint_fast16_t not in <sys/int_types.h> */
> +typedef unsigned char           uint_fast8_t;
> +typedef unsigned int            uint_fast16_t;
> +#endif

If you make the comment say
/* uint_fast*_t and int_fast*_t not in <sys/int_types.h> */

then it won't become out of date when your later patches add
the other types to this section.

-- PMM

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

* Re: [Qemu-devel] [PATCH 05/14] target-mips: Move definition of uint_fast{8, 16}_t to osdep.h
  2012-01-16 11:38   ` Peter Maydell
@ 2012-01-16 12:13     ` Andreas Färber
  2012-01-16 12:21       ` Peter Maydell
  0 siblings, 1 reply; 40+ messages in thread
From: Andreas Färber @ 2012-01-16 12:13 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Anthony Liguori, Jan Kiszka, qemu-devel, Blue Swirl, Stefan Weil,
	Aurélien Jarno

Am 16.01.2012 12:38, schrieb Peter Maydell:
> On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
>> +#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
>> +/* uint_fast8_t and uint_fast16_t not in <sys/int_types.h> */
>> +typedef unsigned char           uint_fast8_t;
>> +typedef unsigned int            uint_fast16_t;
>> +#endif
> 
> If you make the comment say
> /* uint_fast*_t and int_fast*_t not in <sys/int_types.h> */
> 
> then it won't become out of date when your later patches add
> the other types to this section.

I have no clue if that is the case, I just moved it and fixed the
comment style. But sure, I can change the comment itself as well.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] [PATCH 01/14] lm32: Fix mixup of uint32 and uint32_t
  2012-01-16 11:27   ` Peter Maydell
@ 2012-01-16 12:18     ` Andreas Färber
  2012-01-16 21:39     ` Michael Walle
  1 sibling, 0 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16 12:18 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Edgar E. Iglesias, Michael Walle, qemu-devel

Am 16.01.2012 12:27, schrieb Peter Maydell:
> On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
>> diff --git a/hw/milkymist-vgafb_template.h b/hw/milkymist-vgafb_template.h
>> index 69af9ef..544b55e 100644
>> --- a/hw/milkymist-vgafb_template.h
>> +++ b/hw/milkymist-vgafb_template.h
>> @@ -39,7 +39,7 @@
>>  #elif BITS == 24
>>  #define COPY_PIXEL(to, r, g, b)                    \
>>     do {                                           \
>> -        uint32 tmp = rgb_to_pixel24(r, g, b);      \
>> +        uint32_t tmp = rgb_to_pixel24(r, g, b);      \
>>         *(to++) =         tmp & 0xff;              \
>>         *(to++) =  (tmp >> 8) & 0xff;              \
>>         *(to++) = (tmp >> 16) & 0xff;              \
> 
> This change breaks the otherwise consistent alignment of the '\'
> characters in column 51...

Thanks, will fix!

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] [PATCH 05/14] target-mips: Move definition of uint_fast{8, 16}_t to osdep.h
  2012-01-16 12:13     ` Andreas Färber
@ 2012-01-16 12:21       ` Peter Maydell
  2012-01-16 12:24         ` Andreas Färber
  0 siblings, 1 reply; 40+ messages in thread
From: Peter Maydell @ 2012-01-16 12:21 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Anthony Liguori, Jan Kiszka, qemu-devel, Blue Swirl, Stefan Weil,
	Aurélien Jarno

On 16 January 2012 12:13, Andreas Färber <afaerber@suse.de> wrote:
> Am 16.01.2012 12:38, schrieb Peter Maydell:
>> On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
>>> +#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
>>> +/* uint_fast8_t and uint_fast16_t not in <sys/int_types.h> */
>>> +typedef unsigned char           uint_fast8_t;
>>> +typedef unsigned int            uint_fast16_t;
>>> +#endif
>>
>> If you make the comment say
>> /* uint_fast*_t and int_fast*_t not in <sys/int_types.h> */
>>
>> then it won't become out of date when your later patches add
>> the other types to this section.
>
> I have no clue if that is the case, I just moved it and fixed the
> comment style. But sure, I can change the comment itself as well.

Well, your later patches add more typedefs here, right? So we need
to know: either old Solaris doesn't have any of these types and we
must typedef them all (and the comment should match that), or it
is only missing the two currently noted here, in which case we don't
need to and should not add further typedefs. What we don't want is
to have a comment and code which disagree...

-- PMM

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

* Re: [Qemu-devel] [PATCH 05/14] target-mips: Move definition of uint_fast{8, 16}_t to osdep.h
  2012-01-16 12:21       ` Peter Maydell
@ 2012-01-16 12:24         ` Andreas Färber
  0 siblings, 0 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-16 12:24 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Anthony Liguori, Jan Kiszka, qemu-devel, Blue Swirl, Stefan Weil,
	Aurélien Jarno

Am 16.01.2012 13:21, schrieb Peter Maydell:
> On 16 January 2012 12:13, Andreas Färber <afaerber@suse.de> wrote:
>> Am 16.01.2012 12:38, schrieb Peter Maydell:
>>> On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
>>>> +#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
>>>> +/* uint_fast8_t and uint_fast16_t not in <sys/int_types.h> */
>>>> +typedef unsigned char           uint_fast8_t;
>>>> +typedef unsigned int            uint_fast16_t;
>>>> +#endif
>>>
>>> If you make the comment say
>>> /* uint_fast*_t and int_fast*_t not in <sys/int_types.h> */
>>>
>>> then it won't become out of date when your later patches add
>>> the other types to this section.
>>
>> I have no clue if that is the case, I just moved it and fixed the
>> comment style. But sure, I can change the comment itself as well.
> 
> Well, your later patches add more typedefs here, right? So we need
> to know: either old Solaris doesn't have any of these types and we
> must typedef them all (and the comment should match that), or it
> is only missing the two currently noted here, in which case we don't
> need to and should not add further typedefs. What we don't want is
> to have a comment and code which disagree...

I'm hoping Ben can clarify. Fabrice attributed the Solaris/sparc support
to him.

/-F

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] [PATCH 04/14] softfloat: Fix mixups of int and int16
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 04/14] softfloat: Fix mixups of int and int16 Andreas Färber
@ 2012-01-16 17:51   ` Peter Maydell
  0 siblings, 0 replies; 40+ messages in thread
From: Peter Maydell @ 2012-01-16 17:51 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Blue Swirl, qemu-devel, Aurelien Jarno

On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
> normalizeFloat{32,64}Subnormal() expect the exponent as int16, not int.
> This went unnoticed since int16 and uint16 were both typedef'ed to int.

I think at the time I wrote that I was being slightly conservative
because I didn't feel like confirming that we wouldn't overflow a
16 bit type.

Anyway, I have tested this patch:
 * in combination with your others
 * with typedefs set up so all int16 &co are the minimum width they
   could be
 * with typedefs so int16 &co are all 64 bits wide

and this all still gives the right results for ARM vfm, so

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM

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

* Re: [Qemu-devel] [PATCH 06/14] softfloat: Replace uint16 type with uint_fast16_t
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 06/14] softfloat: Replace uint16 type with uint_fast16_t Andreas Färber
@ 2012-01-16 18:43   ` Peter Maydell
  0 siblings, 0 replies; 40+ messages in thread
From: Peter Maydell @ 2012-01-16 18:43 UTC (permalink / raw)
  To: Andreas Färber
  Cc: qemu-devel, Blue Swirl, Christophe Lyon, malc, Juan Pineda,
	Aurelien Jarno

2012/1/16 Andreas Färber <afaerber@suse.de>:
> -typedef int uint16;

...I see we've been using a signed type for uint16 all this time.
I'm surprised that hasn't caused any problems :-)

-- PMM

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

* Re: [Qemu-devel] [PATCH 09/14] softfloat: Replace int8 type with int_fast8_t
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 09/14] softfloat: Replace int8 type with int_fast8_t Andreas Färber
@ 2012-01-16 18:48   ` Peter Maydell
  0 siblings, 0 replies; 40+ messages in thread
From: Peter Maydell @ 2012-01-16 18:48 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Anthony Liguori, Stefan Weil, Jan Kiszka, qemu-devel, Blue Swirl,
	Christophe Lyon, Aurelien Jarno

On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
> -static int8 countLeadingZeros32( uint32_t a )
> +static int_fast8_t countLeadingZeros32(uint32_t a)
>  {
>  #if SOFTFLOAT_GNUC_PREREQ(3, 4)
>     if (a) {
> @@ -634,7 +634,7 @@ static int8 countLeadingZeros32( uint32_t a )
>         return 32;
>     }
>  #else
> -    static const int8 countLeadingZerosHigh[] = {
> +    static const int_fast8_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,
> @@ -652,7 +652,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
>     };

It seems unlikely that anybody will actually try to compile
qemu with gcc 3 any more, but this table should probably be
an int8_t[], not int_fast8_t[]. (Both will work, but the fast
types make sense for register values rather than in-memory
lookup tables IMHO.)

-- PMM

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

* Re: [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (13 preceding siblings ...)
  2012-01-16  0:47 ` [Qemu-devel] [PATCH 14/14] softfloat: Replace flag type with bool Andreas Färber
@ 2012-01-16 19:02 ` Peter Maydell
  2012-01-16 19:12   ` Alexander Graf
  2012-01-20 13:05 ` Peter Maydell
  15 siblings, 1 reply; 40+ messages in thread
From: Peter Maydell @ 2012-01-16 19:02 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Rui Carmo, Pavel Borzenkov, qemu-devel, Eric Sunshine,
	Alexander Graf, Blue Swirl, Christophe Lyon, malc, Juan Pineda,
	Aurélien Jarno

On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
> Based on a suggestion from Alex earlier this week, I managed to run a
> simple benchmark of softfloat performance with qemu-arm, as requested by
> Peter.
>
> I went for the Whetstone floating point benchmark:
> http://en.wikipedia.org/wiki/Whetstone_%28benchmark%29
>
> For a loop count of 100,000 and 5 runs I got the following results:
>
>  current:        138.9-204.1 Whetstone-MIPS
>  [u]int*_t:      185.2-188.7 Whetstone-MIPS
>  [u]int_fast*_t: 285.7-294.1 Whetstone-MIPS
>
>  Toshiba AC100:  833.3-909.1 Whetstone-MIPS

This is much better than I was expecting when I suggested running
a benchmark :-) and indicates that it's worth a bit of pain to
switch to the fast* types.

I've tested this series with the ARM VFP/Neon tests I have (random
instruction sequence testing). I found a few extra bugs which I've
sent a separate patch series for: those patches need to be
incorporated into this series or otherwise applied before it.

I've commented on patches 01, 05, 09; the rest are
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

with the following caveat.

The changes from int32/uint32 to int_fast32_t/uint_fast32_t are
the potentially dangerous ones in this set, since they change a
type that was easily mistaken for "exactly 32 bits" and happened
to be 32 bits to one that is now 64 bits (on 64 bit hosts).
The other type changes are either "not a width change in practice"
(int64) or "change from something that was already wider than the
number in it" (int16) or "wasn't being used for things where we
really cared about the type width" (int8, flag).

Specifically, it's this change that revealed the latent bugs I
sent a three-patch set for, and so it doesn't seem too unlikely
that other platforms may have some similar bugs in their
int-to-float/float-to-int code that will now be revealed on
64 bit hosts.

I don't think that means we shouldn't apply this patch set but
I would recommend some testing of other architectures :-)

-- PMM

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

* Re: [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked
  2012-01-16 19:02 ` [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Peter Maydell
@ 2012-01-16 19:12   ` Alexander Graf
  2012-01-16 19:17     ` Peter Maydell
  0 siblings, 1 reply; 40+ messages in thread
From: Alexander Graf @ 2012-01-16 19:12 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Rui Carmo, Pavel Borzenkov, qemu-devel, Eric Sunshine,
	Blue Swirl, Christophe Lyon, malc, Juan Pineda,
	Andreas Färber, Aurélien Jarno


On 16.01.2012, at 20:02, Peter Maydell wrote:

> On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
>> Based on a suggestion from Alex earlier this week, I managed to run a
>> simple benchmark of softfloat performance with qemu-arm, as requested by
>> Peter.
>> 
>> I went for the Whetstone floating point benchmark:
>> http://en.wikipedia.org/wiki/Whetstone_%28benchmark%29
>> 
>> For a loop count of 100,000 and 5 runs I got the following results:
>> 
>>  current:        138.9-204.1 Whetstone-MIPS
>>  [u]int*_t:      185.2-188.7 Whetstone-MIPS
>>  [u]int_fast*_t: 285.7-294.1 Whetstone-MIPS
>> 
>>  Toshiba AC100:  833.3-909.1 Whetstone-MIPS
> 
> This is much better than I was expecting when I suggested running
> a benchmark :-) and indicates that it's worth a bit of pain to
> switch to the fast* types.
> 
> I've tested this series with the ARM VFP/Neon tests I have (random
> instruction sequence testing). I found a few extra bugs which I've
> sent a separate patch series for: those patches need to be
> incorporated into this series or otherwise applied before it.
> 
> I've commented on patches 01, 05, 09; the rest are
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> with the following caveat.
> 
> The changes from int32/uint32 to int_fast32_t/uint_fast32_t are
> the potentially dangerous ones in this set, since they change a
> type that was easily mistaken for "exactly 32 bits" and happened
> to be 32 bits to one that is now 64 bits (on 64 bit hosts).
> The other type changes are either "not a width change in practice"
> (int64) or "change from something that was already wider than the
> number in it" (int16) or "wasn't being used for things where we
> really cared about the type width" (int8, flag).
> 
> Specifically, it's this change that revealed the latent bugs I
> sent a three-patch set for, and so it doesn't seem too unlikely
> that other platforms may have some similar bugs in their
> int-to-float/float-to-int code that will now be revealed on
> 64 bit hosts.
> 
> I don't think that means we shouldn't apply this patch set but
> I would recommend some testing of other architectures :-)

So what if we leave uint32_t be uint32_t and make the other ones _fast_?


Alex

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

* Re: [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked
  2012-01-16 19:12   ` Alexander Graf
@ 2012-01-16 19:17     ` Peter Maydell
  2012-01-16 19:18       ` Alexander Graf
  0 siblings, 1 reply; 40+ messages in thread
From: Peter Maydell @ 2012-01-16 19:17 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Rui Carmo, Pavel Borzenkov, qemu-devel, Eric Sunshine,
	Blue Swirl, Christophe Lyon, malc, Juan Pineda,
	Andreas Färber, Aurélien Jarno

On 16 January 2012 19:12, Alexander Graf <agraf@suse.de> wrote:
>
> On 16.01.2012, at 20:02, Peter Maydell wrote:
>> The changes from int32/uint32 to int_fast32_t/uint_fast32_t are
>> the potentially dangerous ones in this set, since they change a
>> type that was easily mistaken for "exactly 32 bits" and happened
>> to be 32 bits to one that is now 64 bits (on 64 bit hosts).
>> The other type changes are either "not a width change in practice"
>> (int64) or "change from something that was already wider than the
>> number in it" (int16) or "wasn't being used for things where we
>> really cared about the type width" (int8, flag).
>>
>> Specifically, it's this change that revealed the latent bugs I
>> sent a three-patch set for, and so it doesn't seem too unlikely
>> that other platforms may have some similar bugs in their
>> int-to-float/float-to-int code that will now be revealed on
>> 64 bit hosts.
>>
>> I don't think that means we shouldn't apply this patch set but
>> I would recommend some testing of other architectures :-)
>
> So what if we leave uint32_t be uint32_t and make the other ones _fast_?

We'd need to get Andreas to do another benchmark run to check that
this didn't lose the perf gain. Also it's kind of aesthetically
not very pleasing...

-- PMM

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

* Re: [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked
  2012-01-16 19:17     ` Peter Maydell
@ 2012-01-16 19:18       ` Alexander Graf
  2012-01-16 23:52         ` Peter Maydell
  0 siblings, 1 reply; 40+ messages in thread
From: Alexander Graf @ 2012-01-16 19:18 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Rui Carmo, Pavel Borzenkov, qemu-devel, Eric Sunshine,
	Blue Swirl, Christophe Lyon, malc, Juan Pineda,
	Andreas Färber, Aurélien Jarno


On 16.01.2012, at 20:17, Peter Maydell wrote:

> On 16 January 2012 19:12, Alexander Graf <agraf@suse.de> wrote:
>> 
>> On 16.01.2012, at 20:02, Peter Maydell wrote:
>>> The changes from int32/uint32 to int_fast32_t/uint_fast32_t are
>>> the potentially dangerous ones in this set, since they change a
>>> type that was easily mistaken for "exactly 32 bits" and happened
>>> to be 32 bits to one that is now 64 bits (on 64 bit hosts).
>>> The other type changes are either "not a width change in practice"
>>> (int64) or "change from something that was already wider than the
>>> number in it" (int16) or "wasn't being used for things where we
>>> really cared about the type width" (int8, flag).
>>> 
>>> Specifically, it's this change that revealed the latent bugs I
>>> sent a three-patch set for, and so it doesn't seem too unlikely
>>> that other platforms may have some similar bugs in their
>>> int-to-float/float-to-int code that will now be revealed on
>>> 64 bit hosts.
>>> 
>>> I don't think that means we shouldn't apply this patch set but
>>> I would recommend some testing of other architectures :-)
>> 
>> So what if we leave uint32_t be uint32_t and make the other ones _fast_?
> 
> We'd need to get Andreas to do another benchmark run to check that
> this didn't lose the perf gain. Also it's kind of aesthetically
> not very pleasing...

Yeah, but it's safe. And I would assume that 32bit integers are better optimized for than smaller ones in today's CPUs.


Alex

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

* Re: [Qemu-devel] [PATCH 01/14] lm32: Fix mixup of uint32 and uint32_t
  2012-01-16 11:27   ` Peter Maydell
  2012-01-16 12:18     ` Andreas Färber
@ 2012-01-16 21:39     ` Michael Walle
  1 sibling, 0 replies; 40+ messages in thread
From: Michael Walle @ 2012-01-16 21:39 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Edgar E. Iglesias, Andreas Färber, qemu-devel

Am Montag 16 Januar 2012, 12:27:01 schrieb Peter Maydell:
> On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
> > diff --git a/hw/milkymist-vgafb_template.h
> > b/hw/milkymist-vgafb_template.h index 69af9ef..544b55e 100644
> > --- a/hw/milkymist-vgafb_template.h
> > +++ b/hw/milkymist-vgafb_template.h
> > @@ -39,7 +39,7 @@
> >  #elif BITS == 24
> >  #define COPY_PIXEL(to, r, g, b)                    \
> >     do {                                           \
> > -        uint32 tmp = rgb_to_pixel24(r, g, b);      \
> > +        uint32_t tmp = rgb_to_pixel24(r, g, b);      \
> >         *(to++) =         tmp & 0xff;              \
> >         *(to++) =  (tmp >> 8) & 0xff;              \
> >         *(to++) = (tmp >> 16) & 0xff;              \
> 
> This change breaks the otherwise consistent alignment of the '\'
> characters in column 51...

apart from that,

Acked-by: Michael Walle <michael@walle.cc>

-- 
michael

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

* Re: [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked
  2012-01-16 19:18       ` Alexander Graf
@ 2012-01-16 23:52         ` Peter Maydell
  2012-01-17  0:05           ` Alexander Graf
  0 siblings, 1 reply; 40+ messages in thread
From: Peter Maydell @ 2012-01-16 23:52 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Rui Carmo, Pavel Borzenkov, qemu-devel, Eric Sunshine,
	Blue Swirl, Christophe Lyon, malc, Juan Pineda,
	Andreas Färber, Aurélien Jarno

On 16 January 2012 19:18, Alexander Graf <agraf@suse.de> wrote:
> On 16.01.2012, at 20:17, Peter Maydell wrote:
>> On 16 January 2012 19:12, Alexander Graf <agraf@suse.de> wrote:
>>> So what if we leave uint32_t be uint32_t and make the other ones _fast_?
>>
>> We'd need to get Andreas to do another benchmark run to check that
>> this didn't lose the perf gain. Also it's kind of aesthetically
>> not very pleasing...
>
> Yeah, but it's safe.

Safety is for people with insufficiently comprehensive test suites :-)

-- PMM

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

* Re: [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked
  2012-01-16 23:52         ` Peter Maydell
@ 2012-01-17  0:05           ` Alexander Graf
  0 siblings, 0 replies; 40+ messages in thread
From: Alexander Graf @ 2012-01-17  0:05 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Rui Carmo, Pavel Borzenkov, qemu-devel, Eric Sunshine,
	Blue Swirl, Christophe Lyon, malc, Juan Pineda,
	Andreas Färber, Aurélien Jarno


On 17.01.2012, at 00:52, Peter Maydell wrote:

> On 16 January 2012 19:18, Alexander Graf <agraf@suse.de> wrote:
>> On 16.01.2012, at 20:17, Peter Maydell wrote:
>>> On 16 January 2012 19:12, Alexander Graf <agraf@suse.de> wrote:
>>>> So what if we leave uint32_t be uint32_t and make the other ones _fast_?
>>> 
>>> We'd need to get Andreas to do another benchmark run to check that
>>> this didn't lose the perf gain. Also it's kind of aesthetically
>>> not very pleasing...
>> 
>> Yeah, but it's safe.
> 
> Safety is for people with insufficiently comprehensive test suites :-)

You mean all the non-arm targets? :)

Alex

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

* [Qemu-devel] [PATCH v2] lm32: Fix mixup of uint32 and uint32_t
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 01/14] lm32: Fix mixup of uint32 and uint32_t Andreas Färber
  2012-01-16 11:27   ` Peter Maydell
@ 2012-01-17  9:44   ` Andreas Färber
  2012-01-19  8:17     ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  1 sibling, 1 reply; 40+ messages in thread
From: Andreas Färber @ 2012-01-17  9:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Peter Maydell, Michael Walle, Andreas Färber,
	Edgar E. Iglesias

Commit d23948b15a9920fb7f6374b55a6db1ecff81f3ee (lm32: add Milkymist
VGAFB support) introduced a stray usage of the softfloat uint32 type.

Use uint32_t instead.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
Cc: Peter Maydell <peter.maydell@linaro.org>
---
 hw/milkymist-vgafb_template.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/milkymist-vgafb_template.h b/hw/milkymist-vgafb_template.h
index 69af9ef..1d33ee8 100644
--- a/hw/milkymist-vgafb_template.h
+++ b/hw/milkymist-vgafb_template.h
@@ -39,7 +39,7 @@
 #elif BITS == 24
 #define COPY_PIXEL(to, r, g, b)                    \
     do {                                           \
-        uint32 tmp = rgb_to_pixel24(r, g, b);      \
+        uint32_t tmp = rgb_to_pixel24(r, g, b);    \
         *(to++) =         tmp & 0xff;              \
         *(to++) =  (tmp >> 8) & 0xff;              \
         *(to++) = (tmp >> 16) & 0xff;              \
-- 
1.7.7

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

* Re: [Qemu-devel] [Qemu-trivial] [PATCH v2] lm32: Fix mixup of uint32 and uint32_t
  2012-01-17  9:44   ` [Qemu-devel] [PATCH v2] " Andreas Färber
@ 2012-01-19  8:17     ` Stefan Hajnoczi
  0 siblings, 0 replies; 40+ messages in thread
From: Stefan Hajnoczi @ 2012-01-19  8:17 UTC (permalink / raw)
  To: Andreas Färber
  Cc: qemu-trivial, Peter Maydell, Michael Walle, qemu-devel,
	Edgar E. Iglesias

On Tue, Jan 17, 2012 at 10:44:40AM +0100, Andreas Färber wrote:
> Commit d23948b15a9920fb7f6374b55a6db1ecff81f3ee (lm32: add Milkymist
> VGAFB support) introduced a stray usage of the softfloat uint32 type.
> 
> Use uint32_t instead.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> Acked-by: Michael Walle <michael@walle.cc>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/milkymist-vgafb_template.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

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

* Re: [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked
  2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
                   ` (14 preceding siblings ...)
  2012-01-16 19:02 ` [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Peter Maydell
@ 2012-01-20 13:05 ` Peter Maydell
  2012-01-23 17:41   ` Andreas Färber
  15 siblings, 1 reply; 40+ messages in thread
From: Peter Maydell @ 2012-01-20 13:05 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Rui Carmo, Pavel Borzenkov, qemu-devel, Eric Sunshine,
	Alexander Graf, Blue Swirl, Christophe Lyon, malc, Juan Pineda,
	Aurélien Jarno

On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
> For a loop count of 100,000 and 5 runs I got the following results:
>
>  current:        138.9-204.1 Whetstone-MIPS
>  [u]int*_t:      185.2-188.7 Whetstone-MIPS
>  [u]int_fast*_t: 285.7-294.1 Whetstone-MIPS
>
>  Toshiba AC100:  833.3-909.1 Whetstone-MIPS
>
> These results seem to indicate that the "fast" POSIX types are indeed
> somewhat faster, both compared to exact-size POSIX types and to the
> current state.

OTOH I did a run of scimark2 and got:
current tree:
**                                                              **
** SciMark2 Numeric Benchmark, see http://math.nist.gov/scimark **
** for details. (Results can be submitted to pozo@nist.gov)     **
**                                                              **
Using       2.00 seconds min time per kenel.
Composite Score:           12.98
FFT             Mflops:     7.66    (N=1024)
SOR             Mflops:    19.49    (100 x 100)
MonteCarlo:     Mflops:     6.12
Sparse matmult  Mflops:    15.34    (N=1000, nz=5000)
LU              Mflops:    16.28    (M=100, N=100)

with patches (yours and mine):
**                                                              **
** SciMark2 Numeric Benchmark, see http://math.nist.gov/scimark **
** for details. (Results can be submitted to pozo@nist.gov)     **
**                                                              **
Using       2.00 seconds min time per kenel.
Composite Score:           11.87
FFT             Mflops:     7.12    (N=1024)
SOR             Mflops:    17.66    (100 x 100)
MonteCarlo:     Mflops:     5.75
Sparse matmult  Mflops:    14.03    (N=1000, nz=5000)
LU              Mflops:    14.81    (M=100, N=100)

Hmmm...

-- PMM

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

* Re: [Qemu-devel] [PATCH 02/14] target-sparc: Fix mixup of uint64 and uint64_t
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 02/14] target-sparc: Fix mixup of uint64 and uint64_t Andreas Färber
@ 2012-01-21 18:51   ` Blue Swirl
  2012-01-22  2:03     ` Andreas Färber
  2012-01-22 10:02   ` Blue Swirl
  1 sibling, 1 reply; 40+ messages in thread
From: Blue Swirl @ 2012-01-21 18:51 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel, Richard Henderson

On Mon, Jan 16, 2012 at 00:46, Andreas Färber <afaerber@suse.de> wrote:
> Commit 793a137a41ad4125011c7022cf16a1baa40a5ab6 (target-sparc:
> Implement BMASK/BSHUFFLE.) introduced a stray usage of softfloat uint64
> type.
>
> Use uint64_t instead.
>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Blue Swirl <blauwirbel@gmail.com>

Good catch,
Reviewed-by: Blue Swirl <blauwirbel@gmail.com>

> ---
>  target-sparc/vis_helper.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/target-sparc/vis_helper.c b/target-sparc/vis_helper.c
> index a992c29..9d2edb0 100644
> --- a/target-sparc/vis_helper.c
> +++ b/target-sparc/vis_helper.c
> @@ -459,7 +459,7 @@ uint32_t helper_fpackfix(uint64_t gsr, uint64_t rs2)
>     return ret;
>  }
>
> -uint64 helper_bshuffle(uint64_t gsr, uint64_t src1, uint64_t src2)
> +uint64_t helper_bshuffle(uint64_t gsr, uint64_t src1, uint64_t src2)
>  {
>     union {
>         uint64_t ll[2];
> --
> 1.7.7
>

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

* Re: [Qemu-devel] [PATCH 02/14] target-sparc: Fix mixup of uint64 and uint64_t
  2012-01-21 18:51   ` Blue Swirl
@ 2012-01-22  2:03     ` Andreas Färber
  2012-01-22  8:09       ` Blue Swirl
  0 siblings, 1 reply; 40+ messages in thread
From: Andreas Färber @ 2012-01-22  2:03 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel, Richard Henderson

Am 21.01.2012 19:51, schrieb Blue Swirl:
> On Mon, Jan 16, 2012 at 00:46, Andreas Färber <afaerber@suse.de> wrote:
>> Commit 793a137a41ad4125011c7022cf16a1baa40a5ab6 (target-sparc:
>> Implement BMASK/BSHUFFLE.) introduced a stray usage of softfloat uint64
>> type.
>>
>> Use uint64_t instead.
>>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>> Cc: Richard Henderson <rth@twiddle.net>
>> Cc: Blue Swirl <blauwirbel@gmail.com>
> 
> Good catch,
> Reviewed-by: Blue Swirl <blauwirbel@gmail.com>

Feel free to apply this patch if Richard doesn't comment. The rest of
the series needs some more review and benchmarking.

Is there maybe a way to poison these types outside fpu/ meanwhile?

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

* Re: [Qemu-devel] [PATCH 02/14] target-sparc: Fix mixup of uint64 and uint64_t
  2012-01-22  2:03     ` Andreas Färber
@ 2012-01-22  8:09       ` Blue Swirl
  0 siblings, 0 replies; 40+ messages in thread
From: Blue Swirl @ 2012-01-22  8:09 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel, Richard Henderson

On Sun, Jan 22, 2012 at 02:03, Andreas Färber <afaerber@suse.de> wrote:
> Am 21.01.2012 19:51, schrieb Blue Swirl:
>> On Mon, Jan 16, 2012 at 00:46, Andreas Färber <afaerber@suse.de> wrote:
>>> Commit 793a137a41ad4125011c7022cf16a1baa40a5ab6 (target-sparc:
>>> Implement BMASK/BSHUFFLE.) introduced a stray usage of softfloat uint64
>>> type.
>>>
>>> Use uint64_t instead.
>>>
>>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>>> Cc: Richard Henderson <rth@twiddle.net>
>>> Cc: Blue Swirl <blauwirbel@gmail.com>
>>
>> Good catch,
>> Reviewed-by: Blue Swirl <blauwirbel@gmail.com>
>
> Feel free to apply this patch if Richard doesn't comment. The rest of
> the series needs some more review and benchmarking.
>
> Is there maybe a way to poison these types outside fpu/ meanwhile?

Maybe there could be, but wasn't one part of the problem that OSX uses
the same type names?

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

* Re: [Qemu-devel] [PATCH 02/14] target-sparc: Fix mixup of uint64 and uint64_t
  2012-01-16  0:46 ` [Qemu-devel] [PATCH 02/14] target-sparc: Fix mixup of uint64 and uint64_t Andreas Färber
  2012-01-21 18:51   ` Blue Swirl
@ 2012-01-22 10:02   ` Blue Swirl
  1 sibling, 0 replies; 40+ messages in thread
From: Blue Swirl @ 2012-01-22 10:02 UTC (permalink / raw)
  To: Andreas Färber; +Cc: qemu-devel, Richard Henderson

On Mon, Jan 16, 2012 at 00:46, Andreas Färber <afaerber@suse.de> wrote:
> Commit 793a137a41ad4125011c7022cf16a1baa40a5ab6 (target-sparc:
> Implement BMASK/BSHUFFLE.) introduced a stray usage of softfloat uint64
> type.
>
> Use uint64_t instead.
>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Blue Swirl <blauwirbel@gmail.com>

Thanks, applied.

> ---
>  target-sparc/vis_helper.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/target-sparc/vis_helper.c b/target-sparc/vis_helper.c
> index a992c29..9d2edb0 100644
> --- a/target-sparc/vis_helper.c
> +++ b/target-sparc/vis_helper.c
> @@ -459,7 +459,7 @@ uint32_t helper_fpackfix(uint64_t gsr, uint64_t rs2)
>     return ret;
>  }
>
> -uint64 helper_bshuffle(uint64_t gsr, uint64_t src1, uint64_t src2)
> +uint64_t helper_bshuffle(uint64_t gsr, uint64_t src1, uint64_t src2)
>  {
>     union {
>         uint64_t ll[2];
> --
> 1.7.7
>

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

* Re: [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked
  2012-01-20 13:05 ` Peter Maydell
@ 2012-01-23 17:41   ` Andreas Färber
  0 siblings, 0 replies; 40+ messages in thread
From: Andreas Färber @ 2012-01-23 17:41 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Blue Swirl, malc, qemu-devel, Aurélien Jarno, Alexander Graf

Am 20.01.2012 14:05, schrieb Peter Maydell:
> On 16 January 2012 00:46, Andreas Färber <afaerber@suse.de> wrote:
>> For a loop count of 100,000 and 5 runs I got the following results:
>>
>>  current:        138.9-204.1 Whetstone-MIPS
>>  [u]int*_t:      185.2-188.7 Whetstone-MIPS
>>  [u]int_fast*_t: 285.7-294.1 Whetstone-MIPS
>>
>>  Toshiba AC100:  833.3-909.1 Whetstone-MIPS
>>
>> These results seem to indicate that the "fast" POSIX types are indeed
>> somewhat faster, both compared to exact-size POSIX types and to the
>> current state.
> 
> OTOH I did a run of scimark2 and got:
> current tree:
> **                                                              **
> ** SciMark2 Numeric Benchmark, see http://math.nist.gov/scimark **
> ** for details. (Results can be submitted to pozo@nist.gov)     **
> **                                                              **
> Using       2.00 seconds min time per kenel.
> Composite Score:           12.98
> FFT             Mflops:     7.66    (N=1024)
> SOR             Mflops:    19.49    (100 x 100)
> MonteCarlo:     Mflops:     6.12
> Sparse matmult  Mflops:    15.34    (N=1000, nz=5000)
> LU              Mflops:    16.28    (M=100, N=100)
> 
> with patches (yours and mine):
> **                                                              **
> ** SciMark2 Numeric Benchmark, see http://math.nist.gov/scimark **
> ** for details. (Results can be submitted to pozo@nist.gov)     **
> **                                                              **
> Using       2.00 seconds min time per kenel.
> Composite Score:           11.87
> FFT             Mflops:     7.12    (N=1024)
> SOR             Mflops:    17.66    (100 x 100)
> MonteCarlo:     Mflops:     5.75
> Sparse matmult  Mflops:    14.03    (N=1000, nz=5000)
> LU              Mflops:    14.81    (M=100, N=100)

One difference between our test environments comes to mind: I had tested
only typedefs for the int types, whereas my series also converts flag.
The fixes for lm32, sparc and qemu-tool shouldn't matter here. Your
patches "degrade" some variables from fast types to exact types of course.

Anyway, here's my Whetstone and CoreMark results for
520c0d8d2772ccc9f9275bd934e13ec9b15774e4 (target-sparc: Fix mixup of
uint64 and uint64_t) plus our patches. The margin has shrunk for
Whetstone, and for CoreMark I see a slight degradation of the max.
(I also note a slight Whetstone degradation between Natty and Oneiric.)

Have you tried benchmarking after our preceding patches but before the
actual fast conversion for comparison?

Andreas


master:

C Converted Double Precision Whetstones: 200.0 MIPS
C Converted Double Precision Whetstones: 204.1 MIPS

CoreMark 1.0 : 1287.747086 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 1336.094595 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 1339.943722 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap


master + PMM + fast:

C Converted Double Precision Whetstones: 204.1 MIPS
C Converted Double Precision Whetstones: 208.3 MIPS

CoreMark 1.0 : 1297.690112 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 1299.629606 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 1309.071868 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 1315.270288 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 1318.913216 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 1319.870653 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 1321.527686 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap


AC100 (Ubuntu Oneiric):

C Converted Double Precision Whetstones: 769.2 MIPS
C Converted Double Precision Whetstones: 833.3 MIPS

CoreMark 1.0 : 2257.506208 / GCC4.6.1 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 2303.086135 / GCC4.6.1 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 2326.122354 / GCC4.6.1 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 2349.624060 / GCC4.6.1 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 2350.360389 / GCC4.6.1 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap


Pandaboard (openSUSE Factory):

C Converted Double Precision Whetstones: 833.3 MIPS

CoreMark 1.0 : 2304.855562 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 2305.209774 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 2306.273063 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap
CoreMark 1.0 : 2306.627710 / GCC4.6.2 -O2 -static -DPERFORMANCE_RUN=1
-lrt / Heap


Results are sorted, duplicates removed.

whetstone.c was compiled with -mfloat-abi=hard this time, using GCC
(SUSE Linux) 4.6.2, and so was CoreMark except on the AC100 with GCC
(Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1.

coremark.exe was run with parameters 0x0 0x0 0x66 0.

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

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

end of thread, other threads:[~2012-01-23 17:43 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-16  0:46 [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Andreas Färber
2012-01-16  0:46 ` [Qemu-devel] [PATCH 01/14] lm32: Fix mixup of uint32 and uint32_t Andreas Färber
2012-01-16 11:27   ` Peter Maydell
2012-01-16 12:18     ` Andreas Färber
2012-01-16 21:39     ` Michael Walle
2012-01-17  9:44   ` [Qemu-devel] [PATCH v2] " Andreas Färber
2012-01-19  8:17     ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2012-01-16  0:46 ` [Qemu-devel] [PATCH 02/14] target-sparc: Fix mixup of uint64 and uint64_t Andreas Färber
2012-01-21 18:51   ` Blue Swirl
2012-01-22  2:03     ` Andreas Färber
2012-01-22  8:09       ` Blue Swirl
2012-01-22 10:02   ` Blue Swirl
2012-01-16  0:46 ` [Qemu-devel] [PATCH 03/14] qemu-tool: Fix mixup of int64 and int64_t Andreas Färber
2012-01-16  8:11   ` Stefan Hajnoczi
2012-01-16  0:46 ` [Qemu-devel] [PATCH 04/14] softfloat: Fix mixups of int and int16 Andreas Färber
2012-01-16 17:51   ` Peter Maydell
2012-01-16  0:46 ` [Qemu-devel] [PATCH 05/14] target-mips: Move definition of uint_fast{8, 16}_t to osdep.h Andreas Färber
2012-01-16 11:38   ` Peter Maydell
2012-01-16 12:13     ` Andreas Färber
2012-01-16 12:21       ` Peter Maydell
2012-01-16 12:24         ` Andreas Färber
2012-01-16  0:46 ` [Qemu-devel] [PATCH 06/14] softfloat: Replace uint16 type with uint_fast16_t Andreas Färber
2012-01-16 18:43   ` Peter Maydell
2012-01-16  0:46 ` [Qemu-devel] [PATCH 07/14] softfloat: Replace int16 type with int_fast16_t Andreas Färber
2012-01-16  0:46 ` [Qemu-devel] [PATCH 08/14] softfloat: Remove unused uint8 type Andreas Färber
2012-01-16  0:46 ` [Qemu-devel] [PATCH 09/14] softfloat: Replace int8 type with int_fast8_t Andreas Färber
2012-01-16 18:48   ` Peter Maydell
2012-01-16  0:46 ` [Qemu-devel] [PATCH 10/14] softfloat: Replace uint32 type with uint_fast32_t Andreas Färber
2012-01-16  0:47 ` [Qemu-devel] [PATCH 11/14] softfloat: Replace int32 type with int_fast32_t Andreas Färber
2012-01-16  0:47 ` [Qemu-devel] [PATCH 12/14] softfloat: Replace uint64 type with uint_fast64_t Andreas Färber
2012-01-16  0:47 ` [Qemu-devel] [PATCH 13/14] softfloat: Replace int64 type with int_fast64_t Andreas Färber
2012-01-16  0:47 ` [Qemu-devel] [PATCH 14/14] softfloat: Replace flag type with bool Andreas Färber
2012-01-16 19:02 ` [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked Peter Maydell
2012-01-16 19:12   ` Alexander Graf
2012-01-16 19:17     ` Peter Maydell
2012-01-16 19:18       ` Alexander Graf
2012-01-16 23:52         ` Peter Maydell
2012-01-17  0:05           ` Alexander Graf
2012-01-20 13:05 ` Peter Maydell
2012-01-23 17:41   ` Andreas Färber

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.