Developer Guide and Reference

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*.
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 -x
arch
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.
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.
Available only for compilations targeting Intel® 64 architecture.
__AVX512BW__
(Windows*, Linux
,
macOS*
)
Defined as '1' for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Byte and Word instructions.
It is also defined as '1' when option
[Q]xCORE-AVX512
or higher processor-targeting options are specified.
__AVX512CD__
(Windows*, Linux
,
macOS*
)
Defined as '1' for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Conflict Detection instructions.
It is also defined as '1' when option
[Q]xCORE-AVX512
,
[Q]xCOMMON-AVX512
, or higher processor-targeting options are specified.
__AVX512DQ__
(Windows*, Linux
,
macOS*
)
Defined as '1' for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Doubleword and Quadword instructions.
It is also defined as '1' when option
[Q]xCORE-AVX512
or higher processor-targeting options are specified.
__AVX512ER__
(Windows*, Linux
,
macOS*
)
Defined as '1' for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Exponential and Reciprocal instructions.
__AVX512F__
(Windows*, Linux
,
macOS*
)
Defined as '1' for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Foundation instructions.
It is also defined as '1' when option
[Q]xCORE-AVX512
,
[Q]xCOMMON-AVX512
, or higher processor-targeting options are specified.
__AVX512PF__
(Windows*, Linux
,
macOS*
)
Defined as '1' for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Prefetch instructions.
__AVX512VL__
(Windows*, Linux
,
macOS*
)
Defined as '1' for processors that support Intel® Advanced Vector Extensions 512 (Intel® AVX-512) Vector Length extensions.
It is also defined as '1' when option
[Q]xCORE-AVX512
or higher processor-targeting options are specified.
__BASE_FILE__
(Linux)
Name of source file
_BOOL
(Linux)
Defined as '1'.
__COUNTER__
(Windows)
Defined as '0'.