fpu: Handle all rounding modes in softfloat-parts.c.inc
cover fpu: Handle all rounding modes in softfloat-parts.c.inc
Fix up some unusual rounding modes.
r~
Richard Henderson (2):
fpu: Handle all rounding modes in partsN_uncanon_normal
fpu: Handle all rounding modes in partsN_round_to_int_normal
fpu/softfloat-parts.c.inc | 5 +++++ 1 file changed, 5 insertions(+)
Signature · 1 line
2.43.0
PATCH 1/2 fpu: Handle all rounding modes in partsN_uncanon_normal
Missed float_round_nearest_even_max when recomputing round.
--- fpu/softfloat-parts.c.inc | 1 + 1 file changed, 1 insertion(+)
fpu/softfloat-parts.c.inc +1 -0
@@ -437,6 +437,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s, /* Need to recompute round-to-even/round-to-odd. */ switch (get_float_rounding_mode(s)) { case float_round_nearest_even: + case float_round_nearest_even_max: if (N > 64 && frac_lsb == 0) { inc = ((p->frac_hi & 1) || (p->frac_lo & round_mask) != frac_lsbm1
Signature · 1 line
2.43.0
Re: [PATCH 1/2] fpu: Handle all rounding modes in partsN_uncanon_normal
Quoted 8 lines · Richard Henderson
Missed
float_round_nearest_even_maxwhen recomputing round.Reported-by Peter Maydell <[email protected]>Signed-off-by Richard Henderson <[email protected]>--- fpu/softfloat-parts.c.inc | 1 + 1 file changed, 1 insertion(+)
(dunno if hexagon hits this codepath, but it doesn't hurt to put the fix into stable)
thanks
-- PMM
Philippe Mathieu-Daudé
Reviewed-byRe: [PATCH 1/2] fpu: Handle all rounding modes in partsN_uncanon_normal
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Richard Henderson
Missed
float_round_nearest_even_maxwhen recomputing round.
Quoted 8 lines
Quoted 5 lines
Reported-by Peter Maydell <[email protected]>Signed-off-by Richard Henderson <[email protected]>--- fpu/softfloat-parts.c.inc | 1 + 1 file changed, 1 insertion(+)Fixes 72330260cdb ("softfloat: Add float_round_nearest_even_max")
Quoted 9 lines
(dunno if hexagon hits this codepath, but it doesn't hurt to put the fix into stable)
Reviewed-by Peter Maydell <[email protected]>thanks
-- PMM
PATCH 2/2 fpu: Handle all rounding modes in partsN_round_to_int_normal
In reply to Richard HendersonMissed float_round_nearest_even_max and float_round_to_odd_inf in both switch statements.
--- fpu/softfloat-parts.c.inc | 4 ++++ 1 file changed, 4 insertions(+)
fpu/softfloat-parts.c.inc +4 -0
@@ -1127,6 +1127,7 @@ static bool partsN(round_to_int_normal)(FloatPartsN *a, FloatRoundMode rmode, /* All fractional */ switch (rmode) { case float_round_nearest_even: + case float_round_nearest_even_max: one = false; if (a->exp == -1) { FloatPartsN tmp;
@@ -1149,6 +1150,7 @@ static bool partsN(round_to_int_normal)(FloatPartsN *a, FloatRoundMode rmode, one = a->sign; break; case float_round_to_odd: + case float_round_to_odd_inf: one = true; break; default:
@@ -1195,6 +1197,7 @@ static bool partsN(round_to_int_normal)(FloatPartsN *a, FloatRoundMode rmode, switch (rmode) { case float_round_nearest_even: + case float_round_nearest_even_max: inc = ((a->frac_lo & rnd_even_mask) != frac_lsbm1 ? frac_lsbm1 : 0); break; case float_round_ties_away:
@@ -1210,6 +1213,7 @@ static bool partsN(round_to_int_normal)(FloatPartsN *a, FloatRoundMode rmode, inc = a->sign ? rnd_mask : 0; break; case float_round_to_odd: + case float_round_to_odd_inf: inc = a->frac_lo & frac_lsb ? 0 : rnd_mask; break; default:
Signature · 1 line
2.43.0
Re: [PATCH 2/2] fpu: Handle all rounding modes in partsN_round_to_int_normal
Quoted 6 lines · Richard Henderson
Missed
float_round_nearest_even_maxandfloat_round_to_odd_infin both switch statements.Signed-off-by Richard Henderson <[email protected]>---
thanks
-- PMM
Re: [PATCH 2/2] fpu: Handle all rounding modes in partsN_round_to_int_normal
In reply to Richard HendersonQuoted 7 lines · Richard Henderson
Missed
float_round_nearest_even_maxandfloat_round_to_odd_infin both switch statements.Signed-off-by Richard Henderson <[email protected]>--- fpu/softfloat-parts.c.inc | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 11 lines · Richard Henderson
Fix up some unusual rounding modes.
r~
Richard Henderson (2):
fpu: Handle all rounding modes inpartsN_uncanon_normal
fpu: Handle all rounding modes inpartsN_round_to_int_normalfpu/softfloat-parts.c.inc | 5 +++++ 1 file changed, 5 insertions(+)
roundAndPackFloatx80() is the other function that doesn't implement all the rounding modes. But I guess we can assume that 80-bit floats are not going to ever need them. (It will assert if called with anything other than nearest_even, ties_away, to_zero, round_up or round_down, so we'll easily spot the cause if we ever need the functionality.)
thanks
-- PMM
Quoted 9 lines · Richard Henderson
Fix up some unusual rounding modes.
r~
Richard Henderson (2):
fpu: Handle all rounding modes inpartsN_uncanon_normal
fpu: Handle all rounding modes inpartsN_round_to_int_normal
I'm going to apply this to target-arm.next since it's a prerequisite for the FEAT_FP8 series.
thanks
-- PMM