本文介绍了-msse,-msse2,-mssse3,-msse4 rtc ..的cflgs sse选项之间有什么区别?以及如何确定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于GCC CFLAGS选项:-msse-msse2-mssse3-msse4-msse4.1-msse4.2.它们是专有用途还是可以一起使用?

For the GCC CFLAGS options: -msse, -msse2, -mssse3, -msse4, -msse4.1, -msse4.2. Are they exclusive in their use or can they be used together?

我的理解是,要设置的选择取决于运行程序的目标拱门是否支持它-这是正确的吗?

My understanding is that the choosing which to set depends on whether the target arch, which the program will run on, supports it or not - is this correct?

如果是这样,我怎么知道目标弓所支持的功能?在Linux中,我使用/proc/cpuinfo,但如果使用Mac或Windows,该怎么办?

If so, how could I know what sse my target arch supports? In Linux, I cat /proc/cpuinfo, but what if Mac or Windows?

谢谢!

推荐答案

-m开关可以并行使用,此外,某些架构或其他开关也暗含了它们.例如,如果您为x86_64构建代码,则始终启用-msse -msse2.

The -m switched can be used in parallel, furthermore some of them are implied by the architecture or other switches. For instance, if you build code for x86_64, -msse -msse2 is always enabled.

对于要在系统上运行的代码,您应该选择-march=native,这将选择处理器上可用的代码.例如,如果您有Sandy Bridge,这将启用-msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mavx.

For code intended to run on your system you should choose -march=native, which will select what is available on your processor. For instance, if you have a Sandy Bridge, this will enable -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mavx.

如果要详细指定要使用的指令集,则应仅使用可用的指令集,而不总是使用最新"指令集.目前,最新"处理器是-mavx2,我不建议这样做:支持该处理器的第一个处理器将于2013年推出.

If you want to specify in detail which instruction set to use, you should only use what is available, not always the "latest". The "latest" one is currently -mavx2, which I don't recommend: The first processor which will support it will be available in 2013.

这篇关于-msse,-msse2,-mssse3,-msse4 rtc ..的cflgs sse选项之间有什么区别?以及如何确定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 03:04