[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 22/45] fpu: Add float16 comparison functions
From: |
Peter Maydell |
Subject: |
[PATCH v2 22/45] fpu: Add float16 comparison functions |
Date: |
Fri, 28 Aug 2020 19:33:31 +0100 |
Add comparison functions for float16 to match the existing float32
and float64 ones:
float16_eq()
float16_le()
float16_lt()
float16_unordered()
float16_eq_quiet()
float16_le_quiet()
float16_lt_quiet()
float16_unordered_quiet()
These are all just convenience wrappers around float16_compare() and
float16_compare_quiet(). We will want these for AArch23 fp16
support.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/fpu/softfloat.h | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h
index 659218b5c78..573fce99bc6 100644
--- a/include/fpu/softfloat.h
+++ b/include/fpu/softfloat.h
@@ -285,6 +285,47 @@ static inline float16 float16_set_sign(float16 a, int sign)
return make_float16((float16_val(a) & 0x7fff) | (sign << 15));
}
+static inline bool float16_eq(float16 a, float16 b, float_status *s)
+{
+ return float16_compare(a, b, s) == float_relation_equal;
+}
+
+static inline bool float16_le(float16 a, float16 b, float_status *s)
+{
+ return float16_compare(a, b, s) <= float_relation_equal;
+}
+
+static inline bool float16_lt(float16 a, float16 b, float_status *s)
+{
+ return float16_compare(a, b, s) < float_relation_equal;
+}
+
+static inline bool float16_unordered(float16 a, float16 b, float_status *s)
+{
+ return float16_compare(a, b, s) == float_relation_unordered;
+}
+
+static inline bool float16_eq_quiet(float16 a, float16 b, float_status *s)
+{
+ return float16_compare_quiet(a, b, s) == float_relation_equal;
+}
+
+static inline bool float16_le_quiet(float16 a, float16 b, float_status *s)
+{
+ return float16_compare_quiet(a, b, s) <= float_relation_equal;
+}
+
+static inline bool float16_lt_quiet(float16 a, float16 b, float_status *s)
+{
+ return float16_compare_quiet(a, b, s) < float_relation_equal;
+}
+
+static inline bool float16_unordered_quiet(float16 a, float16 b,
+ float_status *s)
+{
+ return float16_compare_quiet(a, b, s) == float_relation_unordered;
+}
+
#define float16_zero make_float16(0)
#define float16_half make_float16(0x3800)
#define float16_one make_float16(0x3c00)
--
2.20.1
- [PATCH v2 12/45] target/arm: Implement VFP fp16 VCVT between float and integer, (continued)
- [PATCH v2 12/45] target/arm: Implement VFP fp16 VCVT between float and integer, Peter Maydell, 2020/08/28
- [PATCH v2 13/45] target/arm: Make VFP_CONV_FIX macros take separate float type and float size, Peter Maydell, 2020/08/28
- [PATCH v2 11/45] target/arm: Implement VFP fp16 VLDR and VSTR, Peter Maydell, 2020/08/28
- [PATCH v2 14/45] target/arm: Use macros instead of open-coding fp16 conversion helpers, Peter Maydell, 2020/08/28
- [PATCH v2 15/45] target/arm: Implement VFP fp16 VCVT between float and fixed-point, Peter Maydell, 2020/08/28
- [PATCH v2 16/45] target/arm: Implement VFP vp16 VCVT-with-specified-rounding-mode, Peter Maydell, 2020/08/28
- [PATCH v2 18/45] target/arm: Implement VFP fp16 VRINT*, Peter Maydell, 2020/08/28
- [PATCH v2 21/45] target/arm: Implement VFP fp16 VMOV between gp and halfprec registers, Peter Maydell, 2020/08/28
- [PATCH v2 17/45] target/arm: Implement VFP fp16 VSEL, Peter Maydell, 2020/08/28
- [PATCH v2 19/45] target/arm: Implement new VFP fp16 insn VINS, Peter Maydell, 2020/08/28
- [PATCH v2 22/45] fpu: Add float16 comparison functions,
Peter Maydell <=
- [PATCH v2 24/45] target/arm: Implement fp16 for Neon VRECPE, VRSQRTE using gvec, Peter Maydell, 2020/08/28
- Re: [PATCH v2 24/45] target/arm: Implement fp16 for Neon VRECPE, VRSQRTE using gvec, Richard Henderson, 2020/08/28
- Re: [PATCH v2 24/45] target/arm: Implement fp16 for Neon VRECPE, VRSQRTE using gvec, Peter Maydell, 2020/08/28
- Re: [PATCH v2 24/45] target/arm: Implement fp16 for Neon VRECPE, VRSQRTE using gvec, Richard Henderson, 2020/08/28
- Re: [PATCH v2 24/45] target/arm: Implement fp16 for Neon VRECPE, VRSQRTE using gvec, Peter Maydell, 2020/08/29
- Re: [PATCH v2 24/45] target/arm: Implement fp16 for Neon VRECPE, VRSQRTE using gvec, Richard Henderson, 2020/08/29
[PATCH v2 26/45] target/arm: Implement fp16 for VCEQ, VCGE, VCGT comparisons, Peter Maydell, 2020/08/28
[PATCH v2 25/45] target/arm: Implement fp16 for Neon VABS, VNEG of floats, Peter Maydell, 2020/08/28