使用 Intel AVX 存储打包双精度向量中的各个双精度值
我正在使用 Intel AVX 指令的 C 内在函数编写代码。如果我有一个打包的双向量(a __m256d),将它们存储到内存中不同位置的最有效方法(即最少的操作数)是什么(即我需要将它们分散到不同的位置,以便不再包装)?伪代码:
__m256d *src;
double *dst;
int dst_dist;
dst[0] = src[0];
dst[dst_dist] = src[1];
dst[2 * dst_dist] = src[2];
dst[3 * dst_dist] = src[3];
使用 SSE,我可以使用 _mm_storel_pi
和 _mm_storeh_pi
内在函数对 __m128
类型执行此操作。我还没有找到任何类似的 AVX 可以让我将各个 64 位片段存储到内存中。有吗?
I'm writing code using the C intrinsics for Intel's AVX instructions. If I have a packed double vector (a __m256d
), what would be the most efficient way (i.e. the least number of operations) to store each of them to a different place in memory (i.e. I need to fan them out to different locations such that they are no longer packed)? Pseudocode:
__m256d *src;
double *dst;
int dst_dist;
dst[0] = src[0];
dst[dst_dist] = src[1];
dst[2 * dst_dist] = src[2];
dst[3 * dst_dist] = src[3];
Using SSE, I could do this with __m128
types using the _mm_storel_pi
and _mm_storeh_pi
intrinsics. I've not been able to find anything similar for AVX that allows me to store the individual 64-bit pieces to memory. Does one exist?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用几个提取内在函数来完成此操作:(警告:未经测试)
您想要的是 AVX2 中的收集/分散指令...但这还需要几年的时间。
You can do it with a couple of extract instrinsics: (warning: untested)
What you want is the gather/scatter instructions in AVX2... But that's still a few years down the road.