[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 69/72] softfloat: Sink frac_cmp in parts_pick_nan until needed
From: |
Peter Maydell |
Subject: |
[PULL 69/72] softfloat: Sink frac_cmp in parts_pick_nan until needed |
Date: |
Wed, 11 Dec 2024 16:20:01 +0000 |
From: Richard Henderson <richard.henderson@linaro.org>
Move the fractional comparison to the end of the
float_2nan_prop_x87 case. This is not required for
any other 2nan propagation rule. Reorganize the
x87 case itself to break out of the switch when the
fractional comparison is not required.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20241203203949.483774-11-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
fpu/softfloat-parts.c.inc | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
index 3c77dcbb154..abe24aeaa00 100644
--- a/fpu/softfloat-parts.c.inc
+++ b/fpu/softfloat-parts.c.inc
@@ -52,11 +52,6 @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a,
FloatPartsN *b,
return a;
}
- cmp = frac_cmp(a, b);
- if (cmp == 0) {
- cmp = a->sign < b->sign;
- }
-
switch (s->float_2nan_prop_rule) {
case float_2nan_prop_s_ab:
if (have_snan) {
@@ -89,20 +84,24 @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a,
FloatPartsN *b,
* return the NaN with the positive sign bit (if any).
*/
if (is_snan(a->cls)) {
- if (is_snan(b->cls)) {
- which = cmp > 0 ? 0 : 1;
- } else {
+ if (!is_snan(b->cls)) {
which = is_qnan(b->cls) ? 1 : 0;
+ break;
}
} else if (is_qnan(a->cls)) {
if (is_snan(b->cls) || !is_qnan(b->cls)) {
which = 0;
- } else {
- which = cmp > 0 ? 0 : 1;
+ break;
}
} else {
which = 1;
+ break;
}
+ cmp = frac_cmp(a, b);
+ if (cmp == 0) {
+ cmp = a->sign < b->sign;
+ }
+ which = cmp > 0 ? 0 : 1;
break;
default:
g_assert_not_reached();
--
2.34.1
- [PULL 56/72] target/xtensa: Set default NaN pattern explicitly, (continued)
- [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, 2024/12/11
- [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 <=
- [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
- [PULL 72/72] MAINTAINERS: Add correct email address for Vikram Garhwal, Peter Maydell, 2024/12/11
- Re: [PULL 00/72] target-arm queue, Stefan Hajnoczi, 2024/12/12