On 2026-02-05 21:16, Richard Henderson wrote:
> index 1e1bbb14fd..a45873c51f 100644
> --- a/fpu/softfloat-parts.c.inc
> +++ b/fpu/softfloat-parts.c.inc
> @@ -360,6 +384,12 @@ static void partsN(uncanon_normal)(FloatPartsN *p,
> float_status *s,
> }
> break;
>
> + case float_expmax_e4m3:
> + if (exp > exp_max || p->frac_hi > E4M3_NORMAL_FRAC_MAX) {
> + partsN(uncanon_e4m3_overflow)(p, s, fmt, overflow_norm);
We need to sync local exp here liked:
+ exp = exp_max;
> + }
> + break;
> +
> @@ -459,9 +489,18 @@ static void partsN(uncanon)(FloatPartsN *p, float_status
> *s,
> frac_clear(p);
> return;
> case float_class_inf:
> - assert(fmt->exp_max_kind == float_expmax_ieee);
> - p->exp = fmt->exp_max;
> - frac_clear(p);
> + switch (fmt->exp_max_kind) {
> + case float_expmax_ieee:
> + p->exp = fmt->exp_max;
> + frac_clear(p);
> + break;
Thanks for Chao's notification. Here I missed the saturate checking at v3.
We need following checking flow for E5M2 when when float_expmax_ieee.
+ if (saturate) {
+ p->exp = fmt->exp_max - 1;
+ frac_allones(p);
+ } else {
+ p->exp = fmt->exp_max;
+ frac_clear(p);
+ }
> + case float_expmax_e4m3:
> + partsN(uncanon_e4m3_overflow)(p, s, fmt, saturate);
And we need to shift frac to packed format liked:
+ frac_shr(p, fmt->frac_shift);
> + break;
> + case float_expmax_normal:
> + default:
> + g_assert_not_reached();
> + }
Thank you Richard for this v4 patchset.
I can pass Chao's test and other test with the fix modifications
suggested here.
Could you please let me know if you’re okay with the softfloat OCP FP
conversion v4 patchset containing the OCP FP classification functions?
(e.g. float8_[e4m3|e5m2]_is_[zero|normal|signaling_nan|quiet_nan], etc.)
If not, I could provide another patchset for these OCP FP classification
funtions.
Thanks,
rnax