cpu-all.h: Remove unnecessary target-specific ifdef for CPU_QuadU
PATCH 1/1 cpu-all.h: Remove unnecessary target-specific ifdef for CPU_QuadU
CPU_QuadU isn't used on all targets, but there's no harm in defining the typedef anyway. It only needs to be guarded by CONFIG_SOFTFLOAT, because softfloat-native doesn't have a float128 type. This avoids the need for every new target which uses CPU_QuadU to add itself to an #ifdef in what ought to be target-agnostic code.
---
Noticed this one as a result of the s390 support patches; seems like a minor but worthwhile cleanup to me...
cpu-all.h | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
cpu-all.h +2 -3
@@ -138,11 +138,10 @@ typedef union {uint64_t ll; } CPU_DoubleU; -#if defined(TARGET_SPARC) || defined(TARGET_S390X) +#if defined(CONFIG_SOFTFLOAT) typedef union { float128 q; -#if defined(HOST_WORDS_BIGENDIAN) \ - || (defined(__arm__) && !defined(__VFP_FP__) && !defined(CONFIG_SOFTFLOAT)) +#if defined(HOST_WORDS_BIGENDIAN) struct { uint32_t upmost; uint32_t upper;
Signature · 1 line
1.7.1
Quoted 7 lines · Peter Maydell
CPU_QuadUisn't used on all targets, but there's no harm in defining the typedef anyway. It only needs to be guarded byCONFIG_SOFTFLOAT, because softfloat-native doesn't have a float128 type. This avoids the need for every new target which usesCPU_QuadUto add itself to an #ifdef in what ought to be target-agnostic code.Signed-off-by Peter Maydell<[email protected]>
I don't really know my way around FP, but from here it looks good :). Not sure about the arm part, but I trust Peter on that one ;).
Alex
Quoted 8 lines · Alexander Graf
Quoted 7 lines · Peter Maydell
CPU_QuadUisn't used on all targets, but there's no harm in defining the typedef anyway. It only needs to be guarded byCONFIG_SOFTFLOAT, because softfloat-native doesn't have a float128 type. This avoids the need for every new target which usesCPU_QuadUto add itself to an #ifdef in what ought to be target-agnostic code.
Quoted 4 lines
Quoted 1 line
Signed-off-by Peter Maydell<[email protected]>I don't really know my way around FP, but from here it looks good :). Not sure about the arm part, but I trust Peter on that one ;).
The __arm__ part of the ifdef was a voodoo-copy from the CPU_DoubleU typedef, where it actually does matter if you're building a softfloat-native target on an ARM host which uses the ancient FPA floating point ABI (as the comment says, although ARM is generally little-endian doubles are stored in memory in big-endian order under FPA; the more modern VFP has them little-endian). This ifdef condition was meaningless for CPU_QuadU (because FPA didn't have a 128 bit native float type for the type to try to be compatible with) and could never have kicked in anyhow because we wouldn't have compiled unless CONFIG_SOFTFLOAT was defined.
-- PMM
Aurelien Jarno
AppliedQuoted 6 lines · Peter Maydell
CPU_QuadUisn't used on all targets, but there's no harm in defining the typedef anyway. It only needs to be guarded byCONFIG_SOFTFLOAT, because softfloat-native doesn't have a float128 type. This avoids the need for every new target which usesCPU_QuadUto add itself to an #ifdef in what ought to be target-agnostic code.
Quoted 7 lines
Signed-off-by Peter Maydell <[email protected]>---
Noticed this one as a result of the s390 support patches; seems like a minor but worthwhile cleanup to me...cpu-all.h | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
Thanks, applied.
Quoted 23 lines
cpu-all.h +2
-3@@ -138,11 +138,10 @@ typedef union {uint64_t ll; } CPU_DoubleU; -#if defined(TARGET_SPARC) || defined(TARGET_S390X) +#if defined(CONFIG_SOFTFLOAT) typedef union { float128 q; -#if defined(HOST_WORDS_BIGENDIAN) \ - || (defined(__arm__) && !defined(__VFP_FP__) && !defined(CONFIG_SOFTFLOAT)) +#if defined(HOST_WORDS_BIGENDIAN) struct { uint32_t upmost; uint32_t upper;Signature · 1 line
1.7.1
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Quoted 10 lines · Peter Maydell
CPU_QuadUisn't used on all targets, but there's no harm in defining the typedef anyway. It only needs to be guarded byCONFIG_SOFTFLOAT, because softfloat-native doesn't have a float128 type. This avoids the need for every new target which usesCPU_QuadUto add itself to an #ifdef in what ought to be target-agnostic code.Signed-off-by Peter Maydell <[email protected]>---
Noticed this one as a result of the s390 support patches; seems like a minor but worthwhile cleanup to me...
Sorry for the late comment, but I saw this rebasing my patchset on master...
cpu-all.h typedef union { · line 141
Quoted 13 lines
cpu-all.h | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)cpu-all.h +1
-1@@ -138,11 +138,10 @@ typedef union {uint64_t ll; } CPU_DoubleU; -#if defined(TARGET_SPARC ) || defined(TARGET_S390X ) +#if defined(CONFIG_SOFTFLOAT )
Why don't you use "#if defined(FLOAT128)" ?
Quoted 8 lines
cpu-all.h +1
-2typedef union { float128 q; -#if defined(HOST_WORDS_BIGENDIAN) \ - || (defined(__arm__) && !defined(__VFP_FP__) && !defined(CONFIG_SOFTFLOAT)) +#if defined(HOST_WORDS_BIGENDIAN) struct { uint32_t upmost; uint32_t upper;
Signature · 3 lines
--------------------- [email protected] ---------------------- "Tout ce qui est impossible reste à accomplir" Jules Verne "Things are only impossible until they're not" Jean-Luc Picard
Quoted 5 lines · Laurent Vivier
cpu-all.h typedef union { · line 141
Quoted 2 lines · Peter Maydell
cpu-all.h +1
-1-#if defined(TARGET_SPARC ) || defined(TARGET_S390X ) +#if defined(CONFIG_SOFTFLOAT )Why don't you use "#if defined(FLOAT128)" ?
I did consider that, but I felt FLOAT128 was a softfloat-internal macro rather than part of the API softfloat provides to the rest of qemu.
-- PMM
Quoted 10 lines · Peter Maydell
Quoted 5 lines · Laurent Vivier
cpu-all.h typedef union { · line 141
Quoted 2 lines · Peter Maydell
cpu-all.h +1
-1-#if defined(TARGET_SPARC ) || defined(TARGET_S390X ) +#if defined(CONFIG_SOFTFLOAT )Why don't you use "#if defined(FLOAT128)" ?
I did consider that, but I felt FLOAT128 was a softfloat-internal macro rather than part of the API softfloat provides to the rest of qemu.
But, for instance, "#ifdef FLOATX80" is used in target-i386/cpu.h and target-i386/op_helper.c.
Regards,
Laurent
Signature · 3 lines
--------------------- [email protected] ---------------------- "Tout ce qui est impossible reste à accomplir" Jules Verne "Things are only impossible until they're not" Jean-Luc Picard
Quoted 8 lines · Laurent Vivier
Quoted 7 lines · Peter Maydell
Quoted 5 lines · Laurent Vivier
cpu-all.h typedef union { · line 141
Quoted 2 lines · Peter Maydell
cpu-all.h +1
-1-#if defined(TARGET_SPARC ) || defined(TARGET_S390X ) +#if defined(CONFIG_SOFTFLOAT )Why don't you use "#if defined(FLOAT128)" ?
Quoted 6 lines
Quoted 3 lines
I did consider that, but I felt FLOAT128 was a softfloat-internal macro rather than part of the API softfloat provides to the rest of qemu.
But, for instance, "#ifdef FLOATX80" is used in
target-i386/cpu.handtarget-i386/op_helper.c.
Those uses seem conceptually wrong to me: either a target needs 80 bit floats, or it doesn't. It shouldn't behave differently depending on what host it was compiled on. However this is really just legacy of the fact that target-i386 is still compiled with softfloat-native rather than proper softfloat.
Personally I would also delete the FLOAT128 ifdefs in target-ppc since we always compile with softfloat now.
However I don't feel very strongly about any of this; mostly I just wanted to get rid of the target and host specific ifdeffery.
-- PMM