Loading single word to a xmm register



Hi,
In my program i need to do some process on 8 words. All these 8
words are stored in different memory location. It is done by an
existing hardware. Now I am loading this by copying one word to AX
register using MOV and left shifting EAX by 16, then i loads the second
word to AX and copies the dword to xmm1. Now i left shift's this xmm1
and keeps the double word to it. Please see the code below,

mov esi, pD1
mov ax, [esi]
shl eax, 16
add esi,nRastOffset

mov ax, [esi]
movd xmm0, eax
add esi,nRastOffset

mov ax, [esi]
shl eax, 16
add esi,nRastOffset

mov ax, [esi]
movd xmm1, eax
PSLLDQ xmm1, 4
orps xmm0, xmm1
add esi,nRastOffset

mov ax, [esi]
shl eax, 16
add esi,nRastOffset

mov ax, [esi]
movd xmm1, eax
PSLLDQ xmm1, 8
orps xmm0, xmm1
add esi,nRastOffset

mov ax, [esi]
shl eax, 16
mov bx, 2[esi]
shl ebx, 16
add esi,nRastOffset

mov ax, [esi]
movd xmm1, eax
PSLLDQ xmm1, 12
orps xmm0, xmm1
add esi,nRastOffset

So this code is taking some time to copy first to the eax and then
copying to the xmm. I have done it in this way because I can't find any
instruction that loads a 16 bit value from memory to an xmm register.
Is there any instruction for that? Or is there any way to speed up this
thing a bit?

.



Relevant Pages