Can I add 64bit constants to 64bit registers?

后端 未结 1 1524
Happy的楠姐
Happy的楠姐 2020-11-29 13:14

At my 64bit Intel machine following code works:

mov rdi, 1 << 40
add r10, rdi

and this quite equivalent looking one produces a warnin

1条回答
  •  盖世英雄少女心
    2020-11-29 13:49

    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).

    0 讨论(0)
提交回复
热议问题