Search code examples
optimizationx86cpucpu-registers8-bit

What is an 8-bit register on a desktop cpu?


Reading through the following instruction table manual I see that integer multiplication is often much faster for 8-bit registers.

In the context of a normal desktop cpu, what does 8-bit register mean? That the value stored within ie a 32-bit register simply happens to be within an 8-bit range? There aren't actual 8-bit registers, right?


Solution

  • There are actual 8-bit registers, and they are just a part of the full register. For example, on Intel cpus:

    AL  8-bit
    AH  8-bit
    AX  16-bit
    EAX 32-bit
    RAX 64-bit
    

    In pictures:

    63                             32      24      16       8       0
    |-------|-------|-------|-------|-------|-------|-------|-------|
                                                            |<- AL->|
                                                    |<- AH->|
                                                    |<----- AX ---->|
                                    |<------------ EAX ------------>|
    |<---------------------------- RAX ---------------------------->|