Offset __m128i with _mm_slli_epi64

I am trying to use a _mm_slli_epi64to switch a _m128ione position. I do not understand that the following code does not give me the output of all zeros as I expected, but rather prints 0x00010000000000000000000000000000. What could be wrong?

__m128i z = _mm_setr_epi8(0x80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
printblock("z = ", z);
z = _mm_slli_epi64(z, 1);
printblock("z = ", z);
return;
+4
source share
2 answers

First of all, it should not give a result with a zero result, because you do not set the register to 0x80...0, as you might think, but to 0x0...080, since it _mm_setr_epi8puts the first (leftmost) operand in the least significant byte of the register.

0x0...0100. , , , .

+3

_mm_slli_epi64 64- . 64- __m128i:

0x0000000000000000 0x0000000000000080

, , :

0x0000000000000000 0x0000000000000100
+4

All Articles