[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/11] softfloat: Remove which from parts_pick_nan_muladd
From: |
Richard Henderson |
Subject: |
[PATCH 04/11] softfloat: Remove which from parts_pick_nan_muladd |
Date: |
Tue, 3 Dec 2024 14:39:41 -0600 |
Assign the pointer return value to 'a' directly,
rather than going through an intermediary index.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
fpu/softfloat-parts.c.inc | 32 ++++++++++----------------------
1 file changed, 10 insertions(+), 22 deletions(-)
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
index 6423e12406..77f16ac158 100644
--- a/fpu/softfloat-parts.c.inc
+++ b/fpu/softfloat-parts.c.inc
@@ -65,9 +65,9 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a,
FloatPartsN *b,
FloatPartsN *c, float_status *s,
int ab_mask, int abc_mask)
{
- int which;
bool infzero = (ab_mask == float_cmask_infzero);
bool have_snan = (abc_mask & float_cmask_snan);
+ FloatPartsN *ret;
if (unlikely(have_snan)) {
float_raise(float_flag_invalid | float_flag_invalid_snan, s);
@@ -98,42 +98,30 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a,
FloatPartsN *b,
default:
g_assert_not_reached();
}
- which = 2;
+ ret = c;
} else {
- FloatClass cls[3] = { a->cls, b->cls, c->cls };
+ FloatPartsN *val[3] = { a, b, c };
Float3NaNPropRule rule = s->float_3nan_prop_rule;
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 */
do {
- which = rule & R_3NAN_1ST_MASK;
+ ret = val[rule & R_3NAN_1ST_MASK];
rule >>= R_3NAN_1ST_LENGTH;
- } while (!is_snan(cls[which]));
+ } while (!is_snan(ret->cls));
} else {
do {
- which = rule & R_3NAN_1ST_MASK;
+ ret = val[rule & R_3NAN_1ST_MASK];
rule >>= R_3NAN_1ST_LENGTH;
- } while (!is_nan(cls[which]));
+ } while (!is_nan(ret->cls));
}
}
- switch (which) {
- case 0:
- break;
- case 1:
- a = b;
- break;
- case 2:
- a = c;
- break;
- default:
- g_assert_not_reached();
+ if (is_snan(ret->cls)) {
+ parts_silence_nan(ret, s);
}
- if (is_snan(a->cls)) {
- parts_silence_nan(a, s);
- }
- return a;
+ return ret;
default_nan:
parts_default_nan(a, s);
--
2.43.0
- [PATCH for-10.0 00/11] fpu: pickNaN follow ups, Richard Henderson, 2024/12/03
- [PATCH 05/11] softfloat: Pad array size in pick_nan_muladd, Richard Henderson, 2024/12/03
- [PATCH 01/11] target/arm: Copy entire float_status in is_ebf, Richard Henderson, 2024/12/03
- [PATCH 03/11] softfloat: Use goto for default nan case in pick_nan_muladd, Richard Henderson, 2024/12/03
- [PATCH 04/11] softfloat: Remove which from parts_pick_nan_muladd,
Richard Henderson <=
- [PATCH 08/11] softfloat: Inline pickNaN, Richard Henderson, 2024/12/03
- [PATCH 09/11] softfloat: Share code between parts_pick_nan cases, Richard Henderson, 2024/12/03
- [PATCH 06/11] softfloat: Move propagateFloatx80NaN to softfloat.c, Richard Henderson, 2024/12/03
- [PATCH 02/11] softfloat: Inline pickNaNMulAdd, Richard Henderson, 2024/12/03