How to manually target 2nd and 3rd generation Intel® Core™ processors with support for Intel® AVX

Product : Intel C++ Composer XE

Version : 2013 (contains Intel C++ Compiler 13.0 or 13.1); 2011 (contains Intel C++ Compiler 12.0 or 12.1)

Manual processor dispatch allows you to write one or more versions of a function that will run only on specified types of Intel processor. The Intel processor type is detected at runtime, and the corresponding function version is executed. This feature is available only for Intel processors of IA-32 or Intel 64 architecture. It is not available for non-Intel processors nor for Intel processors of IA-64 architecture. Applications built with the manual processor dispatch feature may be more highly optimized for Intel processors than for non-Intel processors.

The __declspec(cpu_ dispatch(cpuid,cpuid,…)) syntax is used to provide a list of targeted processors along with an empty function body (i.e., a function stub). The __declspec(cpu_specific(cpuid)) syntax is used to declare each function version that is targeted at a particular type or types of processor.

The following table lists possible values for cpuid (names are not case-sensitive):

Argument for cpuid



Future processor family with support for Intel® Advanced Vector Extensions 2 (Intel® AVX2).


3rd generation Intel® Core™ processor family with support for Intel® Advanced Vector Extensions (Intel® AVX).


2nd generation Intel® Core™ processor family with support for Intel® Advanced Vector Extensions (Intel® AVX).


Intel® Core™ processors with support for Advanced Encryption Standard (AES) instructions and carry-less multiplication instruction


Intel® Core™ processor family with support for Intel® SSE4 Efficient Accelerated String and Text Processing instructions (SSE4.2)


Intel® Atom™ processors


Intel® 45nm Hi-k next generation Intel® Core™ microarchitecture processors with support for Intel® SSE4 Vectorizing Compiler and Media Accelerators instructions (SSE4.1)


Intel® Core™2 Duo processors and Intel® Xeon® processors with Intel® Supplemental Streaming SIMD Extensions 3 (SSSE3)


Intel® Pentium 4 processor with Intel® Streaming SIMD Extensions 3 (Intel® SSE3), Intel® Core™ Duo processors, Intel® Core™ Solo processors


Intel® Intel Pentium 4 processors


Intel® Pentium M processors


Intel® Pentium III processors


Other IA-32 or Intel 64 processors or compatible processors not provided by Intel Corporation

If no other matching Intel processor type is detected, the “generic” version of the function will be executed. If the program is intended to execute on non-Intel processors, a “generic” function version must be provided. The degree of optimization of the generic function version and the processor features that it assumes are under the control of the programmer.

The following framework illustrates how the cpu_dispatch and cpu_specific keywords might be used to create function versions for the 2nd generation Intel Core processor family, for the Intel Core processor family, for the Intel Core 2 Duo processor family, and for other Intel and compatible, non-Intel processors. Each processor-specific function body might contain processor-specific intrinsic functions, or it might be placed in a separate source file and compiled with a processor-specific compiler option. See for more details of such options.

#include <stdio.h>  
// need to create specific function versions for the following processors:  
__declspec(cpu_dispatch(generic, core_2_duo_ssse3, core_i7_sse4_2, core_2nd_gen_avx))
// stub that will call the appropriate specific function version   
void dispatch_func() {}; 
void dispatch_func() {  
printf("/nCode for non-Intel processors and generic Intel processors goes here/n");  
void dispatch_func() {  
printf("/nCode for Intel Core 2 Duo processors with support for SSSE3 goes here/n");  
void dispatch_func() {  
printf("/nCode for Intel Core processors with support for SSE4.2 goes here/n");  
void dispatch_func() {  
printf("/nCode for 2nd generation Intel Core processors goes here/n");  
int main() {  
printf("Return from dispatch_func/n");  
return 0;  

Optimization Notice in English

[DISCLAIMER: The information on this web site is intended for hardware system manufacturers and software developers. Intel does not warrant the accuracy, completeness or utility of any information on this site. Intel may make changes to the information or the site at any time without notice. Intel makes no commitment to update the information at this site. ALL INFORMATION PROVIDED ON THIS WEBSITE IS PROVIDED "as is" without any express, implied, or statutory warranty of any kind including but not limited to warranties of merchantability, non-infringement of intellectual property, or fitness for any particular purpose. Independent companies manufacture the third-party products that are mentioned on this site. Intel is not responsible for the quality or performance of third-party products and makes no representation or warranty regarding such products. The third-party supplier remains solely responsible for the design, manufacture, sale and functionality of its products. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. *Other names and brands may be claimed as the property of others.]