GJ.*_*GJ. 9 x86 assembly sse simd
有没有更快的方法在一个128位xmm寄存器中存储两个x86 32位寄存器?
movd xmm0, edx
movd xmm1, eax
pshufd xmm0, xmm0, $1
por xmm0, xmm1
Run Code Online (Sandbox Code Playgroud)
因此,如果EAX为0x12345678且EDX为0x87654321,则xmm0中的结果必须为0x8765432112345678.
谢谢
Pau*_*l R 15
使用SSE 4.1,您可以使用movd xmm0, eax
/ pinsrd xmm0, edx, 1
并在2条指令中执行此操作.
对于较旧的CPU,您可以使用2 x movd
,然后punpckldq
使用总共3条指令:
movd xmm0, edx
movd xmm1, eax
punpckldq xmm0, xmm1
Run Code Online (Sandbox Code Playgroud)