[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmar
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked |
Date: |
Mon, 16 Jan 2012 01:46:49 +0100 |
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 <address@hidden>
Cc: Peter Maydell <address@hidden>
Cc: Aurélien Jarno <address@hidden>
Cc: malc <address@hidden>
Cc: Ben Taylor <address@hidden>
Cc: Rui Carmo <address@hidden>
Cc: Eric Sunshine <address@hidden>
Cc: Pavel Borzenkov <address@hidden>
Cc: Juan Pineda <address@hidden>
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
- [Qemu-devel] [PATCH 00/14] softfloat: Use POSIX integer types - benchmarked,
Andreas Färber <=