diff options
author | Peter Maydell | 2019-02-28 12:13:32 +0100 |
---|---|---|
committer | Peter Maydell | 2019-02-28 12:13:32 +0100 |
commit | 4f9ca54d1272dd5750345d8802e567d519d1c4c6 (patch) | |
tree | 72e0b065177b6835ef7aab471a11fa51b6f0fef8 /include | |
parent | Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-4.0-20190226' into... (diff) | |
parent | tests/Makefile.include: test all rounding modes of softfloat (diff) | |
download | qemu-4f9ca54d1272dd5750345d8802e567d519d1c4c6.tar.gz qemu-4f9ca54d1272dd5750345d8802e567d519d1c4c6.tar.xz qemu-4f9ca54d1272dd5750345d8802e567d519d1c4c6.zip |
Merge remote-tracking branch 'remotes/stsquad/tags/pull-fpu-next-260219-1' into staging
Softloat updates, mostly in preparation for s390x usage
# gpg: Signature made Tue 26 Feb 2019 14:09:34 GMT
# gpg: using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44
* remotes/stsquad/tags/pull-fpu-next-260219-1:
tests/Makefile.include: test all rounding modes of softfloat
softfloat: Support float_round_to_odd more places
tests/fp: enable f128_to_ui[32/64] tests in float-to-uint
tests/fp: add wrapping for f128_to_ui32
softfloat: Implement float128_to_uint32
softfloat: add float128_is_{normal,denormal}
tests: Ignore fp test outputs
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/fpu/softfloat.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 38a5e99cf3..3ff3fa5224 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -466,7 +466,7 @@ static inline int float32_is_zero_or_denormal(float32 a) static inline bool float32_is_normal(float32 a) { - return ((float32_val(a) + 0x00800000) & 0x7fffffff) >= 0x01000000; + return (((float32_val(a) >> 23) + 1) & 0xff) >= 2; } static inline bool float32_is_denormal(float32 a) @@ -622,7 +622,7 @@ static inline int float64_is_zero_or_denormal(float64 a) static inline bool float64_is_normal(float64 a) { - return ((float64_val(a) + (1ULL << 52)) & -1ULL >> 1) >= 1ULL << 53; + return (((float64_val(a) >> 52) + 1) & 0x7ff) >= 2; } static inline bool float64_is_denormal(float64 a) @@ -878,6 +878,7 @@ int64_t float128_to_int64(float128, float_status *status); int64_t float128_to_int64_round_to_zero(float128, float_status *status); uint64_t float128_to_uint64(float128, float_status *status); uint64_t float128_to_uint64_round_to_zero(float128, float_status *status); +uint32_t float128_to_uint32(float128, float_status *status); uint32_t float128_to_uint32_round_to_zero(float128, float_status *status); float32 float128_to_float32(float128, float_status *status); float64 float128_to_float64(float128, float_status *status); @@ -940,6 +941,16 @@ static inline int float128_is_zero_or_denormal(float128 a) return (a.high & 0x7fff000000000000LL) == 0; } +static inline bool float128_is_normal(float128 a) +{ + return (((a.high >> 48) + 1) & 0x7fff) >= 2; +} + +static inline bool float128_is_denormal(float128 a) +{ + return float128_is_zero_or_denormal(a) && !float128_is_zero(a); +} + static inline int float128_is_any_nan(float128 a) { return ((a.high >> 48) & 0x7fff) == 0x7fff && |