I'm studying the Intel's IA-32 software developer manual. In particular, I'm reading the following manual: http://www.intel.com/Assets/PDF/manual/253666.pdf. Let's take for example the ADD instruction. On page 79 it is written that you can add an r8 (8-bit register) to an r/m8 (8-bit register or memory location). A few rows below, it is also written that you can add an r/m8 to an r8. The question is: if I add two 8-bit registers, which instruction I am using? Thanks.
The add instruction has multiple versions... same mnemonic can be encoded to different opcodes, depending on what operands you use. (and to answer your specific question: the "add r8,r8" instruction probably has 2 different possible encodings, that do the same thing)
The ADD instruction has 9 different encoding types and two opcodes are reserved for:
Opcode: 00/r = ADD r/m8, r8
Opcode: 02/r = ADD r8, r/m8
In case "ADD r8, r8" both have some effect.
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