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
?
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]
It depends on the assembler.
UASM:
LOADSS xmm1,1000.0
ASMC, FASM, POASM, JWasm:
mov eax,1000.0
movd xmm1,eax
NASM:
mov eax,__?float32?__(1000.0)
movd xmm1,eax
MASM, YASM, Sol_Asm:
mov eax,447A0000h
movd xmm1,eax
You can also use a macro which creates constants in the data section. UASM already has a built-in macro FP4
:
movss xmm1,FP4(1000.0)
If you use ASMC, POASM, JWasm or MASM, you can define this macro:
FP4 MACRO value
LOCAL vname
.const
align 4
vname REAL4 value
.code
EXITM <vname>
ENDM
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With