[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 02/76] tests/tcg/x86_64/fma: Test some x86 fused-multiply-add
From: |
Peter Maydell |
Subject: |
Re: [PATCH 02/76] tests/tcg/x86_64/fma: Test some x86 fused-multiply-add cases |
Date: |
Mon, 27 Jan 2025 09:54:30 +0000 |
On Fri, 24 Jan 2025 at 17:15, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> Peter Maydell <peter.maydell@linaro.org> writes:
>
> > Add a test case which tests some corner case behaviour of
> > fused-multiply-add on x86:
> > * 0 * Inf + SNaN should raise Invalid
> > * 0 * Inf + QNaN shouldh not raise Invalid
> > * tininess should be detected after rounding
> > +static testdata tests[] = {
> > + { 0, 0x7ff0000000000000, 0x7ff000000000aaaa, false, /* 0 * Inf + SNaN
> > */
> > + 0x7ff800000000aaaa, 1 }, /* Should be QNaN and does raise Invalid */
> > + { 0, 0x7ff0000000000000, 0x7ff800000000aaaa, false, /* 0 * Inf + QNaN
> > */
> > + 0x7ff800000000aaaa, 0 }, /* Should be QNaN and does *not* raise
> > Invalid */
> > + /*
> > + * These inputs give a result which is tiny before rounding but which
> > + * becomes non-tiny after rounding. x86 is a "detect tininess after
> > + * rounding" architecture, so it should give a non-denormal result and
> > + * not set the Underflow flag (only the Precision flag for an inexact
> > + * result).
> > + */
> > + { 0x3fdfffffffffffff, 0x001fffffffffffff, 0x801fffffffffffff, false,
> > + 0x8010000000000000, 0x20 },
> > + /*
> > + * Flushing of denormal outputs to zero should also happen after
> > + * rounding, so setting FTZ should not affect the result or the flags.
> > + * QEMU currently does not emulate this correctly because we do the
> > + * flush-to-zero check before rounding, so we incorrectly produce a
> > + * zero result and set Underflow as well as Precision.
> > + */
> > +#ifdef ENABLE_FAILING_TESTS
> > + { 0x3fdfffffffffffff, 0x001fffffffffffff, 0x801fffffffffffff, true,
> > + 0x8010000000000000, 0x20 }, /* Enabling FTZ shouldn't change flags */
> > +#endif
>
> We could extend the multiarch/float_madds test to handle doubles as well
> (or create a new multiarch test).
This test case is specifically testing a corner case of x86
semantics -- on Arm, for instance, you would not get the same
result/flags, because Arm does tininess and flushing-of-denormal
before rounding, and Arm does raise Invalid for 0 * Inf + QNaN.
So I'm not sure that a multiarch test would be possible.
-- PMM
- [PATCH 09/76] target/arm: Use fp_status_a32 in vfp_cmp helpers, (continued)
- [PATCH 09/76] target/arm: Use fp_status_a32 in vfp_cmp helpers, Peter Maydell, 2025/01/24
- [PATCH 01/76] target/i386: Do not raise Invalid for 0 * Inf + QNaN, Peter Maydell, 2025/01/24
- [PATCH 05/76] target/arm: Use uint32_t in vfp_exceptbits_from_host(), Peter Maydell, 2025/01/24
- [PATCH 13/76] target/arm: Define new fp_status_f16_a32 and fp_status_f16_a64, Peter Maydell, 2025/01/24
- [PATCH 02/76] tests/tcg/x86_64/fma: Test some x86 fused-multiply-add cases, Peter Maydell, 2025/01/24
- [PATCH 12/76] target/arm: Remove now-unused vfp.fp_status and FPST_FPCR, Peter Maydell, 2025/01/24
- [PATCH 10/76] target/arm: Use FPST_FPCR_A32 in A32 decoder, Peter Maydell, 2025/01/24
- [PATCH 07/76] target/arm: Use vfp.fp_status_a64 in A64-only helper functions, Peter Maydell, 2025/01/24
- [PATCH 17/76] target/arm: Use FPST_FPCR_F16_A64 in A64 decoder, Peter Maydell, 2025/01/24