[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 62/72] softfloat: Use goto for default nan case in pick_nan_muladd
From: |
Peter Maydell |
Subject: |
[PULL 62/72] softfloat: Use goto for default nan case in pick_nan_muladd |
Date: |
Wed, 11 Dec 2024 16:19:54 +0000 |
From: Richard Henderson <richard.henderson@linaro.org>
Remove "3" as a special case for which and simply
branch to return the desired value.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20241203203949.483774-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
fpu/softfloat-parts.c.inc | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
index c1a97c35b20..be7e93127d4 100644
--- a/fpu/softfloat-parts.c.inc
+++ b/fpu/softfloat-parts.c.inc
@@ -85,7 +85,7 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a,
FloatPartsN *b,
* But if we're not in default-NaN mode then the target must
* specify.
*/
- which = 3;
+ goto default_nan;
} else if (infzero) {
/*
* Inf * 0 + NaN -- some implementations return the
@@ -93,17 +93,18 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a,
FloatPartsN *b,
*/
switch (s->float_infzeronan_rule) {
case float_infzeronan_dnan_never:
- which = 2;
break;
case float_infzeronan_dnan_always:
- which = 3;
- break;
+ goto default_nan;
case float_infzeronan_dnan_if_qnan:
- which = is_qnan(c->cls) ? 3 : 2;
+ if (is_qnan(c->cls)) {
+ goto default_nan;
+ }
break;
default:
g_assert_not_reached();
}
+ which = 2;
} else {
FloatClass cls[3] = { a->cls, b->cls, c->cls };
Float3NaNPropRule rule = s->float_3nan_prop_rule;
@@ -123,11 +124,6 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN
*a, FloatPartsN *b,
}
}
- if (which == 3) {
- parts_default_nan(a, s);
- return a;
- }
-
switch (which) {
case 0:
break;
@@ -144,6 +140,10 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN
*a, FloatPartsN *b,
parts_silence_nan(a, s);
}
return a;
+
+ default_nan:
+ parts_default_nan(a, s);
+ return a;
}
/*
--
2.34.1
- [PULL 51/72] target/ppc: Set default NaN pattern explicitly, (continued)
- [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
- [PULL 56/72] target/xtensa: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 58/72] target/riscv: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 63/72] softfloat: Remove which from parts_pick_nan_muladd, Peter Maydell, 2024/12/11
- [PULL 59/72] target/tricore: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 62/72] softfloat: Use goto for default nan case in pick_nan_muladd,
Peter Maydell <=
- [PULL 70/72] softfloat: Replace WHICH with RET in parts_pick_nan, Peter Maydell, 2024/12/11
- [PULL 66/72] softfloat: Use parts_pick_nan in propagateFloatx80NaN, Peter Maydell, 2024/12/11
- [PULL 65/72] softfloat: Move propagateFloatx80NaN to softfloat.c, Peter Maydell, 2024/12/11
- [PULL 68/72] softfloat: Share code between parts_pick_nan cases, Peter Maydell, 2024/12/11
- [PULL 71/72] MAINTAINERS: update email address for Leif Lindholm, Peter Maydell, 2024/12/11
- [PULL 69/72] softfloat: Sink frac_cmp in parts_pick_nan until needed, Peter Maydell, 2024/12/11
- [PULL 57/72] target/hexagon: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 53/72] target/rx: Set default NaN pattern explicitly, Peter Maydell, 2024/12/11
- [PULL 64/72] softfloat: Pad array size in pick_nan_muladd, Peter Maydell, 2024/12/11
- [PULL 67/72] softfloat: Inline pickNaN, Peter Maydell, 2024/12/11