This is the mail archive of the
mailing list for the GCC project.
Re: Optimizations and gcc
- From: law at redhat dot com
- To: "Scott Robert Ladd" <scott at coyotegulch dot com>
- Cc: "Gcc at Gnu dot Org" <gcc at gnu dot org>
- Date: Thu, 09 May 2002 11:56:16 -0600
- Subject: Re: Optimizations and gcc
- Reply-to: law at redhat dot com
In message <FKEAJLBKJCGBDJJIPJLJMEOKCFAA.firstname.lastname@example.org>, "Scott Robert
> I've been testing various combinations of options with gcc 3.0.4.
> The documentation is, to me, misleading. For example, it states that
> "`-O2' turns on all optional optimizations except for loop unrolling,
> function inlining, and register renaming."
> "`-O3' turns on all optimizations specified by `-O2' and also turns on the
> `-finline-functions' and `-frename-registers' options."
> The above is not entirely correct, and it certainly leaves out important
> detail. Which specific options *do* -O2 and -O3 enable? When -O2 states
> "all... except for", I assume it is beging very specific -- and it isn't!
Unfortunately a number of options have been added over time, some of which
enable/disable experimental features or features which are not necessarily
useful to most developers. The documentation hasn't necessarily been kept
up to date.
> For example: Does -O2 imply the -fomit-frame-pointer option?
It depends on the target. For targets where -fomit-frame-pointer does not
impede debugging, it is enabled by default. Unfortunately, you have to
know quite a bit about the processor, the ABI and the GCC/GDB implementation
to know if -fomit-frame-pointer is likely to impede debugging.
Also be aware that certain options are generally considered outside the control
of the various -O switches. They typically include options which control
the instruction set used and the scheduling parameters.
For your system you may get better performance with -march=i686 -mcpu=i686
which tells the compiler that it can assume you have conditional move
instructions and that it should optimize for the PPro/P2/P3 line of