[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 for-10.0 43/54] target/mips: Set default NaN pattern explicitl
From: |
Peter Maydell |
Subject: |
[PATCH v2 for-10.0 43/54] target/mips: Set default NaN pattern explicitly |
Date: |
Mon, 2 Dec 2024 13:13:36 +0000 |
Set the default NaN pattern explicitly for MIPS. Note that this
is our only target which currently changes the default NaN
at runtime (which it was previously doing indirectly when it
changed the snan_bit_is_one setting).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/mips/fpu_helper.h | 7 +++++++
target/mips/msa.c | 3 +++
2 files changed, 10 insertions(+)
diff --git a/target/mips/fpu_helper.h b/target/mips/fpu_helper.h
index 8ca0ca7ea39..6ad1e466cfd 100644
--- a/target/mips/fpu_helper.h
+++ b/target/mips/fpu_helper.h
@@ -47,6 +47,13 @@ static inline void restore_snan_bit_mode(CPUMIPSState *env)
set_float_infzeronan_rule(izn_rule, &env->active_fpu.fp_status);
nan3_rule = nan2008 ? float_3nan_prop_s_cab : float_3nan_prop_s_abc;
set_float_3nan_prop_rule(nan3_rule, &env->active_fpu.fp_status);
+ /*
+ * With nan2008, the default NaN value has the sign bit clear and the
+ * frac msb set; with the older mode, the sign bit is clear, and all
+ * frac bits except the msb are set.
+ */
+ set_float_default_nan_pattern(nan2008 ? 0b01000000 : 0b00111111,
+ &env->active_fpu.fp_status);
}
diff --git a/target/mips/msa.c b/target/mips/msa.c
index 93a9a87d76d..fc77bfc7b9a 100644
--- a/target/mips/msa.c
+++ b/target/mips/msa.c
@@ -81,4 +81,7 @@ void msa_reset(CPUMIPSState *env)
/* Inf * 0 + NaN returns the input NaN */
set_float_infzeronan_rule(float_infzeronan_dnan_never,
&env->active_tc.msa_fp_status);
+ /* Default NaN: sign bit clear, frac msb set */
+ set_float_default_nan_pattern(0b01000000,
+ &env->active_tc.msa_fp_status);
}
--
2.34.1
- [PATCH v2 for-10.0 22/54] target/mips: Set Float3NaNPropRule explicitly, (continued)
- [PATCH v2 for-10.0 22/54] target/mips: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 41/54] target/loongarch: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 49/54] target/sparc: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 33/54] target/ppc: Use env->fp_status in helper_compute_fprf functions, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 34/54] fpu: Allow runtime choice of default NaN value, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 11/54] target/x86: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 36/54] target/microblaze: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 38/54] target/hppa: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 28/54] softfloat: Create floatx80 default NaN from parts64_default_nan, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 19/54] target/ppc: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 43/54] target/mips: Set default NaN pattern explicitly,
Peter Maydell <=
- [PATCH v2 for-10.0 13/54] target/hppa: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 16/54] tests/fp: Explicitly set 3-NaN propagation rule, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 48/54] target/s390x: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 07/54] target/ppc: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 31/54] target/m68k: Init local float_status from env fp_status in gdb get/set reg, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 39/54] target/alpha: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 18/54] target/loongarch: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 53/54] target/tricore: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 21/54] target/sparc: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 12/54] target/loongarch: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/12/02