If registers are so blazingly fast, why don't we have more of them?

前端 未结 4 1421
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-29 22:39

In 32bit, we had 8 \"general purpose\" registers. With 64bit, the amount doubles, but it seems independent of the 64bit change itself.
Now, if registers are so fast (no memo

4条回答
  •  独厮守ぢ
    2021-01-29 22:49

    To add a little interesting info here you'll notice that having 8 same sized registers allows opcodes to maintain consistency with hexadecimal notation. For example the instruction push ax is opcode 0x50 on x86 and goes up to 0x57 for the last register di. Then the instruction pop ax starts at 0x58 and goes up to 0x5F pop di to complete the first base-16. Hexadecimal consistency is maintained with 8 registers per a size.

提交回复
热议问题