> Date: Tue, 22 Jan 2008 16:07:27 -0800
> begin quoting Gabriel Sechan as of Tue, Jan 22, 2008 at 05:43:06PM -0600:
> >
> [snip]
> > > No, because too many registers really slow the machine down when you
> > > have a context switch or function call. All those registers have to be
> > > saved off somewhere.
> >
> > No they don't. Only the ones that will be used need to be saved on
> > function call. If you have 1000 registers, and use 5, the other 95
> > can remain untouched and unsaved. Context switches do become more
> > expensive, but they're far rarer so the cost increment isn't that much
>
> If you're using lots of registers, you have to save lots of registers.
>
> And yes, if the callee saves, it can save off *just* the registers
> it uses, and no others. For some reason I think in terms of caller
> saves, versus callee saves.
>
There's very few ABIs that use caller saves, just for this efficiency. And the
single register save is generally cheaper than the repeated stack pops/memory
writes otherwise needed. Although yes, there is diminishing returns to it.
> > This, combined with decreasing marginal utility (if you
> > have 5 registers, adding 1 more is likely to be used. If you have
> > 1000, the 1001 is unlikely to help) are the limiting factors on
> > speedup due to registers. And yes, the rule of thumb is the more
> > registers the better. Intel has 6 (eax, ebx, ecx, edx, esi, edi) and
> > its far too few. MIPS had 32. Titanium had 128.
>
> M68k had 16. How many did the VAX have?
>
> Isn't the SPARC register window 32 registers, but they can put as many
> registers on the CPU as they want?
>
Titanium had a similar idea- despite having 128 registers, it used a register
window- except the register window size was configurable, you could set any
size you wanted for each function. It did the automatic assignment of
registers and any necessary spilling to the stack.
IIRC, it had 128 fp registers as well. Intel really wanted to not have people
complain about registers this time around.
> > Large register stacks take a lot of chip space, and increase the
> > transistor count elsewhere as well. When you have limited die space,
> > you can't have everything. These days cache is more of an issue than
> > registers, but in the old days the registers were the big transistor
> > count users. Hence the 6 register intel architecture.
>
> Just one of the reasons I loathe the intel architecture.
>
Probably the best reason to. 128 was overkill, but 6 is annoyingly small.
16-32 is about right IMO.
Gabe
_________________________________________________________________
Climb to the top of the charts! Play the word scramble challenge with star
power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg