I am trying to make some optimized code using SSE2 instructions. Currently, i have it written in inline assembly, like this:
...
__m128 zero = {0};
__asm {
...
LINE_LOOP_1:
MOVQ xmm0, QWORD PTR [eax] ; no problem
PUNPCKLBW xmm0, zero ; PROBLEM IS HERE
...
LOOP LINE_LOOP_1
}
It works very well, but i would like to rewrite it using intrinsics so it would be easier to change (i have slightly different versions of calculations, which i would like to optimize).
However, i cannot figure out which intrinsics to use. Any documentation i found lists about half of SSE2 instructions, and it looks as if the other half is not available as intrinsics! It seems very unlikely that MS left their implementation of SSE halfway along.
So, which intrinsic can i use to generate, for example, the PUNPCKLBW instruction?
I use MS Visual Studio 2005.
P.S. Some MSDN documentation suggests using _mm_unpacklo_pi8, but it doesn’t work:
#include "xmmintrin.h"
int main()
{
__m128 x = {0}, y = {0};
x = _mm_unpacklo_pi8(x, y);
}
This gives a compilation error:
error C2664: ‘_m_punpcklbw’ : cannot convert parameter 1 from ‘_m128′ to ‘_m64′
You have to use
_mm_unpacklo_epi8see here.The
epipostifix intrinsics are for SSE registers, thepiare for MMX registers.