3 ms·
> variable length instructions have their advantages as well, such as code density Variable length instructions in general do have a code density advantage, bu
by cesarb 4y ago
> variable length instructions have their advantages as well, such as code density
Variable length instructions in general do have a code density advantage, but x86 is a particularly poor example. For historical reasons, it wastes short encodings with rarely used things like BCD adjustment instructions, and on 64 bits often requires an extra prefix byte. The RISC-V developers did a size comparison when designing their own compressed ISA, and the variable-length x86-64 used more space than the fixed-length 64-bit ARM; for 32 bits, ARM's variable-length Thumb2 was the winner (see page 14 of https://riscv.org/wp-content/uploads/2015/06/riscv-compressed-workshop-june2015.pdf https://riscv.org/wp-content/uploads/2015/06/riscv-compresse...).
- tambourine_man 4y agoNice, thanks. I didn’t know x86 was that bad in this regard.