I am trying to compile C application on Mac. I use the built-in functions of SSE4 and AES-NI.
On Linux, I just call gcc with the -msse4 and -maes flags and include the wmmintrin.h header, and I can call SSE intrinsics like _mm_add_epi64(a,b) or AES-NI intrinsics like _mm_aesenc_si128(a, b) , and everything works fine.
On a Mac, this is more complicated because Apple is replacing GCC with llvm-gcc, which does not yet support AES-NI. Thus, SSE4 functions work fine, but not AES. Even built-in assembly calls to AES commands are not recognized.
Intel has many examples of AES code on its website, but only for Linux and Windows.
I noticed that the RDRAND instruction is also not supported by llvm-gcc, but Intel provides a workaround for this using the C macro, which extends into the original machine byte code. ( See an example rdrand.h file in this Intel library )
Unfortunately, a similar workaround for AES-NI instructions does not exist, probably because the instructions have arguments and cannot be evaluated as bytes of static machine code.
There are programs that use AES-NI on a Mac, including Apple's own proprietary file storage, so there must be some method that works!
To make my question concrete, how do I get the following simple call to compile using the latest version of gcc-llvm 4.2 (latest public release in Mountain Lion xcode 4.4.1):
__m128i A, B, C; A = _mm_aesenc_si128(B, C);
Thanks for any help!
gcc sse xcode aes llvm-gcc
Rich denver
source share