[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 for-10.0 14/54] softfloat: Pass have_snan to pickNaNMulAdd
From: |
Peter Maydell |
Subject: |
[PATCH v2 for-10.0 14/54] softfloat: Pass have_snan to pickNaNMulAdd |
Date: |
Mon, 2 Dec 2024 13:13:07 +0000 |
The new implementation of pickNaNMulAdd() will find it convenient
to know whether at least one of the three arguments to the muladd
was a signaling NaN. We already calculate that in the caller,
so pass it in as a new bool have_snan.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
fpu/softfloat-parts.c.inc | 5 +++--
fpu/softfloat-specialize.c.inc | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
index aac1f9cd28c..655b7d9da51 100644
--- a/fpu/softfloat-parts.c.inc
+++ b/fpu/softfloat-parts.c.inc
@@ -67,8 +67,9 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a,
FloatPartsN *b,
{
int which;
bool infzero = (ab_mask == float_cmask_infzero);
+ bool have_snan = (abc_mask & float_cmask_snan);
- if (unlikely(abc_mask & float_cmask_snan)) {
+ if (unlikely(have_snan)) {
float_raise(float_flag_invalid | float_flag_invalid_snan, s);
}
@@ -80,7 +81,7 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a,
FloatPartsN *b,
if (s->default_nan_mode) {
which = 3;
} else {
- which = pickNaNMulAdd(a->cls, b->cls, c->cls, infzero, s);
+ which = pickNaNMulAdd(a->cls, b->cls, c->cls, infzero, have_snan, s);
}
if (which == 3) {
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
index 3e4ec938b25..a769c71f545 100644
--- a/fpu/softfloat-specialize.c.inc
+++ b/fpu/softfloat-specialize.c.inc
@@ -473,7 +473,7 @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls,
| Return values : 0 : a; 1 : b; 2 : c; 3 : default-NaN
*----------------------------------------------------------------------------*/
static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
- bool infzero, float_status *status)
+ bool infzero, bool have_snan, float_status *status)
{
/*
* We guarantee not to require the target to tell us how to
--
2.34.1
- [PATCH v2 for-10.0 00/54] fpu: Remove pickNaNMulAdd, default-NaN ifdefs, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 01/54] fpu: handle raising Invalid for infzero in pick_nan_muladd, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 02/54] fpu: Check for default_nan_mode before calling pickNaNMulAdd, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 03/54] softfloat: Allow runtime choice of inf * 0 + NaN result, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 05/54] target/arm: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 04/54] tests/fp: Explicitly set inf-zero-nan rule, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 14/54] softfloat: Pass have_snan to pickNaNMulAdd,
Peter Maydell <=
- [PATCH v2 for-10.0 09/54] target/sparc: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 06/54] target/s390: Set FloatInfZeroNaNRule explicitly, Peter Maydell, 2024/12/02
- [PATCH v2 for-10.0 20/54] target/s390x: Set Float3NaNPropRule explicitly, Peter Maydell, 2024/12/02
- [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