fpu: Fix repacking issues in the uncanonical step for E4M3 overflow
In the uncanonical step, the input FloatParts will be repacked to the target FloatFmt. This commit fixes following issues after calling uncanon_e4m3_overflow in the uncanon/uncanon_normal functions. - Add the local exp update after calling uncanon_e4m3_overflow in the parts_uncanon_normal function. - Add the fraction shift after calling uncanon_e4m3_overflow in the parts_uncanon function. Fixes: 27e989f99c ("fpu: Add conversion routines for OCP FP8 E4M3") Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com> Signed-off-by: Max Chou <max.chou@sifive.com> Message-ID: <20260226071817.1417875-2-max.chou@sifive.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Max Chou committed
Feb 26, 2026 at 15:18 UTC
053e913aadbe1184e4be691883fea0ab38fd7888
1 file changed
+2
fpu/softfloat-parts.c.inc
+2
@@ -387,6 +387,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
387
case float_expmax_e4m3:
388
if (exp > exp_max || p->frac_hi > E4M3_NORMAL_FRAC_MAX) {
389
partsN(uncanon_e4m3_overflow)(p, s, fmt, overflow_norm);
390
+ exp = p->exp;
391
}
392
break;
393
@@ -496,6 +497,7 @@ static void partsN(uncanon)(FloatPartsN *p, float_status *s,
497
break;
498
case float_expmax_e4m3:
499
partsN(uncanon_e4m3_overflow)(p, s, fmt, saturate);
500
+ frac_shr(p, fmt->frac_shift);
501
break;
502
case float_expmax_normal:
503
default: