flat assembler
Message board for the users of flat assembler.
Index
> Main > dword mov with x86-64? |
Author |
|
Tomasz Grysztar 19 Jan 2006, 12:11
It's not a bug, it's a feature.
It was documented from the very first version of published x86-64 specification. The operations on 32-bit register zero the high 32 bits of target register. This is mainly to let you use the shorter form (without REX prefix) of instruction for some cases like "sub eax,eax" to zero RAX register (instead of "sub rax,rax", which has one byte longer opcode), or "mov eax,1" instead of "mov rax,1". |
|||
19 Jan 2006, 12:11 |
|
fonolite 19 Jan 2006, 12:35
Oh, thanks for your quick detailed answer.
x86-64 looks strange to me... Anyway, how can I expand 32bit to 64bit register? i.e. (upper 0, lower eax) => (eax, eax)=rax Simple question or not? |
|||
19 Jan 2006, 12:35 |
|
Tomasz Grysztar 19 Jan 2006, 12:46
Can you rephrase?
|
|||
19 Jan 2006, 12:46 |
|
Madis731 19 Jan 2006, 12:55
I think he meant:
Code: mov eax,4C63EF53h mov rdx,rax shl rdx,32 add rdx,rax -Or- Code: mov eax,19283746h imul 100000001h ; *(2^32+1) so that rax=eax shl 32 + eax |
|||
19 Jan 2006, 12:55 |
|
fonolite 19 Jan 2006, 13:23
Madis731 is right.
I got used my code like below. Code: mov rdx,rax shl rdx,32 or rdx,rax similar answer to Madis731. This DWORD restriction bothers me. Anyway, Thank you all..., |
|||
19 Jan 2006, 13:23 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.