Is it true registers are 32-bit in x86 and 64-bit in x86-64?
Short answer: yes.
All CPUs have multiple registers. On x86 CPUs the largest is 32bits long and on x64 the longest is 64bits long.
The smaller registers are provided for backwards compatibility with older applications.
For example, the
Its important to note that
If the value in ebx is
Take as an example the accumulator register.
In the 8086/8088 this was the 16 bit AX register. The left and right 8 bit parts could be accessed separately as AH and AL:
The 32 bit processors added the 32 bit registers, while the original 16 and 8 bit registers kept available:
And with 64 bit they repeated the trick:
And there are also the floating point registers, each 80 bit long regardless of the main register size.
General-purpose registers and the instruction pointer are 16 bits on a 16-bit x86 CPU (i.e. 80x86 up to 286, or later in compatibility mode), 32 bits on a 32-bit x86 CPU (i.e. 386 onwards), and 64 bits on a 64-bit CPU (i.e. amd64 or compatible). That's because an N-bit CPU is more or less defined as a CPU where general purpose registers are N bits wide (or a CPU where the instruction pointer is N bits wide, but on x86 and most other architectures that's the same).
Some other registers have different sizes. For example, 32-bit x86 CPUs have 16-bit segment registers (rarely used), and 80-bit floating point registers. The wikipedia article on X86 has a more complete list.