IamIC
IamIC

Reputation: 18239

Load two 64-bit integers into lower & upper xmm, respectively

What's the easiest way to move two longs in say RDX, R8 into XMM0 where RDX is moved to the lower 64 bits and R8 to the upper 64 bits?

MOVQ will only set the lower and 0 the upper.

I am limited to SSSE3.

Upvotes: 3

Views: 994

Answers (1)

user555045
user555045

Reputation: 64904

Being limited to SSSE3 means no pinsrq, but you can do this:

movq xmm1, r8
pslldq xmm1, 8
movq xmm0, rdx
por xmm0, xmm1

There are many other ways, but I can't think of anything faster right now.

Maybe this, if it doesn't have bypass delays:

movq xmm1, r8
movq xmm0, rdx
shufpd xmm0, xmm1, 0

With SSE4.1 you could of course do

movq xmm0, rdx
pinsrq xmm0, r8, 1

Upvotes: 5

Related Questions