IT lexicon › Programming › Subregister

Subregister

Programming På svenska → Updated: 2026-11-07

A part of a wider register that has a name of its own, like eax inside rax or w0 inside x0.

x86 wears its history openly: al and ah live in ax, which lives in eax, which lives in rax. When AMD designed x86-64 they decided that writing a 32-bit register zeroes the upper 32 bits. Writing ax or al preserves the rest, so the result depends on the old value. That creates false dependencies, and on some processors partial register stalls, which is why compilers reach for movzx instead.

For the register allocator, subregisters are a nuisance. al and rax are different names, yet they interfere. LLVM models this with register classes and subregister indices such as sub_32bit, so the allocator knows which bits actually overlap.

← Back to the lexicon