This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Two other optimization questions.
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Subject: Re: Two other optimization questions.
- From: Jeffrey A Law <law at upchuck dot cygnus dot com>
- Date: Wed, 07 Apr 1999 02:55:47 -0600
- cc: egcs at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <370A63DC.D94F2DF7@moene.indiv.nluug.nl>you write:
> L.S.,
>
> 1. Last week, for the umpteenth time, I had to explain that g77 -O9
> looks very impressive, but it doesn't perform a rather important
> optimization that most other (Fortran) compilers provide at -O3,
> namely loop unrolling.
>
> Loop unrolling, like function inlining, is an optimization that
> favors running time over code size; so they more or less "belong
> together". Wouldn't it be intuitive to *both* enable them by
> default when -O3 is specified ?
Actually I want to see a few things happen in this area:
1. Allow some loops to be unrolled at -O2/-O3. Specifically those
which don't bloat the code too much and which we are confident
will win when unrolled.
Basically I'm thinking about single block loops which can be
trivially unrolled.
2. Turn on more aggressive unrolling at higher optimization levels,
-O3 or -O4.
On a related note, we may want to take this opportunity to make
some room in the -On options to add some more expensive
optimizations at -O3 and push aggressive unrolling & inlining
into -O4.
3. We've got at least one serious unrolling bug that needs to be fixed
before we can really do #1 or #2. We can't even bootstrap with the
unroller enabled on some platforms.
> 2. Unless specifying -ffast-math, on systems with a sqrt instruction,
> the following code is generated:
>
> Perform sqrt instruction.
> Test result for x != x (NaN-ness)
> Jump around following code if OK
> Call library sqrt routine to set errno
> Continue here.
>
> This is a bit sad for code generated by a Fortran compiler, where
> errno doesn't play a role (the programmer is supposed to know what
> s/he's doing - where have I read that before ? :-)
>
> Would it be possible to implement a test settable by a Front End
> that no errno setting is called for by its language ?
Hmmm. Yes, we're trying to be ANSI/ISO compliant. Not it's not just errno,
but the matherr handling by ANSI/ISO which mandates this behavior.
This probably isn't appropriate for Fortran ;-) I've got no objection to
some way for the backend to influence this code. I do wonder what the Fortran
standards say about the behavior of sqrt (-1).
jeff