GCC:march如何与mtune不同? [英] GCC: how is march different from mtune?
问题描述
之间有什么区别?
-mtune
? 何时使用 -march
,与两者?是否可以只是 -mtune
?
谢谢。
如果使用 -march
,GCC可以自由生成在指定CPU上工作的指令, (通常)较早的CPU。如果使用 -mtune
,那么编译器将生成可以在其中任何一个上工作的代码,但是将有利于在指定的CPU上运行速度最快的指令序列。
I tried to scrub the GCC man page for this, but still don't get it, really.
What's the difference between -march
and -mtune
?
When does one use just -march
, vs. both? Is it ever possible to just -mtune
?
Thanks.
If you use -march
then GCC will be free to generate instructions that work on the specified CPU, but not on (typically) earlier CPUs in the architecture family. If you use -mtune
, then the compiler will generate code that works on any of them, but will favour instruction sequences that run fastest on the specific CPU you indicated.
这篇关于GCC:march如何与mtune不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!