I am trying to use the gather intrinsic provided by AVX2 but the code exists with a segmentation fault.
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
I am not sure what is causing the problem. The scale has to be 8 since the type here is double. What am I doing anything wrong? I am compiling with -mavx2 flag.
#include <immintrin.h> // Include the appropriate header for AVX intrinsics
double src[100];
// src initialization here
// Use int64_t for 64-bit integers - cause of the problem
int64_t indices[10] = { 2, 10, 12, 13, 48, 60, 71, 79, 94, 97 };
__m256i index = _mm256_loadu_si256(reinterpret_cast<__m256i const*>(indices));
__m256d elements = _mm256_i64gather_pd(reinterpret_cast<double const*>(src), index, 8);