aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-12-17 23:46:05 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-12-17 23:46:05 +0000
commitec3c927f3d983b277d00fb88e26785c94e545af3 (patch)
tree9738089fba562c9c1d2a7b6ee622d8905b7a8c14 /include
parentf163448536e5f7ae8905b14547eab37a41a75f6c (diff)
parentd9fe9db943d4e855a75424978d7ab87fd54edd98 (diff)
Merge remote-tracking branch 'remotes/stsquad/tags/pull-hardfloat-and-gitdm-171218-3' into staging
Hardfloat + maintainers and gitdm # gpg: Signature made Mon 17 Dec 2018 10:55:19 GMT # gpg: using RSA key FBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-hardfloat-and-gitdm-171218-3: hardfloat: implement float32/64 comparison hardfloat: implement float32/64 square root hardfloat: implement float32/64 fused multiply-add hardfloat: implement float32/64 division hardfloat: implement float32/64 multiplication hardfloat: implement float32/64 addition and subtraction fpu: introduce hardfloat tests/fp: add fp-bench softfloat: add float{32,64}_is_zero_or_normal softfloat: rename canonicalize to sf_canonicalize target/tricore: use float32_is_denormal softfloat: add float{32,64}_is_{de,}normal fp-test: pick TARGET_ARM to get its specialization MAINTAINERS: update status of FPU emulation contrib: add a basic gitdm config Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/fpu/softfloat.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
index 8fd9f9bbae..38a5e99cf3 100644
--- a/include/fpu/softfloat.h
+++ b/include/fpu/softfloat.h
@@ -464,6 +464,21 @@ static inline int float32_is_zero_or_denormal(float32 a)
return (float32_val(a) & 0x7f800000) == 0;
}
+static inline bool float32_is_normal(float32 a)
+{
+ return ((float32_val(a) + 0x00800000) & 0x7fffffff) >= 0x01000000;
+}
+
+static inline bool float32_is_denormal(float32 a)
+{
+ return float32_is_zero_or_denormal(a) && !float32_is_zero(a);
+}
+
+static inline bool float32_is_zero_or_normal(float32 a)
+{
+ return float32_is_normal(a) || float32_is_zero(a);
+}
+
static inline float32 float32_set_sign(float32 a, int sign)
{
return make_float32((float32_val(a) & 0x7fffffff) | (sign << 31));
@@ -605,6 +620,21 @@ static inline int float64_is_zero_or_denormal(float64 a)
return (float64_val(a) & 0x7ff0000000000000LL) == 0;
}
+static inline bool float64_is_normal(float64 a)
+{
+ return ((float64_val(a) + (1ULL << 52)) & -1ULL >> 1) >= 1ULL << 53;
+}
+
+static inline bool float64_is_denormal(float64 a)
+{
+ return float64_is_zero_or_denormal(a) && !float64_is_zero(a);
+}
+
+static inline bool float64_is_zero_or_normal(float64 a)
+{
+ return float64_is_normal(a) || float64_is_zero(a);
+}
+
static inline float64 float64_set_sign(float64 a, int sign)
{
return make_float64((float64_val(a) & 0x7fffffffffffffffULL)