Intel Atom 的 GCC 优化标志

发布于 2024-07-05 23:44:59 字数 1449 浏览 12 评论 0原文

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

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

发布评论

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

评论(9

在巴黎塔顶看东京樱花 2024-07-12 23:44:59

这是一些博客的交叉传播...我真正希望的是 firefox-compiled-for-atom 基准...

地址:http://ivoras.sharanet.org/blog/tree/2009-02-11 .optimizing-for-atom.html

“事实证明,gcc 似乎在使用 -mtune=native 时做得非常不错,而 mtune=generic 则完全可以接受。最大的收益(在这个数学密集型基准测试中)来自于使用 SSE 进行数学计算,但即使是它们也会因 pentium4 的调整而被破坏

“最快和最慢的优化之间的差异是 21%。 使用 March 代替 mtune 的影响可以忽略不计(没有足够的差异来判断它是否有帮助)。

“(我包含 k6 只是为了参考 - 我知道 Atom 没有 3dnow)

“最新更新:调整 k8(使用 SSE 和 O3)会产生略高的最佳分数 182。”

here's some cross-pollenation of blogs... what i was really hoping for was a firefox-compiled-for-atom benchmark...

Address : http :// ivoras.sharanet.org/blog/tree/2009-02-11.optimizing-for-atom.html

"As it turns out, gcc appears to do a very decent job with -mtune=native, and mtune=generic is more than acceptable. The biggest gains (in this math-heavy benchmark) come from using SSE for math, but even they are destroyed by tuning for pentium4.

"The difference between the fastest and the slowest optimization is 21%. The impact of using march instead of mtune is negligible (not enough difference to tell if it helps or not).

"(I've included k6 just for reference - I know Atom doesn't have 3dnow)

"Late update: Tuning for k8 (with SSE and O3) yields a slightly higher best score of 182."

つ低調成傷 2024-07-12 23:44:59

就像奔腾 4 一样:

-march=prescott -O2 -pipe -fomit-frame-pointer

Just like for Pentium 4:

-march=prescott -O2 -pipe -fomit-frame-pointer
苍风燃霜 2024-07-12 23:44:59

我不知道 GCC 是否有任何 Atom 特定的优化标志,但 Atom 核心应该与原始 Pentium 非常相似,并且显着增加了 MMX/SSE/SSE2/SSE3/SSSE3 指令集。 当然,只有当您的代码是浮点型或 DSP 密集型时,这些才会产生显着差异。

也许你可以尝试:

gcc -O2 -march=pentium -mmmx -msse -msse2 -msse3 -mssse3 -mfpmath=sse

I don't know if GCC has any Atom-specific optimization flags yet, but the Atom core is supposed to be very similar to the original Pentium, with the very significant addition of the MMX/SSE/SSE2/SSE3/SSSE3 instruction sets. Of course, these only make a significant difference if your code is floating-point or DSP-heavy.

Perhaps you could try:

gcc -O2 -march=pentium -mmmx -msse -msse2 -msse3 -mssse3 -mfpmath=sse

够钟 2024-07-12 23:44:59

嗯,Gentoo wiki 对 prescott 的说明是:

http://en.gentoo-wiki .com/wiki/Safe_Cflags/Intel#Atom_N270

CHOST="i686-pc-linux-gnu"

CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"

CXXFLAGS="${CFLAGS} ”

Well, the Gentoo wiki states for the prescott:

http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel#Atom_N270

CHOST="i686-pc-linux-gnu"

CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"

CXXFLAGS="${CFLAGS}"

草莓味的萝莉 2024-07-12 23:44:59

来自英特尔,MID 入门

当使用 GCC 编译时,有一些建议使用的标志:

  • -O2 或 -O1:O2 标志优化速度,而 -O1 标志优化大小
  • -msse3
  • -行军=core2
  • -mfpmath=sse

From Intel, Getting Started with MID

When using GCC to compile, there are a few recommended flags to use:

  • -O2 or -O1: O2 flag optimizes for speed, while the -O1 flag optimizes for size
  • -msse3
  • -march=core2
  • -mfpmath=sse
若相惜即相离 2024-07-12 23:44:59

我有一个脚本,可以自动为您的 CPU 和编译器组合选择适当的标志。
我刚刚更新它以支持 Intel Atom:

http://www.pixelbeat.org/scripts/gcccpuopt< /a>

更新:
我之前为 Atom 指定了 -march=prescott,但更深入地研究了它
显示 Atom 符合 merom ISA,因此 -march=core2 更合适。
但请注意,原子是有序的核心,最后一个是原始的奔腾。
因此,最好选择 -mtune=pentium。 不幸的是我没有
要测试的 Atom。 如果有人能够对以下之间的差异进行基准测试,我将非常感激:

-march=core2 -mfpmath=sse -O3
-march=core2 -mtune=pentium -mfpmath=sse -O3

更新:
这里有几篇关于 Atom 低级优化的好文章:

I've a script that auto selects the appropriate flags for your CPU and compiler combination.
I've just updated it to support Intel Atom:

http://www.pixelbeat.org/scripts/gcccpuopt

Update:
I previously specified -march=prescott for Atom, but looking more into it
shows that Atom is merom ISA compliant, therefore -march=core2 is more appropriate.
Note however that Atoms are in-order cores, the last of those being the original pentium.
Therefore it's probably better to -mtune=pentium as well. Unfortunately I don't have
an Atom to test. I would really appreciate if anyone could benchmark the diff between:

-march=core2 -mfpmath=sse -O3
-march=core2 -mtune=pentium -mfpmath=sse -O3

Update:
Here are a couple of nice articles on low level optimization for Atom:

末骤雨初歇 2024-07-12 23:44:59

GCC 4.5 将包含 -march=atom 和 -mtune=atom 选项。

来源:http://gcc.gnu.org/gcc-4.5/changes.html

GCC 4.5 will contain the -march=atom and -mtune=atom options.

Source: http://gcc.gnu.org/gcc-4.5/changes.html

无法言说的痛 2024-07-12 23:44:59

有一个名为

它的工作原理是这样的:您编写一小段基准代码(它确实必须很小,因为它将被重新编译并执行数千次),它代表较大代码的性能特征您想要优化的程序。 然后 Acovea 随机构建几十个不同的 GCC 命令行,并使用每个命令行编译和运行您的基准测试。 然后,允许这些命令行中最好的“交配”和“繁殖”新的“孩子”,这些“孩子”(希望)从其“父母”继承最好的“基因”。 这个过程会重复几十“代”,直到出现一组稳定的命令行标志。

There is a cool framework called Acovea (Analysis of Compiler Options via Evolutionary Algorithm), by Scott Rober Ladd, one of the GCC hackers. It's a genetic/evolutionary algorithm framework that tries to optimize GCC optimization flags for a specific piece of code via natural selection.

It works something like this: you write a little piece of benchmark code (it really has to be little, because it will be re-compiled and executed several thousand times) that represents the performance characteristics of the larger program you want to optimize. Then Acovea randomly constructs some dozens of different GCC commandlines and compiles and runs your benchmark with each of them. The best of these commandlines are then allowed to "mate" and "breed" new "children" which (hopefully) inherit the best "genes" from their "parents". This process is repeated for a couple dozen "generations", until a stable set of commandline flags emerges.

霓裳挽歌倾城醉 2024-07-12 23:44:59

i686 最接近。 不要选择 core2。

海湾合作委员会 4.1 -O3 -march=i686
GCC 4.3 -O3 -march=本机

GCC 4.1 -O4 -ffast-math
GCC 4.3 -O4 -ffast-math

http://macles.blogspot.com/2008/09/intel-cc-compiler-gcc-and-intel-atom.html

i686 is closest. Don't go for core2.

GCC 4.1 -O3 -march=i686
GCC 4.3 -O3 -march=native

GCC 4.1 -O4 -ffast-math
GCC 4.3 -O4 -ffast-math

http://macles.blogspot.com/2008/09/intel-cc-compiler-gcc-and-intel-atom.html

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