本文介绍了在Visual Studio中检测SSE/SSE2指令集的可用性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在代码中检查Visual Studio编译器是否启用了SSE/SSE2?
How can I check in code whether SSE/SSE2 is enabled or not by the Visual Studio compiler?
我尝试了#ifdef __SSE__
,但是没有用.
I have tried #ifdef __SSE__
but it didn't work.
推荐答案
来自文档:
扩展为一个值,该值指示使用了哪个/arch 编译器选项:
Expands to a value indicating which /arch compiler option was used:
- 如果使用/arch:IA32 ,则
- 0.
- 如果使用/arch:SSE ,则为1. 如果使用/arch:SSE2 ,则为
- 2.如果未指定/arch ,则此值为默认值.
- 0 if /arch:IA32 was used.
- 1 if /arch:SSE was used.
- 2 if /arch:SSE2 was used. This value is the default if /arch was not specified.
我没有提到_SSE_
.
这篇关于在Visual Studio中检测SSE/SSE2指令集的可用性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!