flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > The XCHG instruction is not fully optimized |
Author |
|
CandyMan 31 Jul 2020, 19:28
Code: use64 xchg eax,eax ;-> assembled: 87h C0h, it could be like in 32-bit mode: 90h _________________ smaller is better |
|||
31 Jul 2020, 19:28 |
|
Tomasz Grysztar 31 Jul 2020, 20:57
In long mode opcode 90h is treated specially in order to be a true NOP, therefore it does not clear the upper portion of the 64-bit register, while "xchg eax,eax" does.
On these forums you may even find my post from the time when I was adding 64-bit support to fasm and it was one of the issues that I needed to test on actual hardware to make sure that I interpreted the manuals correctly. And the tests confirmed that it was behaving this way. |
|||
31 Jul 2020, 20:57 |
|
revolution 31 Jul 2020, 22:29
CandyMan wrote: I forgot that in 64-bit mode the upper portion of general purpose registers is cleared when operations on 32-bit registers (surely except for the TEST instruction). |
|||
31 Jul 2020, 22:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.