0

I use the GNU assembly on 64 bit processor. I assemble the following code

movq %rsp,%rax

After that, I do a objdump on the binary code.
And I got the following:

401000: 48 89 e0                mov    %rsp,%rax

I'd thought I would see an 8 byte instruction in binary because my processor is 64 bit, but there is an only 3 byte instruction.

Is it going to be padded into a 8 byte instruction when the CPU decodes the 3 byte one?
For example:

48 49 e0  ->  48 49 e0 00 00 00 00 00
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Towa
  • 1
  • 5
    Instruction length and word width have no relation. An x86 instruction is anywhere from 1 to 15 bytes long. – fuz Jul 31 '23 at 15:21
  • 3
    What makes a processor a 64-bit processor is that it will generally have registers that are 64 bits wide, plus machine code instructions that can manipulate 64-bit quantities in one instruction (like move or copy, add, compare, dereference, etc..). The width of machine code instructions is an orthogonal issue. – Erik Eidt Jul 31 '23 at 15:25

0 Answers0