Question

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?

Was it helpful?

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 ---------------------------->|

OTHER TIPS

See this excellent answer to a similar question. Basically, with the Intel x86 architecture, you can access parts of a register. You are right that there aren't actual 8 bit registers, but there are ways to access only parts of a full register. This is a quirk of Intel, due to the 8086 wanting to be as compatible with 8080 as possible. And that quirk was then carried on to newer generations, as the architecture transitioned from 16-bit through 32-bit to 64-bit. Usually, CPUs only support full register access so this partitioning is a bit odd.

In x86 you can address the High and Low halves of a 16-bit register as 8-bit register

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top