aboutsummaryrefslogtreecommitdiff
path: root/target/openrisc/fpu_helper.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-05-14 06:39:47 -0700
committerRichard Henderson <richard.henderson@linaro.org>2019-09-04 12:57:59 -0700
commit2b13b4b93dc924a139d7a9350cd13c2c9479d03b (patch)
tree0357a79edcf4b806d70dac9c560ae3f322763396 /target/openrisc/fpu_helper.c
parent62f2b0389ff6fc7856b801bb5bee1c2d364d3e6c (diff)
target/openrisc: Implement unordered fp comparisons
These were added to the 1.3 spec. For OF32S, validate AVR. But OF64A32 is itself new to 1.3 so no extra check needed. Reviewed-by: Stafford Horne <shorne@gmail.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/openrisc/fpu_helper.c')
-rw-r--r--target/openrisc/fpu_helper.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/target/openrisc/fpu_helper.c b/target/openrisc/fpu_helper.c
index 9d7dfc0fb9..7bcef9dc53 100644
--- a/target/openrisc/fpu_helper.c
+++ b/target/openrisc/fpu_helper.c
@@ -135,4 +135,24 @@ target_ulong helper_float_ ## name ## _s(CPUOpenRISCState *env, \
FLOAT_CMP(le, le)
FLOAT_CMP(lt, lt)
FLOAT_CMP(eq, eq_quiet)
+FLOAT_CMP(un, unordered_quiet)
#undef FLOAT_CMP
+
+#define FLOAT_UCMP(name, expr) \
+target_ulong helper_float_ ## name ## _d(CPUOpenRISCState *env, \
+ uint64_t fdt0, uint64_t fdt1) \
+{ \
+ int r = float64_compare_quiet(fdt0, fdt1, &env->fp_status); \
+ return expr; \
+} \
+target_ulong helper_float_ ## name ## _s(CPUOpenRISCState *env, \
+ uint32_t fdt0, uint32_t fdt1) \
+{ \
+ int r = float32_compare_quiet(fdt0, fdt1, &env->fp_status); \
+ return expr; \
+}
+
+FLOAT_UCMP(ueq, r == float_relation_equal || r == float_relation_unordered)
+FLOAT_UCMP(ult, r == float_relation_less || r == float_relation_unordered)
+FLOAT_UCMP(ule, r != float_relation_greater)
+#undef FLOAT_UCMP