Assembly x64 Intro - SSE2 Copy8Times




;copy a dw into a xmm for 8 times
%macro SSE2_Copy8Times 2
    movd    %1, %2
    punpcklwd %1, %1
    pshufd  %1,     %1,     0
%endmacro


    SSE2_Copy8Times xmm1, r2d   ; xmm1 = b,b,b,b,b,b,b,b


假设 r2d = 0x0000003f


上述将展开如下:


movd xmm1, r2d                  =>   xmm1 = 0x00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3f

punpcklwd   xmm1, xmm1   =>   xmm1 = 0x00 00 00 00 00 00 00 00 00 00 00 00 00 3f 00 3f

pshufd  xmm1, xmm1, 0      =>   xmm1 = 0x00 3f 00 3f 00 3f 00 3f 00 3f 00 3f 00 3f 00 3f



你可能感兴趣的:(Assembly x64 Intro - SSE2 Copy8Times)