This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: stack manipulations in gcc-2.95.2
- To: jacob at jacob dot remcomp dot fr
- Subject: Re: stack manipulations in gcc-2.95.2
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Wed, 12 Jan 2000 00:01:41 -0700
- cc: gcc-bugs at gcc dot gnu dot org
- Reply-To: law at cygnus dot com
In message <m1284xO-000Y2gC@jacob.remcomp.fr>you write:
> Hi
>
> I have noticed that very often gcc generates code like:
> addl $-8,%esp
> pushl arg1
> pushl arg2
> call something
> ...
> addl 32,%esp
> instead of the sequence used in most compilers:
> pushl arg1
> pushl arg2
> call something
> addl $8,%esp
> that is 3 bytes shorter!
Generally the compiler does. However, there are some circumstances where
it can't (due to phase ordering issues).
> To make things worst, there are often sequences like:
> addl $32,%esp
> addl $-4,%esp
> addl $-8,%esp
> instead of combining this into
> addl $20,%esp
> saving 6 bytes.
I'd like to see sample code for this one. Again, due to phase ordering
issues it is possible to get a pair of stack pointer adjustments back
to back, but they're rare.
> This is not a bad idea, but I am very skeptical if the code bloat that
> this produces doesn't largely offset any possible gains for cache
> alignment.
Getting stack alignment right can mean a factor of 2 or more for FP intensive
code on modern ia32 machines as measured by standard benchmarks like Spec.
jeff