Re: Code optimization <LEA Instruction>

From: Marc Lehmann (marc@gimp.org)
Date: Fri Jan 28 2000 - 14:27:24 EST


On Fri, Jan 28, 2000 at 01:15:22PM +0100, Jamie Lokier <lkd@tantalophile.demon.co.uk> wrote:
> Richard B. Johnson wrote:
> > The following program clearly shows that many more 'addl' instructions
> > may be executed than 'leal' instructions within a given time.

The point of Alan and about everybody else is that this code does not
occur in practise. leal simply *is* faster, overall, even if the compiler
always chose leal over addl.

> Pentiums and 486s. See _any_ 486 or Pentium optimisation book... AGI
> is an important scheduling detail. I think modern GCC knows about it
> and schedules accordingly.

Modern gcc has indeed imrpoved a lot on this. It still does not decide the
use of lea vs. add based on functional units, though. As it is now, it
favours addl over leal in cases these are equivalent (leal does not clobber
cc), and uses leal in all other cases.

This is an overall win.

> Certainly, PGCC does.

pgcc indeed tries to catch the most common AGI occurrences, a technique
only effective on pentiums, though (the problem on pentiumpro and above
is much less severe, and the code sequences to exploit that are totally
different).

-- 
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       pcg@opengroup.org |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:22 EST