Hi i want to gather a some elements from a array whose indices are specified in "index". Here is the code i have written.
#include<stdio.h>
#include<stdlib.h>
#include<immintrin.h>
int main()
{
float* arrA = (float*)_mm_malloc(sizeof(float)*500,64);
float* arrB = (float*)_mm_malloc(sizeof(float)*500,64);
for(int i=0; i <42; i++)
{
arrA[i] =(float )i;
arrB[i] = (float)1;
}
__m512i index = {0,1,2,3,4,5,6,7,8,9,10,11,12,16,19,21};
__m512 v1;
v1 = _mm512_i32gather_ps(index,(void*)arrA,sizeof(float));
_mm512_store_ps((void*)arrB,v1);
for(int i =0; i < 42; i++)
printf("%f ",arrB[i]);
printf("\n");
}
In the above code i want to i want gather elements from "arrA" whose indices are given in "index". and all gathered elements will be stored in "arrB".
But it is giving Error: Illegal instruction (core dumped). If I remove _mm512_store_ps it is executing. Can some one tell what is wrong with code.
Thanks
sivaramakrishna