From: eoahmad@ntuix.ntu.ac.sg (Othman Ahmad)
Subject: Software redundancy tests
Organization: Nanyang Technological University - Singapore
X-Newsreader: Tin 1.1 PL4
Date: Wed, 9 Sep 1992 03:13:20 GMT

I have conducted tests on a DEC5000 Ultrix mips machine.

Since I am porting gcc-1.41 and had ported gcc-2.2.2, I though I may as 
well do tests on the various available compilers, gcc-2.2.2, risc C, and
gcc-141:

I do not know which source is used by Specmark to test gcc so I just 
chose dhryston-1.1 source as the benchmark.
	I'm only testing cc1 because this is the code generation part of gcc,
and it is not easy to remove redundancies from a compiler because there is
little invariant code. cc1 is an example of intelligent, low redundancy
software.
	On the other hand dhryston-1.1 is a synthetic program which was 
designed to use the data and program structures thought to be more commonly
used. Because there is no work to be done, theoretically, it is possible to
compile it to nothing but the code to display time.

REsults:
 
 cc1-$1 tmp.cpp -O2 -quiet -dumpbase dhry-1.1.c -version -o tmp.s
 /usr/users/othman/lib/gcc-lib/mips-dec-ultrix/2.2.2/cpp -lang-c -v -undef -D__GNUC__=2 -D__ANSI_COMPAT -DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -Dbsd4_2 -Dhost_mips -Dmips -Dultrix -Dunix -D__ANSI_COMPAT -D__MIPSEL__ -D__R3000__ -D__SYSTYPE_BSD__ -D___SYSTYPE_BSD__ -D__bsd4_2__ -D__host_mips__ -D__mips__ -D__ultrix__ -D__unix__ -D__ANSI_COMPAT -D__MIPSEL -D__R3000 -D__SYSTYPE_BSD -D___SYSTYPE_BSD -D__bsd4_2 -D__host_mips -D__mips -D__ultrix -D__unix -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C dhry-1



1.c tmp.cpp
time cc1.sh gcc222 >& test1.dat
time cc1.sh gcc222-O2 >& test2.dat
time cc1.sh riscC-O2 >& test3.dat
time dhry-gcc222 >& test4.dat
time dhry-gcc222-O2 >& test5.dat
time dhry-riscC-O2 >& test6.dat
time dhry-gcc141-O >& test7.dat

GNU C version 1.41 AL-MIPS 1.1 Ultrix Dec Mips Sep  8 1992 compiled by GNU C version 2.2.2.
default target switches: -mmips-as -mnofixed-ovfl -mG0 -mG1
        1.8 real         1.0 user         0.1 sys  
GNU C version 1.41 AL-MIPS 1.1 Ultrix Dec Mips Sep  8 1992 compiled by GNU C version 2.2.2.
default target switches: -mmips-as -mnofixed-ovfl -mG0 -mG1
        1.5 real         0.8 user         0.1 sys  
GNU C version 1.41 AL-MIPS 1.1 Ultrix Dec Mips [unknown date] compiled by CC.
default target switches: -mmips-as -mnofixed-ovfl -mG0 -mG1
        1.6 real         0.8 user         0.1 sys  

Remarks:
cc1 for gcc-1.41 has some redundancy which can be removed by an optimising 
compiler. gcc-2.2.2 managed to reduce redundancy by 25%.

Dhrystone(1.1) time for 500000 passes = 22
This machine benchmarks at 21834 dhrystones/second
       36.9 real        23.1 user         0.0 sys  
Dhrystone(1.1) time for 500000 passes = 12
This machine benchmarks at 39370 dhrystones/second
       19.3 real        12.8 user         0.0 sys  
Dhrystone(1.1) time for 500000 passes = 13
This machine benchmarks at 36275 dhrystones/second
       20.4 real        13.7 user         0.0 sys  
Dhrystone(1.1) time for 500000 passes = 15
This machine benchmarks at 31413 dhrystones/second
       23.5 real        16.0 user         0.0 sys  

Remarks:
	Redundancies had been reduced by 80%.

Conclusion:

Dhryston cannot be fully optimised by existing optimising compilers,
although theoretically it should be possible to do so.

Dhryston benchmark gives an idea as to the efficiency of optimization of
a C compiler.

cc1 is less affected by optimising compilers because it is an example of an
intelligent program. It is among the most intelligent program, on par with
expert systems(?), but it may not reflect the usual pattern for other
user software.

dhryston 1.1 is the ultimate in stupid software because it actully does not
respond to any input when running. The compiler should be able to calculate
the result without any dhryston execution.
	However some user software is of this type. We just want a result so
we hard code the input into the source code, or reduce the number of 
input data required when a program runs.

To say that normal software does not have redundancy is nonsense. They all do,
as can be shown by cc1. The difference of 25% versus 80% is not so great,
when we take into account that these are extreme ends of redundancy contents.
	Common software should be between these 2 values. I may be wrong here
but not by far. For example, some unix utilities may have extremely high
redundancies, as much as 100%(just my hunch).

The next step will be to prove that dhrystons can be used to benchmark
microprocessors, to a certain degree of confidence.
	I'll be using gcc-2.2.2 because I have both of them in different
machines. They are not exactly similar because the code to be generated are
different. It makes us question the suitability of gcc as a benchmark.
	However because we are supposed to use gcc one way or another, this
may be a fair assumption.

Comments are very  appreciated. I'm sure there are some mistakes. 

--
Othman bin Ahmad, School of EEE,
Nanyang Technological University, Singapore 2263.
Internet Email: eoahmad@ntuix.ntu.ac.sg
Bitnet Email: eoahmad@ntuvax.bitnet