Intel® C++ Compiler 16.0 User and Reference Guide
Tells the compiler to generate code specialized for a particular processor, at the function level, similar to the -m (/arch) options.
Linux* and OS X*:
#pragma intel optimization_parameter target_arch=<CPU> |
Windows*:
#pragma [intel] optimization_parameter target_arch=<CPU> |
The intel optimization_parameter target_arch pragma controls the -m (/arch) option settings at the function level, overriding the option values specified at the command-line.
Place #pragma intel optimization_parameter target_arch=<CPU> at the head of a function to get the compiler to target that function for a specified instruction set. The pragma works like the -m (/arch) and [Q]x options, but applies only to the function before which it is placed.
Example: Targeting code for Intel® Advanced Vector Extensions (Intel® AVX) processors |
---|
icc -mAVX foo.c // on Linux* and OS X* with EDG compiler icl -mAVX foo.c // on OS X* with CLANG compiler |
Example: Targeting a function for Intel® Advanced Vector Extensions (Intel® AVX) processors |
---|
#pragma intel optimization_parameter target_arch=AVX void bar() { ... } |
The following code targets just the function bar for Intel® AVX processors, regardless of the command line options used.