Visual Studio 2010 和 SSE 4.2
我想知道,需要在 Visual Studio 2010 中设置什么才能启用 SSE 4.2?我想使用它,因为优化了 POPCNT...
我该如何测试,如果所有设置都正常?
很好
,我尝试使用您的解决方案,但是
未包含在 vstudio2010 中,并且标准 __popcnt
需要 int
而不是std::bitset<>
:(
有什么想法吗?
谢谢您提供正确标头的提示。但是,似乎:错误 C3861: '_mm_popcnt_u64':找不到标识符
,我只找到了_mm_popcnt_u32
,但是我不知道如何将它与bitset
一起使用,或者我应该只使用bitset<>.count
?如果没有编译器的 anz 设置,它就无法工作,
有人知道吗?
I would like to know, what is necessary to set in Visual Studio 2010, to have SSE 4.2 enabled? I would like to use it because of optimized POPCNT...
How can I test, if all settings are ok?
thanks
well, I tried to use your solution, however <nmmintric.h>
is not included in vstudio2010 and standard __popcnt
requires int
instead of std::bitset<>
:(
any idea?
Thx for the hint with the correct header. However, it seems that: error C3861: '_mm_popcnt_u64': identifier not found
, I found only _mm_popcnt_u32
, however I don't know, how to use it with bitset
, or should I use just bitset<>.count
? It can't work without anz settings of compiler, can it?
nobody knows ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你必须在代码中写入 _mm_popcnt_u64 。另外最好检查一下你运行的CPU是否支持该指令。
并针对 x64 进行构建。
you have to write _mm_popcnt_u64 in your code. Also better check it the cpu you run on supports the instruction.
And build for x64.
__popcnt
的 MSDN 示例:http://msdn.microsoft .com/en-us/library/bb385231.aspx
MSDN example for
__popcnt
:http://msdn.microsoft.com/en-us/library/bb385231.aspx
要实现此功能没有什么特殊要求。
您可以使用内在函数mm*并包含适当的头文件,如果您的系统支持给定的功能,它将编译。
编译器不会检查或触及内联汇编,因此您放入其中的任何内容都将通过构建,尽管如果您的系统不支持指令,您的应用程序将会崩溃。
除此之外,VS2010优化器仅针对SSE2。
There is nothing special required for this to work.
You may use intrinsics mm* and include the appropriate header file, and it will compile if your system support the given features.
The compiler does not inspect or touch inline assembly, so whatever you put in there will go through the build, although your application will crash if your system does not support an instruction.
Other than that, the VS2010 optimizer only targets SSE2.