我的 CPU 中存在 SSE 错误?
我很困惑。
当我在 Visual C++ 2008 中运行此代码时:
__m128i a, b;
a.m128i_u64[0] = 1;
b.m128i_u64[0] = 0;
a.m128i_u64[1] = 0;
b.m128i_u64[1] = 0;
printf("%d\n", _mm_testc_si128(a, b));
它打印 1
。这与我的预期相反,因为只有当 a
和 b
相同时它才应该为 1。
这怎么可能?我的 CPU 或 Visual C++ 2008 或其他方面是否存在错误?
I'm very stumped.
When I run this code in Visual C++ 2008:
__m128i a, b;
a.m128i_u64[0] = 1;
b.m128i_u64[0] = 0;
a.m128i_u64[1] = 0;
b.m128i_u64[1] = 0;
printf("%d\n", _mm_testc_si128(a, b));
it prints 1
. Which is contrary to what I expect, because it's supposed to be 1 only if a
and b
are the same.
How is this possible? Is there a bug in my CPU or in Visual C++ 2008 or something else?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道很多 SSE4.1 内在函数在 VS2008 中都被破坏了。他们在 VS2010 中修复了它们。在 VS2010(无 SP)中,一些 AVX 内在函数被破坏。他们在 VS2010 SP1 中修复了这些问题。
我从未使用过
_mm_testc_si128
内在函数,所以我不知道这是否是 VS2008 中损坏的另一个内在函数。但我见过很多插入/提取内在函数被破坏的情况。编辑:我刚刚在VS2010 SP1中测试了这个,它也给出了1。
现在我看看文档,看起来它“应该”返回 1。
所以我认为在这种情况下这不是一个错误。
I know for a fact that a lot of SSE4.1 intrinsics are broken in VS2008. They fixed them for VS2010. In VS2010 (no SP), some of the AVX intrinsics are broken. They fixed those in VS2010 SP1.
I've never used the
_mm_testc_si128
intrinsic, so I don't know if that's another intrinsic that's broken in VS2008. But I've seen numerous cases where insert/extract intrinsics were broken.EDIT : I just tested this in VS2010 SP1, it also gives 1.
Now that I look at the documentation, it looks like it "should" be returning 1.
So I don't think it's a bug in this case.