问题
Is the only way to move a value into an xmm register by first moving the value into an integer register, dunno what they are called, and then into the xmm register e.g.
mov [eax], (float)1000 ; store to memory
movss xmm1,[eax] ; reload
or
mov eax, 1000 ; move-immediate integer
cvtsi2ss xmm1,eax ; and convert
or is there another way? Is there a way to directly move a value into a xmm register, something along the lines of: movss xmm1,(float)1000?
回答1:
There are no instructions to load an SSE register with an immediate. The common idiom is to load the value you need from a global constant:
const dd 1000.0
...
movss xmm0,[const]
来源:https://stackoverflow.com/questions/47946389/how-to-move-a-floating-point-constant-value-into-an-xmm-register