2021年3月20日星期六

Why do add/sub instructions for partial 32bit register clear the upper 32bits of a 64bit register

I know that the mov instruction using partial registers, such as eax, will clear the upper bits of the rax register.

However this also seems to happen for add/sub,

mov rcx, 1234567800000000h     sub ecx,1   

does not yield 12345678FFFFFFFFh for rax but 00000000FFFFFFFFh.

Same happens with add

mov rcx,12345678FFFFFFFFh    add ecx,1  

Result is 0.

https://stackoverflow.com/questions/66728187/why-do-add-sub-instructions-for-partial-32bit-register-clear-the-upper-32bits-of March 21, 2021 at 10:02AM

没有评论:

发表评论