How to move a floating-point constant value into an xmm register?

烂漫一生 提交于 2020-05-15 08:33:22

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!