Ryan Hill (psykil) wrote,
Ryan Hill

GCC and Intel Core

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?

On Fri, Dec 01, 2006 at 06:43:46AM -0800, H. J. Lu wrote:
> On Fri, Dec 01, 2006 at 03:36:59AM -0600, Ryan Hill wrote:
> > So anyways, should -m{arch,tune}=native be setting pentium-m for Core
> > CPU's, or is prescott really the better choice in the end?
> It should be -march=prescott -mtune=generic. I will look into it.

I opened



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.

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.

dirtyepic@tycho ~ $ cat /proc/cpuinfo | grep name
model name : Genuine Intel(R) CPU T2300 @ 1.66GHz
model name : Genuine Intel(R) CPU T2300 @ 1.66GHz
dirtyepic@tycho ~ $ gcc -v -c test.c -o test -O2 -march=native
gcc version 4.2.0-pre20061203 (prerelease) (rev. 119470)
/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

You can find the backported patch here:
Tags: gentoo
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.