1

I was reading:

why we can't move a 64-bit immediate value to memory?

In one of the answers it's mentioned:

mov reg64, imm (in intel syntax, destination first) is the only instruction that accepts a 64-bit immediate value as a parameter. That's why you can't write a 64-bit immediate value directly to memory.

Isn't this a clear contradiction? On the one hand he is saying this instruction accepts 64-bit immediate value. One the other hand, he is saying that's why you can't use 64-bit immediate value!

I am totally lost, why the relation is "That's why" That's a contradiction for clear and he proved why we CAN move a 64-bit immediate to memmory?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
algo
  • 101
  • 6
  • 3
    The instruction in question writes to a **register**, not to memory. Note "reg64", not "r/m64". Since this instruction does not write to memory, and it is the only instruction to accept a 64-bit immediate, we do in fact conclude that there is no instruction that writes a 64-bit immediate to memory. – Nate Eldredge Oct 06 '21 at 05:10
  • 2
    I edited that paragraph in [the answer you quoted](https://stackoverflow.com/a/62771800/224132) to make it easier for future readers to see the point it's making. The question itself already mentions the `mov` vs. `movabs` names AT&T syntax uses for the two forms that do/don't accept a memory destination, and my answer explains why that makes sense and has some details and links. – Peter Cordes Oct 06 '21 at 05:26
  • @PeterCordes Thanks – algo Oct 06 '21 at 06:30

0 Answers0