vreinterpret NEON 内在问题

发布于 2024-10-03 19:16:48 字数 337 浏览 4 评论 0原文

好吧,最后一天我一直在摸头,我确信这很简单,所以就开始吧。为什么这段代码不起作用?我正在使用 Xcode 3.2.5 和 LLVM,当我尝试编译这样的东西时:

uint16x8_t          testUnsigned = {1,2,3,4,5,6,7,8};
int16x8_t           testSigned;

testSigned = vreinterpretq_s16_u16(testUnsigned);

我收到错误:“从不兼容的类型‘int’分配给‘int16x8_t’”所有其他内在函数都工作正常,但由于某种原因我可以不要重新解释向量。有什么想法吗?提前致谢。

Okay, I've been banging my head for the last day and I'm sure it's something simple so here goes. Why does this code not work? I'm using Xcode 3.2.5 and LLVM and when I try to compile something like this:

uint16x8_t          testUnsigned = {1,2,3,4,5,6,7,8};
int16x8_t           testSigned;

testSigned = vreinterpretq_s16_u16(testUnsigned);

I get the error: "Assigning to 'int16x8_t' from incompatible type 'int'" all my other intrinsics work fine but for some reason I can't reinterpret a vector. Any ideas? Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦太阳 2024-10-10 19:16:48

正如 Hiroshi 指出的那样,这个特定的调用似乎存在一个错误。但是,由于它只是在底层进行转换,因此您可以采用任何其他类型,而不会产生任何运行时损失。例如,我测试过,这是有效的:

testSigned = vreinterpretq_s16_f32(vreinterpretq_f32_u16(testUnsigned));

As Hiroshi points out, there appears to be a bug with this particular call. However, since it is just casting under the hood, you can go by way of any other type, without any runtime penalty. For example, I tested, and this works:

testSigned = vreinterpretq_s16_f32(vreinterpretq_f32_u16(testUnsigned));
幽梦紫曦~ 2024-10-10 19:16:48

/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/lib/gcc/arm-apple-darwin10/4.2.1/include/arm_neon_gcc.h:6947

#define vreinterpretq_s16_u16(__a) \
  (int16x8_t)__builtin_neon_vreinterpretv8hiv8hi ((int16x8_t) __a)

这看起来参数的类型是有符号整数。闻起来像虫子。
我不确定,但你应该尝试一下

testSigned = vreinterpretq_s16_u16((int16x8_t)testUnsigned);

/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/lib/gcc/arm-apple-darwin10/4.2.1/include/arm_neon_gcc.h:6947

#define vreinterpretq_s16_u16(__a) \
  (int16x8_t)__builtin_neon_vreinterpretv8hiv8hi ((int16x8_t) __a)

This seem like that the type of the argument is a signed int. It smell like a bug.
I'm not sure, but you should try

testSigned = vreinterpretq_s16_u16((int16x8_t)testUnsigned);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文