You need to explicitly specify "-maes -mpclmul" for clang to use AES-NI and 
PCLMUL instructions.

Sent from my iPad

> On Apr 24, 2015, at 01:00, Gabriel Hackebeil <[email protected]> wrote:
> 
> My apologies. I was incorrect in assuming only the Intel compiler was using 
> the AES-NI intrinsics. I ran some code profiling on OS X and it showed that 
> both the GNU and the Intel compilers were calling the AES-NI subroutines 
> (Clang was the only compiler that failed to do so).
> 
> So to slightly rephrase my question... What could be going on that's causing 
> GNU to outperform Intel so dramatically (any optimization flags to consider)? 
> Also, has anyone else encountered such an unbalanced performance outcome 
> between two compilers on the same machine (both utilizing AES-NI)?
> 
> Regards,
> Gabe
> 
>> On Thursday, April 23, 2015 at 7:14:01 PM UTC-7, Gabriel Hackebeil wrote:
>> I've run the benchmark tests after compiling Crypto++ 5.6.2 with the latest 
>> versions of the Intel compilers (icpc 15.0.2), GNU g++ (4.9 and 5.1), and 
>> Clang (Apple LLVM version 6.1.0). I'm basically interested in getting the 
>> best possible performance for AES in CTR mode, and the results of the 
>> benchmarks were surprising. In my limited understanding, use of the AES-NI 
>> instruction set (which I believe only the Intel compiler can utilize) is 
>> supposed to provide a big performance boost for AES. The results do not show 
>> this. For the AES mode of interest (CTR), the throughput I achieve (as 
>> reported by the benchmark test suite) is roughly:
>> 
>> Clang: ~1 GiB/second
>> Intel: ~1.7 GiB/second
>> GNU: ~4.1 GiB/second
>> 
>> Can someone explain why GNU has such a huge boost in performance (~2.5x) 
>> over Intel, when GNU can not use the AES-NI instructions (I don't care much 
>> about Clang)? I get the same results comparing Intel and GNU on a Linux VM. 
>> Let me know if you need any relevant machine specs (Intel core i7 cpu). The 
>> relevant compiler flags appearing on Linux vs OS X are shown below (the 
>> performance results are the same on either operation system and I've played 
>> with various optimization flags for each without much change in 
>> performance). Can anyone enlighten me about the lack of performance boost 
>> from AES-NI?
>> 
>> On Linux VM:
>> GNU:
>> $ make CXX=g++
>> $ g++ -DNDEBUG -g -O2 -march=native -pipe -c ...
>> 
>> Intel:
>> $ make CXX=icpc
>> $ icpc -DNDEBUG -g -O2 -wd68 -wd186 -wd279 -wd327 -pipe ...
>> 
>> On OS X:
>> GNU: (the "-Wa,-q" is to get around assembler errors)
>> $ make CXX="g++-5.1 -Wa,-q"
>> $ g++-5.1 -Wa,-q -DNDEBUG -g -O2 -arch x86_64 -DCRYPTOPP_DISABLE_ASM -pipe 
>> ...
>> 
>> Intel:
>> $ make CXX=icpc
>> $ icpc -DNDEBUG -g -O2 -wd68 -wd186 -wd279 -wd327 -DCRYPTOPP_DISABLE_ASM -c 
>> ...
> 
> -- 
> -- 
> You received this message because you are subscribed to the "Crypto++ Users" 
> Google Group.
> To unsubscribe, send an email to [email protected].
> More information about Crypto++ and this group is available at 
> http://www.cryptopp.com.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Crypto++ Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to