Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 12/16/2022
Public

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

Document Table of Contents

Additional Predefined Macros

The compiler supports the predefined macros listed in the table below. The compiler also includes predefined macros specified by the ISO/ANSI standard.

Unless otherwise stated, the macros are supported on systems based on IA-32 and Intel® 64 architectures. IA-32 is not available on macOS*.

NOTE:

The Intel® C++ Compiler defines the same target-architecture macros that GCC does. For -m feature, GCC defines __FEATURE__.

You can target specific processor architectures by using the -x, -m, and -march compiler options. Each of these options enables feature-specific macros in the compiler. These macros are used to guard a section of application code that uses target-specific feature. The following command emits the list of predefined macros enabled by targeting a specific processor architecture:

icpc -dM -E helloworld.cc -xarch

For example, you could do the following to determine which feature macros would help identify whether this is ICELAKE-SERVER:

icpc -dM -E helloworld.cc -xSKYLAKE-AVX512 > avx512.txt 2>&1
icpc -dM -E helloworld.cc -xICELAKE-SERVER > icelake.txt 2>&1
diff avx512.txt icelake.txt
 317a318
 > #define AVX512IFMA 1
 320a322,329
 > #define AVX512VBMI 1
 > #define AVX512VPOPCNTDQ 1
 > #define AVX512BITALG 1
 > #define AVX512VBMI2 1
 > #define GFNI 1
 > #define VAES 1
 > #define VPCLMUL 1
 > #define AVX512VNNI 1
 321a331,334
 > #define RDPID 1
 > #define SGX 1
 > #define WBNOINVD 1
 > #define PCONFIG 1

The result of the diff command is the list of feature macros that can be used to differentiate icelake-server from skylake-avx512.

Macro Description

__APPLE__

(macOS)

Defined as '1'.

__APPLE_CC__

(macOS)

The gcc* build number

__ARRAY_OPERATORS

(Linux*)

Defined as '1'.

__AVX__

(Windows*, Linux, macOS)

On Windows*, defined as '1' when option /arch:AVX, /QxAVX, or higher processor targeting options are specified.

On Linux*, defined as '1' when option -march=corei7-avx, -mavx, -xAVX, or higher processor targeting options are specified.

NOTE:

Available only for compilations targeting Intel® 64 architecture.

__AVX2__

(Windows, Linux, macOS)

On Windows, defined as '1' when option /arch:CORE-AVX2, /QxCORE-AVX2, or higher processor targeting options are specified.

On Linux, defined as '1' when option -march=core-avx2, -xCORE-AVX2, or higher processor targeting options are specified.

NOTE:

Available only for compilations targeting Intel® 64 architecture.

See Also