LDD/STD Optimizations

pardo@cs.washington.edu (David Keppel)
Tue, 3 Mar 1992 18:50:34 GMT

          From comp.compilers

Related articles
LDD/STD Optimizations pardo@cs.washington.edu (1992-03-03)
Re: LDD/STD Optimizations idacrd!desj@uunet.UU.NET (1992-03-09)
Re: LDD and STD on RISC rcg@lpi.liant.com (1992-03-09)
Re: LDD/STD Optimizations pardo@cs.washington.edu (1992-03-10)
Re: LDD/STD Optimizations preston@dawn.cs.rice.edu (1992-03-10)
Re: LDD/STD Optimizations idacrd!desj@uunet.UU.NET (1992-03-11)
| List of all articles for this month |

Newsgroups: comp.compilers
From: pardo@cs.washington.edu (David Keppel)
Keywords: optimize, architecture
Organization: Computer Science & Engineering, U. of Washington, Seattle
Date: Tue, 3 Mar 1992 18:50:34 GMT

Preston and I have been having an e-mail discussion about the use of
LDD and STD. He's brought up some good points, so with his permission
here's a summary. Everything is paraphrased.

    Code replication can work. But if there's more than one array
    refernced in a loop we'll see exponential explosion (exponential
    in the number of things that must be aligned).

    But you can have code for the general case and code for the all-
    things-are-aligned cases and none of the rest:

        if (aligned(a) && aligned(b) && ..) {
            ... use ldd ...
        } else {
            ... don't use ldd ...

    I believe most arrays will be double-aligned. `malloc' returns
    double-aligned memory and the compiler can be told to allocate
    stack arrays on double boundaries. If most arrays are aligned,
    then the ``everything is aligned'' code will be used most of the

    Maybe I'm just overly used to FORTRAN, but I see a lot of code
    where unaligned array slices or odd-size columns get passed.

    Another issue is safety. To use LDD, unroll and jam. If there
    are any stores in the loop body you need to ensure the store in
    iteration I doesn't store to a location that might be one used in

    The two-versions trick is like procedure cloning. We're looking at
    it for sharper interprocedural information for constants, aliasing,
    and alignment.

    It might be worth doing a brief instrumentation study using an

a[x] => (dump (1234, &a[0], &a[x], sizeof(&a[0])), a[x])

    Using LDD/STD for save/restore at calls is easy. Other places are

    True. In current codes, though, calls are substantial overhead.

    What about `ldq/stq'? Are they worth puttig in the architecture?
    Maybe we can relax the LDD/STD alignment constraints.

    You have to repeat the analysis and see if it's valuable.

    My guess is that you'll find LDQ/STQ aren't so useful.

    The hardware people (includes me) will argue that relaxing the
    alignment constraints makes slower and/or more complicated
    implementations. Using LDD/STD only when you can guarantee
    static alignment will still lead to perf. improvements.

    Some (not me; I don't have the data to know) will argue that the
    alignment-required implementation is enough faster or sooner to
    market that the reduction in general utility is justified.

    It's not that the problems are insurmountable; but they're all
    good reasons you don't generally see this code emitted today.

Thanks, Preston!

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.