This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Optimizations and gcc

In message <>, "Scott Robert 
Ladd" writes:
 > 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."
 > and
 > "`-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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]