Why is the rex.w prefix not generated for certain instructions in inline assembler blocks?
Joseph Cassman
jc7919 at outlook.com
Wed Sep 11 09:59:59 PDT 2013
On Monday, 9 September 2013 at 20:37:47 UTC, Joseph Cassman wrote:
> So I'm out of ideas on where the error is coming from. Anyone
> got any ideas on what's going on here?
Still not sure what is going on but I found a work-around that
somebody else might find useful.
The mov instruction is able to work with 64-bit values
successfully so the value that is larger than 32 bits can be
placed in a register and the register used for the operation.
Here are few examples.
void main()
{
asm
{
mov RAX,0x1ffffffffUL;
mov R8,0xFFFFFFFFFFFFFFFFUL;
and R8,RAX;
xor R8,RAX;
or R8,RAX;
add R8,RAX;
sub R8,RAX;
cmp R8,RAX;
}
}
And their disassembly (excluding the nonessentials).
mov RAX,01FFFFFFFFh
mov R8,0FFFFFFFFFFFFFFFFh
and R8,RAX
xor R8,RAX
or R8,RAX
add R8,RAX
sub R8,RAX
cmp R8,RAX
The only downside of the work-around is that there is already
pressure on the limited number of registers in x64. Some
shuffling might be required.
Joseph
More information about the Digitalmars-d-learn
mailing list