[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 46/72] target/arm: Set default NaN pattern explicitly
From: |
Peter Maydell |
Subject: |
[PULL 46/72] target/arm: Set default NaN pattern explicitly |
Date: |
Wed, 11 Dec 2024 16:19:38 +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>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20241202131347.498124-41-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
- [PULL 36/72] target/m68k: Init local float_status from env fp_status in gdb get/set reg, (continued)
- [PULL 36/72] target/m68k: Init local float_status from env fp_status in gdb get/set reg, Peter Maydell, 2024/12/11
- [PULL 37/72] target/sparc: Initialize local scratch float_status from env->fp_status, Peter Maydell, 2024/12/11
- [PULL 38/72] target/ppc: Use env->fp_status in helper_compute_fprf functions, Peter Maydell, 2024/12/11
- [PULL 39/72] target/arm: Copy entire float_status in is_ebf, Peter Maydell, 2024/12/11
- [PULL 40/72] fpu: Allow runtime choice of default NaN value, Peter Maydell, 2024/12/11
- [PULL 41/72] tests/fp: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 43/72] target/i386: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 42/72] target/microblaze: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 44/72] target/hppa: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 45/72] target/alpha: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 46/72] target/arm: Set default NaN pattern explicitly,
Peter Maydell <=
- [PULL 47/72] target/loongarch: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 48/72] target/m68k: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 50/72] target/openrisc: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 49/72] target/mips: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 51/72] target/ppc: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 52/72] target/sh4: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 60/72] fpu: Remove default handling for dnan_pattern, Peter Maydell, 2024/12/11
- [PULL 61/72] softfloat: Inline pickNaNMulAdd, Peter Maydell, 2024/12/11
- [PULL 55/72] target/sparc: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 54/72] target/s390x: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11