Clang 3.0 was released without support for AMD K10 CPUs (-march=amdfam10) and SSE4a.
When asked to compile with -march=native, clang-3.0 fails because "native" on my system resolves to amdfam10, which was not implemented. Upstream fixed the issue just a little after the 3.0 release, so I've tried to backport the patch and succeeded.
Attached is the patch that allows clang-3.0 to compile with the amdfam10 flag. The patch also enables the use of SSE4a instructions for this CPU.
Steps to Reproduce:
1. emerge -1 =sys-devel/clang-3.0
2. CC="clang" CXX="clang++" emerge -1 =sys-devel/clang-3.0
The 2nd step bails out at the configure phase, because the C compiler cannot create executables. Looking at the details of config.log the following lines lead to the problem:
configure:2136: checking for C compiler default output file name
configure:2163: clang -O2 -march=native -pipe -fira-loop-pressure -fsched-pressure -Wl,-O1,--as-needed,-z,now conftest.c >&5
error: unknown target CPU 'amdfam10'
Clang should compile successfully.
Patching clang makes it compile successfully.
I have run the tests also, both the unpatched and patched versions pass all the tests.
Attached is the patch to put in $FILESDIR. This patch was taken from upstream and has already been merged, so there is no need to keep it around for 3.1 and later (clang-9999 works without patching).
Created attachment 298485 [details]
Clang patch to recognize amdfam10 flags and enable SSE4a usage.
Thanks for the report and patch! I have added 3.0-r1 to CVS with your patch in