GCC:march如何与mtune不同? [英] GCC: how is march different from mtune?

查看:430
本文介绍了GCC:march如何与mtune不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



之间有什么区别?

march -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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆