mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-02-17 18:02:14 -07:00
target/i386: Detect flush-to-zero after rounding
The Intel SDM section 10.2.3.3 on the MXCSR.FTZ bit says that we flush outputs to zero when we detect underflow, which is after rounding. Set the detect_ftz flag accordingly. This allows us to enable the test in fma.c which checks this behaviour. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250519145114.2786534-2-peter.maydell@linaro.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
23aec0d0e8
commit
bc40e4fe62
2 changed files with 4 additions and 9 deletions
|
|
@ -189,13 +189,13 @@ void cpu_init_fp_statuses(CPUX86State *env)
|
|||
set_float_default_nan_pattern(0b11000000, &env->mmx_status);
|
||||
set_float_default_nan_pattern(0b11000000, &env->sse_status);
|
||||
/*
|
||||
* TODO: x86 does flush-to-zero detection after rounding (the SDM
|
||||
* x86 does flush-to-zero detection after rounding (the SDM
|
||||
* section 10.2.3.3 on the FTZ bit of MXCSR says that we flush
|
||||
* when we detect underflow, which x86 does after rounding).
|
||||
*/
|
||||
set_float_ftz_detection(float_ftz_before_rounding, &env->fp_status);
|
||||
set_float_ftz_detection(float_ftz_before_rounding, &env->mmx_status);
|
||||
set_float_ftz_detection(float_ftz_before_rounding, &env->sse_status);
|
||||
set_float_ftz_detection(float_ftz_after_rounding, &env->fp_status);
|
||||
set_float_ftz_detection(float_ftz_after_rounding, &env->mmx_status);
|
||||
set_float_ftz_detection(float_ftz_after_rounding, &env->sse_status);
|
||||
}
|
||||
|
||||
static inline uint8_t save_exception_flags(CPUX86State *env)
|
||||
|
|
|
|||
|
|
@ -79,14 +79,9 @@ static testdata tests[] = {
|
|||
/*
|
||||
* 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
|
||||
};
|
||||
|
||||
int main(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue