[comp.arch] 386 and ugliness

rcd@ico.isc.com (Dick Dunn) (05/30/90)

ian@sibyl.eleceng.ua.OZ (Ian Dall) writes:

>...Raises an interesting point. Mightn't the 386 lack of (many) registers
> limit the potential gains from a global optimiser?

This is sort of shooting-from-the-hip, but I think the few registers on the
386 and the many special-purpose uses of registers and special rules for
registers tend to offer more possible gains from "serious" optimization.
(Here, "serious" == "makes your stomach hurt to think about debugging the
optimizer.":-)

The straightforward approach to compilation for the 386 is to treat it as a
single-accumulator machine, with (e)ax and (e)dx being of most interest.
You either ignore the other registers or only use them in particular code
sequences where definition and use are bounded by the particular chunk of
code you're emitting; you consider them dead outside these little chunks.

Relative to this simplistic approach, what a global optimizer might do with
a lot more work is take account of the special uses of various registers
and try to use them for intermediate/scratch values where possible.  It's
appealing because you can stay out of memory or off the stack more often.
It's unappealing because it's hard to make a nice general model out of all
the special cases.  Also, gut reaction is that it's a lot of stuff that's
only interesting for the 386.  A more regular architecture doesn't need
it.

> ... I think it is the duty of
> every knowledgable person to give Adam whatsisname's hand a little
> nudge in the right direction when we can...

Adam Smith's hand is moved by money!

> ... People that
> design elegantly deserve encouragement!

Sure...all else being equal (which it never is).  If I can buy a little
elegance with a little more money, I'll buy it.  Who knows; things might
even work better in the long run.  But if the 386 is so inelegant (which I
don't question, BTW) and clumsy to work with, why is it so cost-effective?
Why can't there be systems based on other processors that have something
comparable to offer at the low end?  (Yeah, we've been through all the
stuff about marketing and IBM and DOS...but does elegance give an edge
somewhere?)
-- 
Dick Dunn     rcd@ico.isc.com    uucp: {ncar,nbires}!ico!rcd     (303)449-2870
   ...Simpler is better.

torbenm@gere.diku.dk (Torben [gidius Mogensen) (05/30/90)

rcd@ico.isc.com (Dick Dunn) writes:


> Sure...all else being equal (which it never is).  If I can buy a little
> elegance with a little more money, I'll buy it.  Who knows; things might
> even work better in the long run.  But if the 386 is so inelegant (which I
> don't question, BTW) and clumsy to work with, why is it so cost-effective?
> Why can't there be systems based on other processors that have something
> comparable to offer at the low end? 

There ARE systems based on vastly more elegant processors that offer
much power at low cost. Acorns Archimedes range uses Acorns own RISC
processor ARM, which was designed with cost-effectiveness as one of the
major considerations. The instruction set is very elegant and as the
processor was designed to work fast with slow memory, systems are very
cheap. A system with speed comparable to 24MHZ 386 based systems can
be bought for about 700 pounds.

	Torben Mogensen (torbenm@diku.dk)

Disclaimer: I have no connection with Acorn, except being owner of an
Acorn machine.