public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: abysmal code generated by gcc-3.2
@ 2002-10-21  1:06 Brad Lucier
  2002-10-21  4:41 ` Denys Duchier
  0 siblings, 1 reply; 2+ messages in thread
From: Brad Lucier @ 2002-10-21  1:06 UTC (permalink / raw)
  To: denys.duchier; +Cc: Brad Lucier, gcc

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: abysmal code generated by gcc-3.2
  2002-10-21  1:06 abysmal code generated by gcc-3.2 Brad Lucier
@ 2002-10-21  4:41 ` Denys Duchier
  0 siblings, 0 replies; 2+ messages in thread
From: Denys Duchier @ 2002-10-21  4:41 UTC (permalink / raw)
  To: gcc

Brad Lucier <lucier@math.purdue.edu> writes:

> so perhaps you can try adding -fno-gcse.

unfortunately (as I indicated in my previous email) I tried it and it
turned out to produce worse results.  The best I managed was by
selectively preventing inlining and declaring one variable
volatile. -fno.gcse is too coarse. What I really need is a way to
prevent the compiler from trying so hard to keep these useless values
in registers (er.. the values are not useless, but the "keeping them
in registers" is).

Cheers,

-- 
Dr. Denys Duchier			Denys.Duchier@ps.uni-sb.de
Forschungsbereich Programmiersysteme	(Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45	http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50			Phone: +49 681 302 5618
66041 Saarbruecken, Germany		Fax:   +49 681 302 5615

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-10-20 22:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-21  1:06 abysmal code generated by gcc-3.2 Brad Lucier
2002-10-21  4:41 ` Denys Duchier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).