movsx and movsxd different behavior

175 Views Asked by At

I am in an introductory assembly class in university. I am using the yasm assembler, and I understand that movsx moves a lower sized value to the higher sized register. I also understand that movsxd is for moving a double word into a higher sized, 64bit, register. But, when I test things out, movsx and movsxd have to same behavior with double words.

Here is my example code:

    segment .data
a   dd      0xf000000f ; -268435441
    segment .text
    global main
main:
    movsx   rax, dword [a]
    movsxd  rbx, dword [a]
    ret

I feel since movsxd exists it should have some different behavior then movsx but when I run the code above and look at the values in the registers, there is no difference. Maybe I am not understanding it's intended use, or maybe I am misunderstanding something else. Any help would be great, thanks!

---Edit---
Also forgot to mention I am on Windows 11 x64

0

There are 0 best solutions below