github.com/benz9527/xboot@v0.0.0-20240504061247-c23f15593274/lib/kv/simd/pshufb.s (about) 1 //go:build amd64 && !nosimd 2 3 #include "textflag.h" 4 5 // func pshufb(md *[16]int8, hash int8) 6 // Requires: SSE2, SSSE3 7 TEXT ·pshufb(SB), NOSPLIT, $0-18 8 MOVQ md+0(FP), AX 9 MOVBLSX hash+8(FP), CX 10 MOVD CX, X0 11 PXOR X1, X1 12 // x1 all bits are zero, like 0x00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00. 13 // Assume that hash is 0x66 14 // After the pshufb, the x0 will be 0x66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66. 15 // 16 // for i = 0 to 15 { 17 // if (SRC2[(i * 8)+7] = 1) then 18 // DEST[(i*8)+7..(i*8)+0] := 0; 19 // else 20 // index[3..0] := SRC2[(i*8)+3 .. (i*8)+0]; // index is 4 bits value. 21 // DEST[(i*8)+7..(i*8)+0] := SRC1[(index*8+7)..(index*8+0)]; 22 // endif 23 // } 24 // DEST[MAXVL-1:128] := 0 25 // 26 PSHUFB X1, X0 27 MOVUPS X0, (AX) 28 RET