2 ms·
> Variable length instructions are not as trivial to decode wide, so you need more cleverness here. However, fixed length instructions decrease code density Th
by nayuki 3y ago
> Variable length instructions are not as trivial to decode wide, so you need more cleverness here. However, fixed length instructions decrease code density
This is true in theory but I question how much it applies to current CPUs. A problem I see is that the x86 instruction set was designed in the 1970s with corresponding assumptions about instruction frequency, speed of memory, number of CPU cycles, pipelining (or lack thereof), addressing modes, etc. Even if the variable-length encoding was close to optimal back then, there's no way it's remotely optimal given all the extensions to the instruction set, the change from hand-coded assembly to compiler-generated code, and many more seismic shifts in the ISA. So I think x86's variable-length instructions now have all the downsides of complicated decoding as well as the downsides of suboptimal code density. But you also can't reshuffle all the instructions and addressing modes without breaking backward compatibility.