Don't set DAZ on x86 in non-IEEE mode.

I have no idea why we were using it in the first place; it doesn't match
the behavior of PPC NI flag.
This commit is contained in:
magumagu
2014-06-14 21:22:34 -07:00
parent d7736ac714
commit d905cbfd5d
4 changed files with 4 additions and 41 deletions

View File

@ -62,8 +62,6 @@ namespace FPURoundMode
{
// OR-mask for disabling FPU exceptions (bits 7-12 in the MXCSR register)
const u32 EXCEPTION_MASK = 0x1F80;
// Denormals-Are-Zero (non-IEEE mode: denormal inputs are set to +/- 0)
const u32 DAZ = 0x40;
// Flush-To-Zero (non-IEEE mode: denormal outputs are set to +/- 0)
const u32 FTZ = 0x8000;
// lookup table for FPSCR.RN-to-MXCSR.RC translation
@ -76,16 +74,9 @@ namespace FPURoundMode
};
u32 csr = simd_rounding_table[rounding_mode];
// Some initial steppings of Pentium 4 CPUs support FTZ but not DAZ.
// They will not flush input operands but flushing outputs only is better than nothing.
static const u32 denormalLUT[2] =
{
FTZ, // flush-to-zero only
FTZ | DAZ, // flush-to-zero and denormals-are-zero (may not be supported)
};
if (non_ieee_mode)
{
csr |= denormalLUT[cpu_info.bFlushToZero];
csr |= FTZ;
}
_mm_setcsr(csr);
}