Optimisation Oddities in gcc 2.95.3

John Summerfield summer@os2.ami.com.au
Fri May 18 08:02:00 GMT 2001


First, it is almost certainly not the released version of gcc 2.95.3. 
According to the rpm I built and installed on Red Hat Linux 6.2 it's 
gcc-2.95.3-0.20000517.

I have a program based on one extracted from the Unix Review article at 
http://www.unixreview.com/articles/1997/9710/9710expbi/expbi.htm

However, I decided to use it to test a little of gcc-s optimisation, 
and perhaps to compare it with C compilers on other software platforms.

The times reported by the "time" command of bash were not what one 
would expect. Here is a sorted table showing relevant optimisation 
options and the CPU time used in running the test:
summer@possum compilerbenchmark]$ ./buildit | sort -k3
Optimisations=-O3 -march=i486      cputime=46.84s
Optimisations=-O3 -march=k6        cputime=47.55s
Optimisations=-O3 -march=i686      cputime=47.74s
Optimisations=-O3 -march=i586      cputime=47.82s
Optimisations=-O3 -march=i386      cputime=48.04s
Optimisations=-O0 -march=i586      cputime=48.35s
Optimisations=-O0 -march=i386      cputime=48.50s
Optimisations=-O0 -march=i686      cputime=48.97s
Optimisations=-O0 -march=k6        cputime=49.45s
Optimisations=-O0 -march=i486      cputime=49.77s
Optimisations=-Os -march=i386      cputime=65.73s
Optimisations=-Os -march=i686      cputime=66.31s
Optimisations=-O2 -march=i586      cputime=66.45s
Optimisations=-O1 -march=k6        cputime=66.53s
Optimisations=-O2 -march=i686      cputime=66.85s
Optimisations=-Os -march=i586      cputime=66.99s
Optimisations=-O1 -march=i686      cputime=67.00s
Optimisations=-O1 -march=i586      cputime=67.65s
Optimisations=-O2 -march=k6        cputime=67.76s
Optimisations=-O2 -march=i386      cputime=67.95s
Optimisations=-Os -march=k6        cputime=68.11s
Optimisations=-O1 -march=i486      cputime=68.37s
Optimisations=-Os -march=i486      cputime=68.46s
Optimisations=-O1 -march=i386      cputime=68.55s
Optimisations=-O2 -march=i486      cputime=70.49s
[summer@possum compilerbenchmark]$

The test is run on a Pentium II, 233 Mhz. It seems odd to me that code 
compiled for the i486 is faster than for any other processor. It's fair 
to say I find the whole set weird.

The code and script I use to run the program combine so that the 
program can easily report relevant compiler options.

They are attached for you to peruse and evaluate.




More information about the Gcc-bugs mailing list