public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Loop optimisation
@ 1997-11-04 19:30 Michael P. Hayes
  0 siblings, 0 replies; only message in thread
From: Michael P. Hayes @ 1997-11-04 19:30 UTC (permalink / raw)
  To: egcs

I've noticed that GCC poorly optimises the following loops:

void foo(const float *src, float *dst, int size, int offset)
{
    int i;

    for (i = 0; i < size; i++)
      dst[i + offset] = src[i];
}

where the loop RTL of interest after CSE is

  (set (reg:SI 43) (plus:SI (reg/v:SI 40) (reg/v:SI 42)))
  (set (reg:SI 44) (plus:SI (reg/v:SI 37) (reg:SI 43)))
  (set (mem/s:SF (reg:SI 44)) (reg:SF 45))

where 40 is i, the induction variable pseudo
      42 is offset
      37 is &dst 

Ideally, the redundant address calculations should be hoisted out of
the loop.  Is this within the scope of the current loop optimiser?

Michael.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-11-04 19:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-04 19:30 Loop optimisation Michael P. Hayes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).