How to Compile for Intel® AVX

Intel® AVX (Intel® Advanced Vector Extensions) is a 256 bit instruction set extension to Intel® SSE (Intel® Streaming SIMD Extensions) that was first announced in 2008. Further information about Intel AVX is available at /en-us/avx/ .

The Intel C/C++ and Fortran Compilers, versions 11.1 and 12.0, support the building of applications for Intel AVX. On Windows*, use the command line switch /QxAVX. On Linux*, use –xavx. The switches /QaxAVX (Windows) and –axavx (Linux) may be used to build applications that will take advantage of AVX instructions on Intel systems that support these, but will use only SSE instructions on other Intel or compatible, non-Intel systems. For example, to generate a specialized code path optimized for 2nd generation Intel® Core™ processors, and a default code path optimized for Intel processors or compatible, non-Intel processors that support at least the SSE3 instruction set, compile with /QaxAVX /arch:SSE3 (Windows) or with -axavx -msse3 (Linux).

Both C/C++ and Fortran compilers support automatic vectorization of floating-point loops using AVX instructions. The C/C++ compiler also supports AVX-based intrinsics (via the header file immintrin.h) and inline assembly. Intel AVX allows the vectorization of a wider variety of floating point loops than Intel SSE, with a greater potential performance gain due to the greater width of the SIMD registers. The vectorizer is enabled automatically by the switches listed above. To see which loops have been vectorized, use the switch /Qvec-report1 (windows) or –vec-report1 (Linux).

The 2nd generation Intel® Core™ processor family supports Intel AVX. In addition, the Intel® Software Development Emulator (Intel® SDE) is available for testing programs built for Intel AVX. See /en-us/articles/intel-software-development-emulator.
Further general information about the Intel Compilers for C/C++ and Fortran is available at /en-us/intel-compilers/ . Further information about compiler support for Intel AVX may be found in the Intel C++ Compiler User and Reference Guides, for example in the section 'Intrinsics for Advanced Vector Extensions', accessible online at /sites/products/documentation/hpc/composerxe/en-us/2011Update/cpp/win/index.htm.

The attached presentation in PDF format contains additional detail on compiling for the Intel AVX instruction set and the Intel 2nd Generation Core processor family, including a section on loop vectorization.


Optimization Notice in English

Fichier attachéTaille
Téléchargement compiling-for-avx-kb.pdf1.33 Mo
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.