Public bug reported:

I'm working on a 5th generation Core i5 (see /proc/cpuinfo below). The
CPU offers SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AES, RDRAND, RDSEED, etc.

Ubuntu provides Clang 3.4. On this machine, the compiler claims SSE2 is
all that is available:

$ clang++ -march=native -dM -E - < /dev/null | egrep -i 
'(sse|aes|rdrnd|rdseed|avx|bmi)' | sort
#define __SSE__ 1
#define __SSE2__ 1
#define __SSE2_MATH__ 1
#define __SSE_MATH__ 1

$ g++ -march=native -dM -E - < /dev/null | egrep -i 
'(sse|aes|rdrnd|rdseed|avx|bmi)' | sort
#define __AES__ 1
#define __AVX__ 1
#define __AVX2__ 1
#define __BMI__ 1
#define __BMI2__ 1
#define __core_avx2 1
#define __core_avx2__ 1
#define __RDRND__ 1
#define __RDSEED__ 1
#define __SSE__ 1
#define __SSE2__ 1
#define __SSE2_MATH__ 1
#define __SSE3__ 1
#define __SSE4_1__ 1
#define __SSE4_2__ 1
#define __SSE_MATH__ 1
#define __SSSE3__ 1

========================================

Clang's configuration is causing self tests to fail. The self tests
verify configuration and code generation
(http://github.com/weidai11/cryptopp/blob/master/cryptest.sh#L1013):

$ CXX=clang++ ./cryptest.sh

IS_LINUX: 1
IS_X64: 1
...

************************************
Testing: X86 AES-NI code generation

clang++ -DNDEBUG -g2 -O2  -fPIC -march=native -pipe -c rijndael.cpp
ERROR: failed to generate aesenc instruction
ERROR: failed to generate aesenclast instruction
ERROR: failed to generate aesdec instruction
ERROR: failed to generate aesdeclast instruction
ERROR: failed to generate aesimc instruction
ERROR: failed to generate aeskeygenassist instruction

************************************
Testing: X86 carryless multiply code generation

clang++ -DNDEBUG -g2 -O2  -fPIC -march=native -pipe -c gcm.cpp
ERROR: failed to generate pclmullqh instruction
ERROR: failed to generate pclmullql instruction

************************************
Testing: X86 RDRAND and RDSEED code generation

clang++ -DNDEBUG -g2 -O2  -fPIC -march=native -pipe -c rdrand.cpp
Verified rdrand and rdseed machine instructions

************************************
Testing: X86 CRC32 code generation

clang++ -DNDEBUG -g2 -O2  -fPIC -march=native -pipe -c crc.cpp
ERROR: failed to generate crc32l instruction
ERROR: failed to generate crc32b instruction

========================================

$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 61
model name      : Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
stepping        : 4
microcode       : 0x16
cpu MHz         : 800.058
cache size      : 3072 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 20
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb 
rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology 
nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est 
tm2 ssse3 fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt 
tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch ida arat 
epb pln pts dtherm tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust 
bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt
...

========================================

$ uname -a
Linux qotom 3.19.0-66-generic #74~14.04.1-Ubuntu SMP Tue Jul 19 19:56:11 UTC 
2016 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release  -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:        14.04
Codename:       trusty

$ dpkg -l clang-3.4
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  clang-3.4      1:3.4-1ubunt amd64        C, C++ and Objective-C compiler (

** Affects: llvm-toolchain-3.4 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1616723

Title:
  Clang 3.4 only advertises SSE2

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-3.4/+bug/1616723/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to