Sunday, September 18, 2011

march=native

On the web I found an easy way to find what the gcc compiler option -march=native translates into (can't remember where I found this, it was somewhere on a gentoo forum):

echo "" | gcc -march=native -v -E - 2>&1 | grep cc1

On my Q6600 with gcc 4.4.3 this results in:

/usr/lib/gcc/i486-linux-gnu/4.4.3/cc1 -E -quiet -v - -D_FORTIFY_SOURCE=2 -march=core2 -mcx16 -msahf --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=core2 -fstack-protector

Surprisingly on my laptop with an i7-2630QM and (cygwin) gcc 4.5.3 I get:

/usr/lib/gcc/i686-pc-cygwin/4.5.3/cc1.exe -E -quiet -v -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib /gcc/i686-pc-cygwin/4.5.3/../../../../include/w32api -idirafter /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/lib/. ./../include/w32api - -march=core2 -mcx16 -msahf -mpclmul -mpopcnt -mavx --param l1-cache-size=32 --param l1-cache-line-size=64 -- param l2-cache-size=6144 -mtune=generic

I was expecting a -march=corei7-avx but I guess that is only from gcc 4.6?