<<< Encoding Instructions | Index | Reducing x86 ISA to a Simplified Version >>> |
Encoding operands is always a problem, because instructions have large number of operand combinations.
For example, an x86 MOV instruction requires a two-byte opcode.
However, Intel noticed that two instructions
mov memory, eax ; store register in a variable mov eax, memory ; load register from a variable
occur very frequently. These instructions store EAX register into memory and load EAX from memory.
As a result, x86 provided a special one-byte versions of dedicated MOV instructions to reduce program clutter.
Note that Intel did not remove the two-byte version of these instructions, but compiler or assembler would always emit the shorter of the two instructions.
By doing so, Intel has made an important trade-off with the MOV instruction encoding:
giving up extra opcodes in order to provide a shorter version of the MOV sub-family.
Intel used this trick all over the place to make decoding instructions shorter and easier.
This decision dates back to 1978. Today's design could use extra bytes, but the cost of memory was high in 1978!
<<< Encoding Instructions | Index | Reducing x86 ISA to a Simplified Version >>> |