I am working with SIMD and am attempting to vectorize a loop. Here, I am trying to add a vector of indices to a pointer, left, in order to get the value of the pointer at that indice, and then continue to perform SIMD operations.
For example, if I was doing this without SIMD it would look like this:
x1 = left[a]
x2 = left[b]
x3 = left[c]
x4 = left[d]
where [a, b, c, d] is stored in the vector of indices (index_left_float)
float* left_Array[] = {left, left, left, left};
__m128 left_Array_simd = _mm_load_ps((float *) left_Array);
__m128 nleft = _mm_add_ps(index_left_float, left_Array_simd);
I also tried to load nleft into a new vector in order to get the values stored inside the pointer left at the indices of nleft but it would not let me.
The only thing I can think of would be to pull the indices from the vector, do this calculation normally, and then reload it to a vector, but this seems very costly and I am trying to optimize my code as much as possible. Any advice is appreciated! I've found the SIMD/SSE websites very hard to understand. Thanks!