问题描述
对于GCC CFLAGS
选项: -msse
, -msse2
, -mssse3
, -msse4
, -msse4.1
, -msse4.2
。他们是独家使用还是可以一起使用?
我的理解是选择要设置哪个取决于程序将运行的目标拱,是否支持它,这是正确的?
如果是这样,我怎么知道我的目标拱支持什么?在Linux中,我使用cat / proc / cpuinfo,但是如果使用mac或Windows?
谢谢!
-m
切换可以并行使用,而且其中一些是由体系结构或其他交换机隐含的。例如,如果您为x86_64构建代码,则始终启用 -msse -msse2
。 在你的系统上运行你应该选择 -march = native
,它将选择处理器上的可用内容。例如,如果您拥有Sandy Bridge,则会启用 -msse -msse2 -msse3 -mssse3 -msse4 -msse4.1 -msse4.2 -mavx
。
如果您想详细指定要使用哪个指令集,则应该只使用可用的指令集,而不总是最新的指令集。 最新版目前是 -mavx2
,我不建议:支持它的第一款处理器将于2013年上市。
For the GCC CFLAGS
options: -msse
, -msse2
, -mssse3
, -msse4
, -msse4.1
, -msse4.2
. Are they exclusive in their use or can the 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?
If so, how could I know what sse my target arch supports? In Linux, I cat /proc/cpuinfo, but what if mac or Windows?
Thanks!
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.
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
.
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选项有什么不同?以及如何确定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!