views:

4956

answers:

6

Hi, I'd want your input which gcc compiler flags to use when optimizing for Xeons?

There's no 'xeon' in mtune or march so which is the closest match?

A: 

Using -march=pentium4 might work..

Jon Cage
That's OK for 32-bit, but not for 64-bit userland.
jmanning2k
+2  A: 

Xeon is a marketing term, as such it covers a long list of processors with very different internals.

If you meant the newer Nehalem processors (Core i7) then this slide indicates that as of 4.3.1 gcc should be use -march=generic (though your own testing of your own app may find other settings thatoutperform this). The 4.3 series also added -msse4.2 if you wish to optimize that aspect of FP maths.

Here is some discussion comparing tuning in Intel's compiler versus some gcc flags.

ShuggyCoUk
+2  A: 

newer versions of gcc have -march=native which lets the compiler automatically determine the optimal -march flag.

Bundle that with -mtune=native and you are done.
cartman
actually, if you don't explicitly specify -mtune, -march has an implied -mtune equal to the passed -march according to the gcc docs.
+1  A: 

march=native is okay for your own machine but bad for binary releases.

-march=nocona is suggested for atom 330 (p4/64bit) -march=core2 is for core2

I'm assuming you're going 64bit.

A: 

My experience with Intel CPUs and x86_64 has been that every time I tried to tell gcc to optimize for a specific CPU type, the performance got worse than with -march=generic, not better. YMMV, of course, but I've been playing around with stuff like this lots of times over the years, and it has always been like that.

OTOH, on i386 it might make sense to target at least i686 or, if you want SSE math, at least Pentium 4.

Ringding
A: 

...and ...what about Intel(R) Xeon(R) CPU 5130 2.00GHz?

Roberto Conversano