tags:

views:

142

answers:

1

Gentoo Wiki told me the following:

Warning: GCC 4.2 and above support -march=native. -march=native applies additional settings beyond -march, specific to your CPU. Unless you have a specific reason not to (e.g. distcc cross-compiling), you should probably be using -march=native, rather than anything listed below.

What are those additional settings?

+3  A: 

Nevermind.

$ cc -march=core2 -E -v - </dev/null 2>&1 | grep cc1
 /[...]/cc1 -E -quiet -v -iprefix /[...]/4.3.2/ - -march=core2

$ cc -march=native -E -v - </dev/null 2>&1 | grep cc1
 /[...]/cc1 -E -quiet -v -iprefix /[...]/4.3.2/ - -march=core2 -mcx16 -msahf --param l1-cache-size=32 --param l1-cache-line-size=64 -mtune=core2

I'm starting to like this option a lot. -mcx16 and -msahf are two additional CPU instructions gcc can now use, which weren't available in earlier Core2's.

Jurily
On my i7, it also adds `-mpopcnt -msse4.2 --param l2-cache-size=8192` where POPCNT is a rather neat CPU instruction.
Cubbi
Weird. Do you ship the build machine along with your software?
Hans Passant
@hans: lol, but the OP is working with Gentoo. Which means no one distributes binaries, only code to be compiled on the machine on which it will be run.
caspin