[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/21] target/loongarch: Explicitly set 2-NaN propagation rule
From: |
Peter Maydell |
Subject: |
[PATCH 05/21] target/loongarch: Explicitly set 2-NaN propagation rule |
Date: |
Fri, 25 Oct 2024 15:12:38 +0100 |
Set the 2-NaN propagation rule explicitly in the float_status word we
use.
(There are a couple of places in fpu_helper.c where we create a
dummy float_status word with "float_status *s = { };", but these
are only used for calling float*_is_quiet_nan() so it doesn't
matter that we don't set a 2-NaN propagation rule there.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/loongarch/tcg/fpu_helper.c | 1 +
fpu/softfloat-specialize.c.inc | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/target/loongarch/tcg/fpu_helper.c
b/target/loongarch/tcg/fpu_helper.c
index f6753c5875b..21bc3b04a96 100644
--- a/target/loongarch/tcg/fpu_helper.c
+++ b/target/loongarch/tcg/fpu_helper.c
@@ -31,6 +31,7 @@ void restore_fp_status(CPULoongArchState *env)
set_float_rounding_mode(ieee_rm[(env->fcsr0 >> FCSR0_RM) & 0x3],
&env->fp_status);
set_flush_to_zero(0, &env->fp_status);
+ set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->fp_status);
}
int ieee_ex_to_loongarch(int xcpt)
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
index c60b999aa3d..bbc3b70fa9d 100644
--- a/fpu/softfloat-specialize.c.inc
+++ b/fpu/softfloat-specialize.c.inc
@@ -402,10 +402,10 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls,
/* target didn't set the rule: fall back to old ifdef choices */
#if defined(TARGET_AVR) || defined(TARGET_HEXAGON) \
|| defined(TARGET_RISCV) || defined(TARGET_SH4) \
- || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS)
+ || defined(TARGET_TRICORE) || defined(TARGET_ARM) || defined(TARGET_MIPS) \
+ || defined(TARGET_LOONGARCH64)
g_assert_not_reached();
-#elif defined(TARGET_HPPA) || \
- defined(TARGET_LOONGARCH64) || defined(TARGET_S390X)
+#elif defined(TARGET_HPPA) || defined(TARGET_S390X)
rule = float_2nan_prop_s_ab;
#elif defined(TARGET_PPC) || defined(TARGET_M68K)
/*
--
2.34.1
- Re: [PATCH 02/21] tests/fp: Explicitly set 2-NaN propagation rule, (continued)
- [PATCH 01/21] softfloat: Allow 2-operand NaN propagation rule to be set at runtime, Peter Maydell, 2024/10/25
- [PATCH 03/21] target/arm: Explicitly set 2-NaN propagation rule, Peter Maydell, 2024/10/25
- [PATCH 04/21] target/mips: Explicitly set 2-NaN propagation rule, Peter Maydell, 2024/10/25
- [PATCH 06/21] target/hppa: Explicitly set 2-NaN propagation rule, Peter Maydell, 2024/10/25
- [PATCH 05/21] target/loongarch: Explicitly set 2-NaN propagation rule,
Peter Maydell <=
- [PATCH 08/21] target/ppc: Explicitly set 2-NaN propagation rule, Peter Maydell, 2024/10/25
- [PATCH 09/21] target/m68k: Explicitly set 2-NaN propagation rule, Peter Maydell, 2024/10/25
- [PATCH 10/21] target/m68k: Initialize float_status fields in gdb set/get functions, Peter Maydell, 2024/10/25