pro64-support
[Top] [All Lists]

Re: about LNO

To: pro64-support@xxxxxxxxxxx
Subject: Re: about LNO
From: David L Stephenson <dlstephe@xxxxxxx>
Date: Wed, 13 Sep 2000 11:08:59 -0400
Organization: Strategic Software Organization -- Compilers
References: <01C01CD6.A4E64F70.tu@xxxxxxxxxxxxx>
Sender: owner-pro64-support@xxxxxxxxxxx
Peng Tu wrote:

> For this C program, I don't see why it is beneficial to interchange
> the loop because the inner loop is already stride-1 (C is row-major).

Interchanging the loops allows one of the array loads to be removed:

        for (i=1; i<1000; i++)
          for (j=1; j<1000; j++)
            a[i][j] = a[i][j] + a[i-1][j];

becomes

        for (j=1; j<1000; j++) {
          t = a[i][0];
          for (i=1; i<1000; i++) {
            a[i][j] = t = a[i][j] + t;
        }

But see Ross Towle's response.

-- 
David Stephenson        http://reality.sgi.com/dlstephe_engr/

<Prev in Thread] Current Thread [Next in Thread>