开发者

What exactly does -march=native do?

开发者 https://www.devze.com 2023-01-02 20:03 出处:网络
Gentoo Wiki told me the following: Warning: GCC 4.2 and above support -march=native. -march=native applies additional setting开发者_如何学Gos beyond -march,

Gentoo Wiki told me the following:

Warning: GCC 4.2 and above support -march=native. -march=native applies additional setting开发者_如何学Gos 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号