-march=native 到底是做什么的?

发布于 2024-09-04 22:36:13 字数 349 浏览 4 评论 0原文

Gentoo 维基告诉我以下内容:

警告:GCC 4.2 及更高版本支持 -march=本地。 -march=native 应用 -march 之外的其他设置, 特定于您的 CPU。除非你有 不这样做的具体原因(例如 distcc 交叉编译),你可能应该 使用 -march=native,而不是 下面列出的任何内容。

这些附加设置是什么?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

马蹄踏│碎落叶 2024-09-11 22:36:13

没关系。

$ 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

我开始非常喜欢这个选项。 -mcx16-msahf 是 gcc 现在可以使用的两个附加 CPU 指令,这在早期的 Core2 中不可用。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文