[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 for-10.0 25/54] target/hppa: Set Float3NaNPropRule explicitly
From: |
Peter Maydell |
Subject: |
[PATCH v2 for-10.0 25/54] target/hppa: Set Float3NaNPropRule explicitly |
Date: |
Mon, 2 Dec 2024 13:13:18 +0000 |
Set the Float3NaNPropRule explicitly for HPPA, and remove the
ifdef from pickNaNMulAdd().
HPPA is the only target that was using the default branch of the
ifdef ladder (other targets either do not use muladd or set
default_nan_mode), so we can remove the ifdef fallback entirely now
(allowing the "rule not set" case to fall into the default of the
switch statement and assert).
We add a TODO note that the HPPA rule is probably wrong; this is
not a behavioural change for this refactoring.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
target/hppa/fpu_helper.c | 8 ++++++++
fpu/softfloat-specialize.c.inc | 4 ----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/target/hppa/fpu_helper.c b/target/hppa/fpu_helper.c
index 393cae33bf9..69c4ce37835 100644
--- a/target/hppa/fpu_helper.c
+++ b/target/hppa/fpu_helper.c
@@ -55,6 +55,14 @@ void HELPER(loaded_fr0)(CPUHPPAState *env)
* HPPA does note implement a CPU reset method at all...
*/
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->fp_status);
+ /*
+ * TODO: The HPPA architecture reference only documents its NaN
+ * propagation rule for 2-operand operations. Testing on real hardware
+ * might be necessary to confirm whether this order for muladd is correct.
+ * Not preferring the SNaN is almost certainly incorrect as it diverges
+ * from the documented rules for 2-operand operations.
+ */
+ set_float_3nan_prop_rule(float_3nan_prop_abc, &env->fp_status);
/* For inf * 0 + NaN, return the input NaN */
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
}
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
index 67428dab98a..5fbc953e71e 100644
--- a/fpu/softfloat-specialize.c.inc
+++ b/fpu/softfloat-specialize.c.inc
@@ -504,10 +504,6 @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass
b_cls, FloatClass c_cls,
}
}
- if (rule == float_3nan_prop_none) {
- rule = float_3nan_prop_abc;
- }
-
assert(rule != float_3nan_prop_none);
if (have_snan && (rule & R_3NAN_SNAN_MASK)) {
/* We have at least one SNaN input and should prefer it */
--
2.34.1
- [PATCH v2 for-10.0 10/54] target/xtensa: Set FloatInfZeroNaNRule explicitly, (continued)
- [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, 2024/12/02
- [PATCH v2 for-10.0 25/54] target/hppa: Set Float3NaNPropRule explicitly,
Peter Maydell <=
- [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
- [PATCH v2 for-10.0 41/54] target/loongarch: Set default NaN pattern explicitly, Peter Maydell, 2024/12/02