At my 64bit Intel machine following code works:
mov rdi, 1 << 40
add r10, rdi
and this quite equivalent looking one produces a warning and doesn't work:
add r10, 1 << 40
Should I just stick with number 1 or am I missing something? This behaviour seems akward.
The warning produced by code nr 2:
warning: signed dword immediate exceeds bounds
x64 extends x86's 8 general-purpose registers to be 64-bit, and adds 8 new 64-bit registers. The 64-bit registers have names beginning with "r", so for example the 64-bit extension of eax is called rax. The new registers are named r8 through r15.
rax is the 64-bit, "long" size register. It was added in 2003 during the transition to 64-bit processors. eax is the 32-bit, "int" size register. It was added in 1985 during the transition to 32-bit processors with the 80386 CPU.
There is an opcode for mov r/m64, imm64
, but there is no opcode for add r/m64, imm64
in the x86-64 instruction set. In other words: you cannot use 64-bit immediate operand for add
, but you can for mov
(there are many instructions that don't have the imm64
variant; you can check the Instruction Set Reference in the Intel Software Developer Manual to check which instructions have such variant and which don't).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With