[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Yes, they are special, but...



    Date: Wed, 21 Jun 89 16:20 EDT
    From: barmar@Think.COM (Barry Margolin)

	Date: Wed, 21 Jun 89 09:12 PDT
	From: Richard Lamson <rsl@max-fleischer.ila-sf.dialnet.symbolics.com>

	    Date: Mon, 19 Jun 89 19:34 EDT
	    From: barmar@Think.COM (Barry Margolin)

	    If the CASE statement you're talking about looks something like

		    (case <expression>
		      (0 ...)
		      (1 ...)
		      ...
		      (t ...))

	    then the 3600 compiler will compile this into a computed go (I believe
	    this was introduced in Genera 7.1 or 7.2).  It does this when all the
	    keys are non-negative integers and the key space isn't too sparse (more
	    than half of the keys from 0 to the largest key are used).  

	Have you tried this on a machine with an IFU (including, I think, the G
	machines)?

    The 3600 compiler doesn't distinguish between different models of 3600,
    so this transformation is guaranteed to take place on a machine with an
    IFU, too.  If you're asking whether this actually improves performance
    on IFU machines, I have no idea -- I'd expect that metering to have been
    done by Symbolics before installing it.

    I don't know much about the design of the IFU, but I can certainly
    imagine how it might be able to speed up the COND version of the
    expansion.  If it prefetches conditional branch targets in parallel with
    the condition computation and test, then a series of COND tests can be
    optimized rather well.  The %DISPATCH-ELT presumably can't prefetch all
    the potential targets.

Exactly, and this is also why Ivory doesn't generally do dispatches.
The basic issue is that a branch instruction makes information about the
target PC available to earlier pipeline stages than a dispatch does.

			    Clearing the instruction cache, however, seems
    pretty drastic.

I don't know where this came from, it's not true.

There's one possible performance hit, though, which is that the
branch-and-test code favors the initial clauses, whereas a dispatch
takes the same amount of time for each clause.  Ivory, and to a lesser
extent IFU 3600s, can do quite a few branch-and-tests in the time it
takes to do a dispatch.

    It probably depends heavily on the number of cases, the amount of code
    in each case (i.e. host many cases fit into the I-cache), and which are
    the more common cases (if the later cases are more common, dispatching
    is probably faster than COND).

    Finally, since there's only one 36xx compiler, it's necessary to make
    compromises when open coding.  It might be useful to have a switch that
    specifies the model of most of the target machines of a compilation, so
    that it can perform optimizations best suited to that implementation.  I
    don't know how many such differences there are, though, so I don't know
    how much payoff there would be for such a compiler feature.

						    barmar