究竟是什么-march = native呢?

时间:2023-01-24 23:02:35

Gentoo Wiki told me the following:

Gentoo Wiki告诉我以下内容:

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.

警告:GCC 4.2及以上版本支持-march = native。 -march = native应用超出-march的其他设置,特定于CPU。除非您有特殊原因(例如,distcc交叉编译),否则您应该使用-march = native,而不是下面列出的任何内容。

What are those additional settings?

那些额外的设置是什么?

1 个解决方案

#1


12  

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.

我开始喜欢这个选项了很多。 -mcx16和-msahf是gcc现在可以使用的另外两个CPU指令,这些指令在早期的Core2中不可用。

#1


12  

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.

我开始喜欢这个选项了很多。 -mcx16和-msahf是gcc现在可以使用的另外两个CPU指令,这些指令在早期的Core2中不可用。