delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/18/17:02:24

From: buers AT gmx DOT de (Dieter Buerssner)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: gcc optimization (Was: Executable size: limit to acceptability?)
Date: 18 Jan 2000 16:12:19 GMT
Lines: 53
Message-ID: <8623d1$26n4p$1@fu-berlin.de>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000117161103 DOT 23941A-100000 AT is> <85vmml$23rse$1 AT fu-berlin DOT de>
NNTP-Posting-Host: a1as05-p111.stg.tli.de (195.252.187.111)
Mime-Version: 1.0
X-Trace: fu-berlin.de 948211939 2317465 195.252.187.111 (16 [17104])
X-Posting-Agent: Hamster/1.3.8.0
User-Agent: Xnews/2.11.08
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

[ I wrote about weird optimization behaviour of gcc ]
>public available ones. I.e. my chess engine was about 20% slower
>when compiled with 2.8 versions of gcc, compared to gcc 2.7.3.
I actually meant 2.6.3 instead of 2.7.3

Eli suggested in an email reply, that I should show some 
numbers.

My CPU is AMD K6-2 266.
Results are Nodes/sec for my chess-engine (reproducible to +/- 20)
There is virtually no time used in libraries. All sources are 
plain C, not C++.  

Test were run under msdos without windows loaded.

First an almost ancient version of gcc.
gcc 2.6.3: flags -fomit-frame-pointer -ffast-math + indicated flags
(the -ffast-math flag reall has no effect)

             -On -m486
-O   98538       95302
-O2 100712       94826
-O3  85033       93219

Here the fastest seems to be -O2. When I still had my 486 running
-O -m486 was fastest, but almost equal to -O only. -O2 was slightly
slower.

gcc 2.9.2: flags -fomit-frame-pointer -ffast-math + indicated flags

          -On -mcpu=k6  -On -march=k6
-O   86383       92070          92070
-O2  85852       86966          87009
-O3  81476       89791          89814
-O6  81421       89833          89818

In all three cases -O produces the fastest code. Whether I use
-mcpu=k6 (should produce optimized code for K6, while still
running on 386) or -march=k6 (may produce upcodes, that are
only available on K6) seems not to matter.

The produced code runs slower than code produced with gcc 2.6.3!
The same was true for my old 486 66 and 386SX when comparing
newer versions of gcc with 2.6.3.

I think, that the same results could be obtained on linux,
but I donīt have an old version of gcc for linux.

My conclusion is, to useally use -O only, and to still have
an old version of gcc around.

Regards,
  Dieter

- Raw text -


  webmaster     delorie software   privacy  
  Copyright Đ 2019   by DJ Delorie     Updated Jul 2019