I am working on an SSE2 port for NEON. The port is at an early stage and it is giving incorrect results. Part of the reason for the incorrect results is _mm_shuffle_epi32the NEON commands that I selected.
The documentation for _mm_shuffle_epi32is onshore from Microsoft . Intel's documentation is better, but it’s not clear to me what some kind of pseudo code is doing.
SELECT4(src, control)
{
CASE(control[1:0])
0: tmp[31:0] := src[31:0]
1: tmp[31:0] := src[63:32]
2: tmp[31:0] := src[95:64]
3: tmp[31:0] := src[127:96]
ESAC
RETURN tmp[31:0]
}
dst[31:0] := SELECT4(a[127:0], imm8[1:0])
dst[63:32] := SELECT4(a[127:0], imm8[3:2])
dst[95:64] := SELECT4(a[127:0], imm8[5:4])
dst[127:96] := SELECT4(a[127:0], imm8[7:6])
I need help representing what I'm doing _mm_shuffle_epi32. Or rather, a permutation applied directly to a value. I think I need to see it as basic C and AND and OR.
Using C statements and macros, for example:
v2 = _mm_shuffle_epi32(v1, _MM_SHUFFLE(i1,i2,i3,i4));
What does the resulting C expression look like when it is expanded into the basic C statements?