Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 398357 - =sys-devel/clang-3.0 missing support for AMD K10 CPUs + SSE4a
Summary: =sys-devel/clang-3.0 missing support for AMD K10 CPUs + SSE4a
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Bernard Cafarelli
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2012-01-10 10:52 UTC by Fabio Scaccabarozzi
Modified: 2012-01-13 22:25 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Clang patch to recognize amdfam10 flags and enable SSE4a usage. (clang-3.0-recognize-amd-k10-enable-sse4a.patch,2.50 KB, text/plain)
2012-01-10 10:52 UTC, Fabio Scaccabarozzi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fabio Scaccabarozzi 2012-01-10 10:52:05 UTC
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.

Reproducible: Always

Steps to Reproduce:
1. emerge -1 =sys-devel/clang-3.0
2. CC="clang" CXX="clang++" emerge -1 =sys-devel/clang-3.0
3.
Actual Results:  
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'

Expected Results:  
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).
Comment 1 Fabio Scaccabarozzi 2012-01-10 10:52:52 UTC
Created attachment 298485 [details]
Clang patch to recognize amdfam10 flags and enable SSE4a usage.
Comment 2 Bernard Cafarelli gentoo-dev 2012-01-13 22:25:10 UTC
Thanks for the report and patch! I have added 3.0-r1 to CVS with your patch in