Bug#704855: llvm-3.0: does not detect Core i7 Ivy Bridge CPU, causing clang -march=native -m64 to fall back to unsupported i686 instead of x86-64

Andreas Beckmann anbe at debian.org
Sat Apr 6 20:22:49 UTC 2013


Package: llvm-3.0
Version: 3.0-10
Severity: normal
Tags: patch

Hi,

clang 3.0 fails with -march=native on an Core i7 Ivy Bridge CPU on [amd64]:

# clang -c -v -march=native /tmp/x.c -m64
Debian clang version 3.0-6.1 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
 "/usr/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all
 -disable-free -disable-llvm-verifier -main-file-name x.c
 -mrelocation-model static -mdisable-fp-elim -masm-verbose
 -mconstructor-aliases -munwind-tables -target-cpu i686
 -target-linker-version 2.22 -momit-leaf-frame-pointer -v -coverage-file
 x.o -resource-dir /usr/bin/../lib/clang/3.0 -fmodule-cache-path
 /var/tmp/clang-module-cache -internal-isystem /usr/local/include
 -internal-isystem /usr/bin/../lib/clang/3.0/include
 -internal-externc-isystem /usr/include/x86_64-linux-gnu
 -internal-externc-isystem /usr/include -ferror-limit 19
 -fmessage-length 194 -fgnu-runtime -fobjc-runtime-has-arc
 -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option
 -fcolor-diagnostics -o x.o -x c /tmp/x.c
error: unknown target CPU 'i686'

Hmm, well, that one only exists for -m32.

# cat /proc/cpuinfo
 processor       : 0
 vendor_id       : GenuineIntel
 cpu family      : 6
 model           : 58
 model name      : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
 stepping        : 9
 microcode       : 0x12
...

I cherry-picked a few patches from llvm-3.2 from their git-svn repository
that
* add detection for a few newer CPUs
* use a default for unknown CPUs that takes into account whether the CPU
  is 64-bit capable, so this would fall back to -march=x86-64 which
  would actually work.

After applying these patches to llvm-3.0 clang-3.0 started to behave
sane again. (But due to lack of AVX support I'll have to move to
llvm-3.2/clang-3.2 anyway.)

If help is needed, I could take care of a NMU and try to get this
unblocked for wheezy.

Andreas

--


------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r155402-Add-a-missing-cpu-subtype.patch
Type: text/x-diff
Size: 838 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-llvm-team/attachments/20130406/34a245df/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r156486-Use-the-cpuid-64-bit-flag-to-pick-the-default-CPU-na.patch
Type: text/x-diff
Size: 1109 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-llvm-team/attachments/20130406/34a245df/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: r164714-Add-support-for-detecting-some-corei7-class-Xeons.patch
Type: text/x-diff
Size: 917 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-llvm-team/attachments/20130406/34a245df/attachment-0002.patch>


More information about the Pkg-llvm-team mailing list