Macro Functions to Read and Write the Control Registers

The following macro functions enable you to read and write bits to and from the control register. For details, see Set Operations. For Itanium(TM)-based systems, these macros do not allow you to access all of the bits of the FPSR. See the descriptions for the getfpsr() and setfpsr() intrinsics in the Native Intrinsics for Itanium Instructions topic.

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 Definitions

Write to and read from the sixth-least
significant control register bit, respectively.

_MM_EXCEPT_OVERFLOW

 

_MM_EXCEPT_UNDERFLOW

 

_MM_EXCEPT_INEXACT

The following example tests for a divide-by-zero exception.

Exception State Macros
with
_MM_EXCEPT_DIV_ZERO

 

 
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.

Note
: All six exception mask bits are always affected.
Bits not set explicitly are cleared.

_MM_MASK_OVERFLOW

 

_MM_MASK_UNDERFLOW

 

_MM_MASK_INEXACT

The following example masks the overflow and underflow exceptions and unmasks all other exceptions.

Exception Mask with _MM_MASK_OVERFLOW and _MM_MASK_UNDERFLOW

_MM_SET_EXCEPTION_MASK(MM_MASK_OVERFLOW | _MM_MASK_UNDERFLOW)

 
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

The following example tests the rounding mode for round toward zero.

Rounding Mode with _MM_ROUND_TOWARD_ZERO

if (_MM_GET_ROUNDING_MODE() == _MM_ROUND_TOWARD_ZERO) {

/* Rounding mode is round toward zero */

}

 
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.

 

The following example disables flush-to-zero mode.

Flush-to-Zero Mode with _MM_FLUSH_ZERO_OFF

_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_OFF)