What SSE / AVX instructions shuffle tracks from a to look like b and c ?
float4 a = {data[0], data[1], data[2], data[3]}; float4 b = {data[1], data[2], data[3], data[0]};
Background:
I have an algorithm that requires values ββfrom its neighbors; this means that I am currently mixing aligned loads and unloaded loads:
( plate[row + 1][column]
Here it is in SSE:
__m128 bottom = _mm_load_ps(&from[row-1][column]); __m128 left = _mm_loadu_ps(&from[row][column-1]); __m128 middle = _mm_load_ps(&from[row][column]); __m128 right = _mm_loadu_ps(&from[row][column+1]); __m128 top = _mm_load_ps&from[row+1][column]); (top + bottom + left + right + _mm_set1_ps(4.0f) * middle) * _mm_set1_ps(0.125f);
I realized that the values ββin the current and left or right differ only in one value. Therefore, I had the idea that instead of performing two unaligned loads, I could shuffle the tracks, and then insert one value, another. I need to check the latency / bandwidth in the instructions to see if they will be faster, but I am not familiar with any of these SSE / AVX instructions.
source share