2 ms·
> IIRC there were 64 64-bit registers. I had done some x86 32 assembly, and I hated always having to push onto the stack because all they had was eax ebx ecx.
by nwallin 3y ago
> IIRC there were 64 64-bit registers. I had done some x86 32 assembly, and I hated always having to push onto the stack because all they had was eax ebx ecx.
Well it wasn't that bad.
The Alpha had 31 integer registers and 31 floating point registers. (it had a 32nd register that would read a zero and writes were dropped) The 386 had 6 integers registers and 8 floating point registers. But if you squinted at it right, it also had 2 special purpose registers that the Alpha need to use its general purpose registers for: ebp and esp. (base pointer and stack pointer)
If you only needed 8 bit values, eax-edx could split its low 16 bits into two 8 bit registers, ie, you could use al and ah (bits 0-7 and 8-15 of eax) as registers, whereas in Alpha, a register is just a register.
Because of the CISC/RISC thing, lots of stuff that would need an extra register or two on Alpha could be done without using an extra register on x86. For instance, code that looks like array[i] = x, where the pointer for array is in rdi, i is in ecx, and x is in eax, on x86 you can just do `mov [edi + 4*ecx],eax`. On alpha this might be something like `s4add $4, $5, $6; stor [$4],$1;`. (my Alpha is...a little rusty. I can't remember if the output is on the left or right.) Alpha needs to spend a register ($4 in this case) to hold the computation of the address you're writing to, while on x86 the address you're writing to lives in a virtual register that isn't part of the ISA.
The Alpha didn't have sugary call/ret instructions that handled return values for you. On x86 call/ret implicitly push/pop the return address to/from the stack; on Alpha you needed to pass the return address as a register.
> It wasn’t until MMX that you could use more than that on x86
MMX didn't add any registers. It just turned the 8 80 bit floating point registers on the x87 into 8 64 bit special purpose SIMD integer registers, which are more or less powerful than the 6 general purpose integer registers depending on which way you're squinting at them.