On Wed, Feb 25, 2026 at 07:08:00PM +0800, Max Chou wrote:
> 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")
> Signed-off-by: Max Chou <[email protected]>
> ---
>  fpu/softfloat-parts.c.inc | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
> index 61b07307bf..a738758aee 100644
> --- a/fpu/softfloat-parts.c.inc
> +++ b/fpu/softfloat-parts.c.inc
> @@ -387,6 +387,7 @@ static void partsN(uncanon_normal)(FloatPartsN *p, 
> float_status *s,
>              case float_expmax_e4m3:
>                  if (exp > exp_max || p->frac_hi > E4M3_NORMAL_FRAC_MAX) {
>                      partsN(uncanon_e4m3_overflow)(p, s, fmt, overflow_norm);
> +                    exp = p->exp;
>                  }
>                  break;
>  
> @@ -496,6 +497,7 @@ static void partsN(uncanon)(FloatPartsN *p, float_status 
> *s,
>                  break;
>              case float_expmax_e4m3:
>                  partsN(uncanon_e4m3_overflow)(p, s, fmt, saturate);
> +                frac_shr(p, fmt->frac_shift);
>                  break;
>              case float_expmax_normal:
>              default:
> -- 
> 2.52.0
> 
> 

Reviewed-by: Chao Liu <[email protected]>

Thanks,
Chao

Reply via email to