by adrian_b · 4w ago · 0 comments
Intel 8080 has changed some instruction encodings and it has replaced a few instructions, but it has retained almost all the 8008 instruction set as a subset. Intel 8086 has changed completely the instruction encodings, but again it has retained almost all the 8080 instruction set as a subset. The Intel 8086 instruction set is still implemented completely by the most recent Intel-AMD CPUs, remaining assembly-code compatible with 8080 and even with much of the 8008 assembly code.
In 64-bit mode, a few of the 8086 instructions are removed and for the others, if they reference memory, the 64-bit addressing modes are used instead of the 16-bit addressing modes, but otherwise they still work like in 8086, or even like in 8080 or 8008, if they belong to those subsets.
For example, let's suppose that you have a for loop. You could update 8 uint8 values simultaneously by packing them into a uint64 and adding a constant. But when you need to unpack those 8 bytes to actually use them as indexes, the unpacking costs a lot of CPU cycles, so you lose the advantage you gained by avoiding 8 separate additions.
All you can do is access AH and AL (or `SIL`, `DIL`, `BPL`, `SPL`, etc.), but this does not take just 1 CPU cycle. It takes many cycles, and only the lowest bytes can be accessed. There is a lot of performance left on the table because of insufficient support for small registers inside larger registers.
But all the legacy operating modes too? A modern x86 cpu should only have 2:
# Full-on 64 bit, legacy cruft cleared out as much as possible
# A compatibility mode to run application code written for 32-bit protected mode OSes like Win2k/XP etc
And even that last mode could be optional. Any other legacy support is just waste of transistors imho (however 'few').
Intel made a move in that direction years ago (X86S). Sadly that went nowhere.
Besides, ISA is just the CPU frontend and does not reflect the uarch. You can probably make a Ryzen execute ARM or MIPS code by changing a few frontend opcode / fw tables.