Visible to Intel only — GUID: GUID-1659EAE1-583E-44EE-BDEA-7C68C46061C7
Visible to Intel only — GUID: GUID-1659EAE1-583E-44EE-BDEA-7C68C46061C7
Set the FTZ and DAZ Flags
For Intel® processors, the flush-to-zero (FTZ) and subnormals-are-zero (DAZ) flags in the MXCSR register are used to control floating-point calculations. Intel® Streaming SIMD Extensions (Intel® SSE) and Intel® Advanced Vector Extensions (Intel® AVX) instructions, including scalar and vector instructions, benefit from enabling the FTZ and DAZ flags. Floating-point computations using the Intel® SSE and Intel® AVX instructions are accelerated when the FTZ and DAZ flags are enabled. This improves the application's performance. The FTZ and DAZ flags are supported on Intel® 64 and some IA-32 architectures.
Use the [Q]ftz option to flush subnormal results to zero when the application is in the gradual underflow mode. This option may improve performance if the subnormal values are not critical to the application's behavior. The [Q]ftz option, when applied to the main program, sets the FTZ and the DAZ hardware flags. The negative forms of the [Q]ftz option (-no-ftz for Linux* and /Qftz- for Windows*) leave the flags as they are.
The following table describes how the compiler processes subnormal values based on the status of the FTZ and DAZ flags:
Flag |
When set to ON, the compiler... |
When set to OFF, the compiler... |
---|---|---|
FTZ |
...sets subnormal results from floating-point calculations to zero. |
...does not change the subnormal results. |
DAZ |
...treats subnormal values used as input to floating-point instructions as zero. |
...does not change the subnormal instruction inputs. |
- FTZ and DAZ are not supported on all IA-32 architectures. The FTZ flag is supported only on IA-32 architectures that support Intel® SSE instructions.
- On systems based on the IA-32 and Intel® 64 architectures,FTZ only applies to Intel® SSE and Intel® AVX instructions. If the application generates subnormals using x86 instructions, FTZ does not apply.
DAZ and FTZ flags are not compatible with the IEEE 754 standard, and should only be enabled when compliance to the IEEE standard is not required.
Options for [Q]ftz are performance options. Setting these options does not guarantee that all subnormals in a program are flushed to zero. They only cause subnormals generated at runtime to be flushed to zero.
By default the compiler inserts code into the main routine to set the FTZ and DAZ flags. When the [Q]ftz option is used on IA-32 systems with the option –msse2 or /arch:sse2, the compiler inserts code that conditionally sets the FTZ/DAZ flags based on a runtime processor check. Using the negative form of [Q]ftz prevents the compiler from inserting any code that sets FTZ or DAZ flags.
The [Q]ftz option only has an effect when the main program is being compiled. It sets the FTZ/DAZ mode for the process. The initial thread, and any subsequently created threads, operate in the FTZ/DAZ mode.
With the default floating-point model (fast), every optimization option O level, except O0, sets [Q]ftz.
If this option produces undesirable results of the numerical behavior of the program, turn the FTZ/DAZ mode off by using the negative form of [Q]ftz in the command line.
Manually set the flags by calling the following Intel® Fortran intrinsic:
RESULT = FOR_SET_FPE (FOR_M_ABRUPT_UND)