[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 for-10.0 40/54] target/arm: Set default NaN pattern explicitly
From: |
Peter Maydell |
Subject: |
[PATCH v2 for-10.0 40/54] target/arm: Set default NaN pattern explicitly |
Date: |
Mon, 2 Dec 2024 13:13:33 +0000 |
Set the default NaN pattern explicitly for the arm target.
This includes setting it for the old linux-user nwfpe emulation.
For nwfpe, our default doesn't match the real kernel, but we
avoid making a behaviour change in this commit.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
linux-user/arm/nwfpe/fpa11.c | 5 +++++
target/arm/cpu.c | 2 ++
2 files changed, 7 insertions(+)
diff --git a/linux-user/arm/nwfpe/fpa11.c b/linux-user/arm/nwfpe/fpa11.c
index 8356beb52c6..0f1afbd91df 100644
--- a/linux-user/arm/nwfpe/fpa11.c
+++ b/linux-user/arm/nwfpe/fpa11.c
@@ -69,6 +69,11 @@ void resetFPA11(void)
* this late date.
*/
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &fpa11->fp_status);
+ /*
+ * Use the same default NaN value as Arm VFP. This doesn't match
+ * the Linux kernel's nwfpe emulation, which uses an all-1s value.
+ */
+ set_float_default_nan_pattern(0b01000000, &fpa11->fp_status);
}
void SetRoundingMode(const unsigned int opcode)
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index c81f6df3fca..4f7e18eb8e6 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -179,6 +179,7 @@ void arm_register_el_change_hook(ARMCPU *cpu,
ARMELChangeHookFn *hook,
* the pseudocode function the arguments are in the order c, a, b.
* * 0 * Inf + NaN returns the default NaN if the input NaN is quiet,
* and the input NaN if it is signalling
+ * * Default NaN has sign bit clear, msb frac bit set
*/
static void arm_set_default_fp_behaviours(float_status *s)
{
@@ -186,6 +187,7 @@ static void arm_set_default_fp_behaviours(float_status *s)
set_float_2nan_prop_rule(float_2nan_prop_s_ab, s);
set_float_3nan_prop_rule(float_3nan_prop_s_cab, s);
set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, s);
+ set_float_default_nan_pattern(0b01000000, s);
}
static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque)
--
2.34.1
- [PATCH v2 for-10.0 15/54] softfloat: Allow runtime choice of NaN propagation for muladd, (continued)
- [PATCH v2 for-10.0 15/54] softfloat: Allow runtime choice of NaN propagation for muladd, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 10/54] target/xtensa: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 17/54] target/arm: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 08/54] target/mips: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 23/54] target/xtensa: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 35/54] tests/fp: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 29/54] target/loongarch: Use normal float_status in fclass_s and fclass_d helpers, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 44/54] target/openrisc: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 32/54] target/sparc: Initialize local scratch float_status from env->fp_status, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 46/54] target/sh4: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 40/54] target/arm: Set default NaN pattern explicitly,
Peter Maydell <=
- [PATCH v2 for-10.0 25/54] target/hppa: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 26/54] fpu: Remove use_first_nan field from float_status, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 27/54] target/m68k: Don't pass NULL float_status to floatx80_default_nan(), Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 30/54] target/m68k: In frem helper, initialize local float_status from env->fp_status, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 50/54] target/xtensa: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 45/54] target/ppc: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 37/54] target/i386: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 47/54] target/rx: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 52/54] target/riscv: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 22/54] target/mips: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/02