Being new to compiling with specific CPU-instruction set enabled, how would I compile a general C/C++ application in Visual Studio 2008 SP1 / 2010 (I assume also supports AES-NI?) with AES-NI enabled? Are there specific compiler flags to enable?
AES-NI support in Microsoft Visual Studio 2008 SP1/2010is enabled via these means:
- Intrinsics : Availablein 32 and 64 bit target compilers (include wmmintrin.h or intrin.h)
- Inline Assembly: Available in 32 bit target compilers
- MASM: Available for 32 and 64 bits (ML, ML64)
There are no new compiler flags needed to enable AES-NI support. VC++ 2008 SP1/VC++ 2010do not automatically generate these instructions.
You will want to make sure that you check for AES-NI availability on the target platform before executing any AES-NI code by using CPUID facilities because not all Intel processors support AES-NI.
Another way to use AES-NI is via use of libraries which enable it, such as Intel Performance Primitives (IPP).
Here is a good reference article to dig further: