[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 32/72] target/m68k: Don't pass NULL float_status to floatx80_defau
From: |
Peter Maydell |
Subject: |
[PULL 32/72] target/m68k: Don't pass NULL float_status to floatx80_default_nan() |
Date: |
Wed, 11 Dec 2024 16:19:24 +0000 |
Currently m68k_cpu_reset_hold() calls floatx80_default_nan(NULL)
to get the NaN bit pattern to reset the FPU registers. This
works because it happens that our implementation of
floatx80_default_nan() doesn't actually look at the float_status
pointer except for TARGET_MIPS. However, this isn't guaranteed,
and to be able to remove the ifdef in floatx80_default_nan()
we're going to need a real float_status here.
Rearrange m68k_cpu_reset_hold() so that we initialize env->fp_status
earlier, and thus can pass it to floatx80_default_nan().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20241202131347.498124-28-peter.maydell@linaro.org
---
target/m68k/cpu.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
index 5fe335558aa..13b76e22488 100644
--- a/target/m68k/cpu.c
+++ b/target/m68k/cpu.c
@@ -76,7 +76,7 @@ static void m68k_cpu_reset_hold(Object *obj, ResetType type)
CPUState *cs = CPU(obj);
M68kCPUClass *mcc = M68K_CPU_GET_CLASS(obj);
CPUM68KState *env = cpu_env(cs);
- floatx80 nan = floatx80_default_nan(NULL);
+ floatx80 nan;
int i;
if (mcc->parent_phases.hold) {
@@ -89,10 +89,6 @@ static void m68k_cpu_reset_hold(Object *obj, ResetType type)
#else
cpu_m68k_set_sr(env, SR_S | SR_I);
#endif
- for (i = 0; i < 8; i++) {
- env->fregs[i].d = nan;
- }
- cpu_m68k_set_fpcr(env, 0);
/*
* M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL
* 3.4 FLOATING-POINT INSTRUCTION DETAILS
@@ -109,6 +105,12 @@ static void m68k_cpu_reset_hold(Object *obj, ResetType
type)
* preceding paragraph for nonsignaling NaNs.
*/
set_float_2nan_prop_rule(float_2nan_prop_ab, &env->fp_status);
+
+ nan = floatx80_default_nan(&env->fp_status);
+ for (i = 0; i < 8; i++) {
+ env->fregs[i].d = nan;
+ }
+ cpu_m68k_set_fpcr(env, 0);
env->fpsr = 0;
/* TODO: We should set PC from the interrupt vector. */
--
2.34.1
- [PULL 22/72] target/arm: Set Float3NaNPropRule explicitly, (continued)
- [PULL 22/72] target/arm: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/11
- [PULL 21/72] tests/fp: Explicitly set 3-NaN propagation rule, Peter Maydell, 2024/12/11
- [PULL 27/72] target/mips: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/11
- [PULL 28/72] target/xtensa: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/11
- [PULL 30/72] target/hppa: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/11
- [PULL 25/72] target/s390x: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/11
- [PULL 26/72] target/sparc: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/11
- [PULL 29/72] target/i386: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/11
- [PULL 33/72] softfloat: Create floatx80 default NaN from parts64_default_nan, Peter Maydell, 2024/12/11
- [PULL 31/72] fpu: Remove use_first_nan field from float_status, Peter Maydell, 2024/12/11
- [PULL 32/72] target/m68k: Don't pass NULL float_status to floatx80_default_nan(),
Peter Maydell <=
- [PULL 34/72] target/loongarch: Use normal float_status in fclass_s and fclass_d helpers, Peter Maydell, 2024/12/11
- [PULL 35/72] target/m68k: In frem helper, initialize local float_status from env->fp_status, Peter Maydell, 2024/12/11
- [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