This is the mail archive of the gcc@gcc.gnu.org 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: abysmal code generated by gcc-3.2


You can find the following in the documentation file gcc.info-4:

> `-O2'
>      Optimize even more.  GCC performs nearly all supported
>      optimizations that do not involve a space-speed tradeoff.  The
>      compiler does not perform loop unrolling or function inlining when
>      you specify `-O2'.  As compared to `-O', this option increases
>      both compilation time and the performance of the generated code.
> 
>      `-O2' turns on all optional optimizations except for loop
>      unrolling, function inlining, and register renaming.  It also
>      turns on the `-fforce-mem' option on all machines and frame
>      pointer elimination on machines where doing so does not interfere
>      with debugging.
> 
>      Please note the warning under `-fgcse' about invoking `-O2' on
>      programs that use computed gotos.
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> `-O3'
>      Optimize yet more.  `-O3' turns on all optimizations specified by
>      `-O2' and also turns on the `-finline-functions' and
>      `-frename-registers' options.

and

> `-fgcse'
>      Perform a global common subexpression elimination pass.  This pass
>      also performs global constant and copy propagation.
> 
>      _Note:_ When compiling a program using computed gotos, a GCC
>      extension, you may get better runtime performance if you disable
>      the global common subexpression elmination pass by adding
>      `-fno-gcse' to the command line.
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You write

> PS: the compiler options used for the emulator file are:
> 
> -fno-exceptions -O3 -pipe -fstrict-aliasing -march=pentium -mcpu=pentiumpro -fomit-frame-pointer

so perhaps you can try adding -fno-gcse.

Brad Lucier


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