Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Macro Functions to Read and Write Control Registers

The following macro functions enable you to read and write bits to and from the control register.

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 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 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 bit 7 – 12 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

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 13 and 14 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 15 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)