The following macro functions enable you to read and write bits to and from the control register.
For Itanium®-based systems, these macros do not allow you to access all of the bits of the FPSR. Check the See Also section below for links to related topics.
Exception State Macros |
Macro Arguments |
---|---|
_MM_SET_EXCEPTION_STATE(x) |
_MM_EXCEPT_INVALID |
_MM_GET_EXCEPTION_STATE() |
_MM_EXCEPT_DIV_ZERO |
|
_MM_EXCEPT_DENORM |
Macro DefinitionsWrite to and read from the six least significant control register bits, respectively. |
_MM_EXCEPT_OVERFLOW |
|
_MM_EXCEPT_UNDERFLOW |
|
_MM_EXCEPT_INEXACT |
The following example tests for a divide-by-zero exception.
Exception Mask Macros |
Macro Arguments |
---|---|
_MM_SET_EXCEPTION_MASK(x) |
_MM_MASK_INVALID |
_MM_GET_EXCEPTION_MASK () |
_MM_MASK_DIV_ZERO |
|
_MM_MASK_DENORM |
Macro Definitions Write to and read from the seventh through twelfth control register bits, respectively.
|
_MM_MASK_OVERFLOW |
|
_MM_MASK_UNDERFLOW |
|
_MM_MASK_INEXACT |
To mask the overflow and underflow exceptions and unmask all other exceptions, use the macros as follows:_MM_SET_EXCEPTION_MASK(MM_MASK_OVERFLOW | _MM_MASK_UNDERFLOW)
The following table lists the macros to set and get rounding modes, and the macro arguments that can be passed with the macros.
Rounding Mode |
Macro Arguments |
---|---|
_MM_SET_ROUNDING_MODE(x) |
_MM_ROUND_NEAREST |
_MM_GET_ROUNDING_MODE() |
_MM_ROUND_DOWN |
Macro Definition Write to and read from bits thirteen and fourteen of the control register. |
_MM_ROUND_UP |
|
_MM_ROUND_TOWARD_ZERO |
To test the rounding mode for round toward zero, use the _MM_ROUND_TOWARD_ZERO macro as follows.
if (_MM_GET_ROUNDING_MODE() == _MM_ROUND_TOWARD_ZERO) {
/* Rounding mode is round toward zero */
}
The following table lists the macros to set and get the flush-to-zero mode and the macro arguments that can be used.
Flush-to-Zero Mode |
Macro Arguments |
---|---|
_MM_SET_FLUSH_ZERO_MODE(x) |
_MM_FLUSH_ZERO_ON |
_MM_GET_FLUSH_ZERO_MODE() |
_MM_FLUSH_ZERO_OFF |
Macro Definition Write to and read from bit fifteen of the control register. |
|
To disable the flush-to-zero mode, use the _MM_FLUSH_ZERO_OFF macro.
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_OFF)