我正在尝试使用 AVX2 提供的收集内在函数,但代码存在分段错误。
double src[100];
// src initialization here
int indices[10] = { 2, 10, 12, 13, 48, 60, 71, 79, 94, 97};
index = _mm256_loadu_si256(reinterpret_cast<__m256i const*>(indices));
elements = _mm256_i64gather_pd(reinterpret_cast<double const*>(src), index, 8); // Segmentation fault happens here
我不确定是什么原因导致了这个问题。由于这里的类型是 double,因此标度必须为 8。我做错了什么吗?我正在使用 -mavx2 标志进行编译。
#include
双 src[100];
// src 初始化在这里
int64_t 索引[10] = { 2, 10, 12, 13, 48, 60, 71, 79, 94, 97 }; // 使用 int64_t 表示 64 位整数
__m256i 索引 = _mm256_loadu_si256(reinterpret_cast<__m256i const*>(索引));
__m256d 元素 = _mm256_i64gather_pd(reinterpret_cast