1 |
The question has been asked several times and answered with different |
2 |
suggestions: |
3 |
"What CFLAGS should I use for an Intel Core2 CPU?" |
4 |
|
5 |
It has been answered a few days ago by dirtyepic on his blog with the |
6 |
information coming straight from Intel: |
7 |
|
8 |
> GCC and Intel Core |
9 |
> Thanks to H.J. Lu at Intel, I finally got an answer to something that's been bugging me for a while now. What CFLAGS do you use with an Intel Core or Core 2 processor? -march=pentium-m, or -march=prescott/nocona? |
10 |
> |
11 |
> On Fri, Dec 01, 2006 at 06:43:46AM -0800, H. J. Lu wrote: |
12 |
> > On Fri, Dec 01, 2006 at 03:36:59AM -0600, Ryan Hill wrote: |
13 |
> > > So anyways, should -m{arch,tune}=native be setting pentium-m for Core |
14 |
> > > CPU's, or is prescott really the better choice in the end? |
15 |
> > |
16 |
> > It should be -march=prescott -mtune=generic. I will look into it. |
17 |
> |
18 |
> I opened |
19 |
> |
20 |
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30040 |
21 |
> |
22 |
> |
23 |
> H.J. |
24 |
> |
25 |
> |
26 |
> |
27 |
> So, final answer. If you're using GCC 4.1, use -march=prescott for Intel Core Solo/Duo and -march=nocona (and an amd64 profile) for Core 2 Solo/Duo. For GCC 4.2, a Core Solo/Duo should use -march=prescott -mtune=generic, and Core 2 Solo/Duo should be set to -march=nocona -mtune=generic. GCC trunk adds -march=core2 and support for the SSSE3 instruction set, but that won't be out for quite a while yet. |
28 |
> |
29 |
> If you do happen to be using GCC 4.2, check out the very cool -march=native, which will autodetect the host processor(s) and set -march and -mtune accordingly. For Core CPU's you'll also need the patch from GCC PR #30040. |
30 |
> |
31 |
> dirtyepic@tycho ~ $ cat /proc/cpuinfo | grep name |
32 |
> model name : Genuine Intel(R) CPU T2300 @ 1.66GHz |
33 |
> model name : Genuine Intel(R) CPU T2300 @ 1.66GHz |
34 |
> dirtyepic@tycho ~ $ gcc -v -c test.c -o test -O2 -march=native |
35 |
> [...] |
36 |
> gcc version 4.2.0-pre20061203 (prerelease) (rev. 119470) |
37 |
> /usr/libexec/gcc/i686-pc-linux-gnu/4.2.0-pre20061203/cc1 -quiet -v test.c -march=prescott -mtune=generic -quiet -dumpbase test.c -auxbase-strip test -O2 -version -o /tmp/cclzri4i.s |
38 |
> |
39 |
> |
40 |
> |
41 |
> You can find the backported patch here: |
42 |
> http://dev.gentoo.org/~dirtyepic/overlay/sys-devel/gcc/files/4.2.0/gcc-4.2-pr30040-mtune-native-core-duo.patch |
43 |
|
44 |
His original post can be found here: |
45 |
http://psykil.livejournal.com/2006/12/03/ |