I was looking at a game code, and I saw the following:

0x171    mov [rbp-30],r12w
0x210     movups xmm0,[rbp-30]

I am pretty sure that r12 is an integer here (equals 5). So, is it moving an integer to a float register at 0x171 using movups?

I searched on Internet, but movups usually moves float to float, not integer to float...

Could someone tell me how we usually moves integer to xmm registers ?

1 Answer 1


To move a number into an XMM register, you'll first need to move that number into a memory address since you can't move an immediate into an XMM register (meaning, you can't do something like mov XMM1,9).

If need be, you can allocate your own memory to store a number in, or in your scenario, if it's feasible, you could inject code to put your own value into r12w prior to that write, or your own value into [rbp-30] after that write.

Instructions of interest for you will be MOVSS, MOVSD, MOVD, MOVQ, and so on. Assuming you opt to put your own value into [rbp-30] first:

Example: movss xmm1,[rbp-30]

Insofar as your value being an integer, you'll probably see an instruction like CVTSS2SI (Convert Scalar Single-Precision Floating-Point Value to Doubleword Integer) somewhere within the sub-routine you're in.

  • 1
    Thanks a lot! And yes I did inject code to change r12 for this hack, but it still confused me :) Jul 9, 2018 at 17:03
  • But isn't it strange that movups was used here if the memory adress put in xmm0 contained an integer ? Jul 10, 2018 at 11:53
  • 1
    Not necessarily. Data is data until it's interpreted however it needs to be interpreted at some point before it's used for something, so whether it's for optimization, faster calculation, or otherwise, data can be moved around however for any number of reasons. You'd have to reverse at least some part of the sub-routine you're in (and possibly other routines related to your value) to fully understand why the value is being transported as it is before finally being interpreted as an integer.
    – dsasmblr
    Jul 10, 2018 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.