[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH for-10.0 24/25] target/hppa: Set Float3NaNPropRule explicitly
From: |
Peter Maydell |
Subject: |
[PATCH for-10.0 24/25] target/hppa: Set Float3NaNPropRule explicitly |
Date: |
Thu, 28 Nov 2024 10:43:09 +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>
---
target/hppa/fpu_helper.c | 8 ++++++++
fpu/softfloat-specialize.c.inc | 7 +------
2 files changed, 9 insertions(+), 6 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 60de68012e1..353b524d2de 100644
--- a/fpu/softfloat-specialize.c.inc
+++ b/fpu/softfloat-specialize.c.inc
@@ -475,7 +475,6 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls,
static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
bool infzero, float_status *status)
{
- Float3NaNPropRule rule = status->float_3nan_prop_rule;
/*
* We guarantee not to require the target to tell us how to
* pick a NaN if we're always returning the default NaN.
@@ -501,11 +500,7 @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass
b_cls, FloatClass c_cls,
}
}
- if (rule == float_3nan_prop_none) {
- rule = float_3nan_prop_abc;
- }
-
- switch (rule) {
+ switch (status->float_3nan_prop_rule) {
case float_3nan_prop_s_abc:
if (is_snan(a_cls)) {
return 0;
--
2.34.1
- [PATCH for-10.0 11/25] target/x86: Set FloatInfZeroNaNRule explicitly, (continued)
- [PATCH for-10.0 11/25] target/x86: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/11/28
- [PATCH for-10.0 08/25] target/mips: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/11/28
- [PATCH for-10.0 13/25] target/hppa: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/11/28
- [PATCH for-10.0 15/25] tests/fp: Explicitly set 3-NaN propagation rule, Peter Maydell, 2024/11/28
- [PATCH for-10.0 19/25] target/s390x: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/11/28
- [PATCH for-10.0 18/25] target/ppc: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/11/28
- [PATCH for-10.0 16/25] target/arm: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/11/28
- [PATCH for-10.0 25/25] fpu: Remove use_first_nan field from float_status, Peter Maydell, 2024/11/28
- [PATCH for-10.0 23/25] target/i386: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/11/28
- [PATCH for-10.0 12/25] target/loongarch: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/11/28
- [PATCH for-10.0 24/25] target/hppa: Set Float3NaNPropRule explicitly,
Peter Maydell <=
- [PATCH for-10.0 17/25] target/loongarch: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/11/28
- [PATCH for-10.0 22/25] target/xtensa: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/11/28
- [PATCH for-10.0 21/25] target/mips: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/11/28