Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 7/13/2023
Public
Document Table of Contents

Additional Predefined Macros

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

Unless otherwise stated, the macros are supported on systems based on IA-32 (C/C++ only) and Intel® 64 architectures.

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 an 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 OS Support Description

__APPLE__

macOS

Defined as 1.

__APPLE_CC__

macOS

The GCC build number.

__ARRAY_OPERATORS

Linux

Defined as 1.

__AVX__

Linux

macOS

Windows

Linux: Defined as 1 when option -march=corei7-avx, -mavx, -xAVX, or higher processor targeting options are specified.

Windows: Defined as 1 when option /arch:AVX, /QxAVX, or higher processor targeting options are specified.

NOTE:

Available only for compilations targeting Intel® 64 architecture.

__AVX2__

Linux

macOS

Windows

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

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

NOTE:

When any of the above options are specified, they also define macro AVX.

NOTE:

Available only for compilations targeting Intel® 64 architecture.

See Also