diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-03-13 19:19:16 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-03-13 19:19:16 +0000 |
commit | 0ca9d3807c8c429f7b21ffcac7f7acdd4d9659b0 (patch) | |
tree | c02e1af408f30d5564f048239336c75d62a67997 /target-ppc/op_helper.h | |
parent | 6b59fc74b5b811664e4621e65b64e39c501249be (diff) | |
download | qemu-0ca9d3807c8c429f7b21ffcac7f7acdd4d9659b0.zip qemu-0ca9d3807c8c429f7b21ffcac7f7acdd4d9659b0.tar.gz qemu-0ca9d3807c8c429f7b21ffcac7f7acdd4d9659b0.tar.bz2 |
Use float32/64 instead of float/double
The patch below uses the float32 and float64 types instead of the float
and double types in the PPC code. This doesn't change anything when
using softfloat-native as the types are the same, but that helps
compiling the PPC target with softfloat.
It also defines a new union CPU_FloatU in addition to CPU_DoubleU, and
use them instead of identical unions that are defined in numerous
places.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4047 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc/op_helper.h')
-rw-r--r-- | target-ppc/op_helper.h | 104 |
1 files changed, 37 insertions, 67 deletions
diff --git a/target-ppc/op_helper.h b/target-ppc/op_helper.h index 5ec13a4..1d5fc0a 100644 --- a/target-ppc/op_helper.h +++ b/target-ppc/op_helper.h @@ -296,108 +296,78 @@ static always_inline uint32_t _do_efsneg (uint32_t val) } static always_inline uint32_t _do_efsadd (uint32_t op1, uint32_t op2) { - union { - uint32_t u; - float32 f; - } u1, u2; - u1.u = op1; - u2.u = op2; + CPU_FloatU u1, u2; + u1.l = op1; + u2.l = op2; u1.f = float32_add(u1.f, u2.f, &env->spe_status); - return u1.u; + return u1.l; } static always_inline uint32_t _do_efssub (uint32_t op1, uint32_t op2) { - union { - uint32_t u; - float32 f; - } u1, u2; - u1.u = op1; - u2.u = op2; + CPU_FloatU u1, u2; + u1.l = op1; + u2.l = op2; u1.f = float32_sub(u1.f, u2.f, &env->spe_status); - return u1.u; + return u1.l; } static always_inline uint32_t _do_efsmul (uint32_t op1, uint32_t op2) { - union { - uint32_t u; - float32 f; - } u1, u2; - u1.u = op1; - u2.u = op2; + CPU_FloatU u1, u2; + u1.l = op1; + u2.l = op2; u1.f = float32_mul(u1.f, u2.f, &env->spe_status); - return u1.u; + return u1.l; } static always_inline uint32_t _do_efsdiv (uint32_t op1, uint32_t op2) { - union { - uint32_t u; - float32 f; - } u1, u2; - u1.u = op1; - u2.u = op2; + CPU_FloatU u1, u2; + u1.l = op1; + u2.l = op2; u1.f = float32_div(u1.f, u2.f, &env->spe_status); - return u1.u; + return u1.l; } static always_inline int _do_efststlt (uint32_t op1, uint32_t op2) { - union { - uint32_t u; - float32 f; - } u1, u2; - u1.u = op1; - u2.u = op2; + CPU_FloatU u1, u2; + u1.l = op1; + u2.l = op2; return float32_lt(u1.f, u2.f, &env->spe_status) ? 1 : 0; } static always_inline int _do_efststgt (uint32_t op1, uint32_t op2) { - union { - uint32_t u; - float32 f; - } u1, u2; - u1.u = op1; - u2.u = op2; + CPU_FloatU u1, u2; + u1.l = op1; + u2.l = op2; return float32_le(u1.f, u2.f, &env->spe_status) ? 0 : 1; } static always_inline int _do_efststeq (uint32_t op1, uint32_t op2) { - union { - uint32_t u; - float32 f; - } u1, u2; - u1.u = op1; - u2.u = op2; + CPU_FloatU u1, u2; + u1.l = op1; + u2.l = op2; return float32_eq(u1.f, u2.f, &env->spe_status) ? 1 : 0; } /* Double precision floating-point helpers */ static always_inline int _do_efdtstlt (uint64_t op1, uint64_t op2) { - union { - uint64_t u; - float64 f; - } u1, u2; - u1.u = op1; - u2.u = op2; - return float64_lt(u1.f, u2.f, &env->spe_status) ? 1 : 0; + CPU_DoubleU u1, u2; + u1.ll = op1; + u2.ll = op2; + return float64_lt(u1.d, u2.d, &env->spe_status) ? 1 : 0; } static always_inline int _do_efdtstgt (uint64_t op1, uint64_t op2) { - union { - uint64_t u; - float64 f; - } u1, u2; - u1.u = op1; - u2.u = op2; - return float64_le(u1.f, u2.f, &env->spe_status) ? 0 : 1; + CPU_DoubleU u1, u2; + u1.ll = op1; + u2.ll = op2; + return float64_le(u1.d, u2.d, &env->spe_status) ? 0 : 1; } static always_inline int _do_efdtsteq (uint64_t op1, uint64_t op2) { - union { - uint64_t u; - float64 f; - } u1, u2; - u1.u = op1; - u2.u = op2; - return float64_eq(u1.f, u2.f, &env->spe_status) ? 1 : 0; + CPU_DoubleU u1, u2; + u1.ll = op1; + u2.ll = op2; + return float64_eq(u1.d, u2.d, &env->spe_status) ? 1 : 0; } #endif |