On Sun, 17 May 2026 at 01:36, Richard Henderson
<[email protected]> wrote:
>
> Signed-off-by: Richard Henderson <[email protected]>
> ---
>  target/arm/cpu-features.h        |   5 ++
>  target/arm/tcg/helper-fp8-defs.h |   3 +
>  target/arm/tcg/fp8_helper.c      | 113 +++++++++++++++++++++++++++++++
>  target/arm/tcg/translate-a64.c   |  16 +++++
>  target/arm/tcg/a64.decode        |   8 +++
>  5 files changed, 145 insertions(+)



> +static void fp8_mul_finish(CPUARMState *env, FP8MulContext *c)
> +{
> +    /*
> +     * FP8 multiplies don't update FPSR.{IDC,IOC,IXC,UFC}.
> +     * Since this is multiply-add, DZC does not apply and only OFC remains.
> +     */
> +    fp8_finish_fpst(&env->vfp.fp_status[FPST_A64], &c->stat,
> +                    float_flag_overflow);

Looking at the A1.5.5 text a bit more carefully I don't think
we should propagate OFC either for FP8 mul:

"When the rounded result with unbounded exponent has an absolute value that
 is greater than the maximum normalized number for the output precision:
 — Generate one of the following outputs with the sign of the result:
 — When FPMR.OSM is 1, the maximum normalized number.
 — When FPMR.OSM is 0, an Infinity.
 — Do not update FPSR.OFC. "

If that's the only case where that an FP8 multiply detects Overflow,
then we should just squash it also here. If there is some case
apart from the "rounded result is too big" that is also Overflow,
then things get awkward because we need to squash the "too big"
Overflow but not the "whatever the other case is" Overflow.
Working through the pseudocode it seems like there is only one
reason to set Overflow, so we need to squash all fp status flags.

Also, I realized that this squashing mechanic means we can't do
the handling of invalid input formats the way we do at the moment.
The float_raise() operations done by fp8_invalid_input() will
get squashed for multiplies. I think the fp8_invalid_output() part
is still OK because we only use it in the FP8 convert operations.

We could perhaps have fp8_mul_start() explicitly check for fmt1
or fmt2 being fp8_invalid_input -- it has access to the real
fp_status so can raise Invalid and InvalidSNaN there.

thanks
-- PMM

Reply via email to