对于 GCCCFLAGS
选项:-msse
, -msse2
, -mssse3
, -msse4
, -msse4.1
, -msse4.2
. 它们是独占使用还是可以一起使用?
我的理解是,选择设置哪个取决于程序将在其上运行的目标拱门是否支持它 - 这是正确的吗?
如果是这样,我怎么知道我的目标拱支持什么 sse?在 Linux 中,我 cat /proc/cpuinfo,但如果是 Mac 或 Windows 怎么办?
谢谢!
对于 GCCCFLAGS
选项:-msse
, -msse2
, -mssse3
, -msse4
, -msse4.1
, -msse4.2
. 它们是独占使用还是可以一起使用?
我的理解是,选择设置哪个取决于程序将在其上运行的目标拱门是否支持它 - 这是正确的吗?
如果是这样,我怎么知道我的目标拱支持什么 sse?在 Linux 中,我 cat /proc/cpuinfo,但如果是 Mac 或 Windows 怎么办?
谢谢!
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.