GCC:Mtune,March,MCpu [英] GCC: mtune vs march vs mcpu
问题描述
我正在尝试在多个ARM SBC上进行一些优化的构建,其中每个构建仅在我构建的目标平台上才具有兼容性.
I'm trying to make some optimized builds on several ARM SBCs, where each build will have compatability only on the target platform I'm building on.
我听说-march比-mtune更可取,因为它会通过生成仅与主机cpu兼容的指令来打破与体系结构家族中其他cpus的反向兼容. -mtune另一方面将保持这种兼容性.
I've heard that -march is more preferable here compared to -mtune as it will break break backwards compatability with other cpus in the architecture family by generating instructions that are only compatile with the host cpu. -mtune on the other hand will keep this compatabiliy.
但是,我读到-mcpu可能是设置的最佳标志,而不是-march或-mtune,因为-mcpu是特定于处理器的,而不仅仅是-marm指定的更常见的体系结构(区别是类似于-mcpu = cortex-a8,而不是-march = armv7-a).
However, I've read that -mcpu is possibly the best flag to set instead of -march or -mtune as -mcpu is specific to the very processor, not just the more common architecture specified by -marm (a difference of something like -mcpu=cortex-a8 over -march=armv7-a).
现在棘手的是,我还读到-mcpu已过时,其功能由-mtune接管,这与我先前的评论相冲突,因为与-march和-marm相比,使用-mtune是不可取的与-mcpu相比是不理想的.
Now the tricky thing is I'm also reading that -mcpu is deprecated and its functionality is taken over by -mtune, which conflicts with my previous comments regarding the use of -mtune being undesirable when compared to -march and -marm being undesirable when compared to -mcpu.
本质上,当我根本不希望与其他CPU保持兼容性时,哪个标志将为我提供最佳的主机性能.
Essentially, which flag will give me the best performance for the host machine when I don't care to maintain compatability with other cpus at all.
推荐答案
-mcpu
对于不同的目标具有不同的语义.它是不建议用于x86 (是-mtune
的同义词),但不包含ARM的ARM,而是
-mcpu
unfortunately has different semantics for different targets. It's deprecated for x86 (being a synonym for -mtune
) but not for ARM, where it's a sum of -march
and -mtune
.
所以要回答您的问题-在ARM上,除非您关心向后兼容性,否则始终使用-mcpu
以获得最佳性能.
So to answer your question - on ARM, always use -mcpu
for best performance, unless you care for backwards compatibility.
这篇关于GCC:Mtune,March,MCpu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!