[comp.arch] Dhrystone Benchmark, Ada Version 2.1

wck353@estevax.UUCP (HrDr Weicker Reinhold ) (02/11/89)

The following is a "shar" file containing the Dhrystone benchmark,
Ada version 2.1.
I am posting it to both comp.arch and to comp.lang.ada because
- this is the Ada version, obviously suited for comp.lang.ada, but
- Dhrystone sources and results have traditionally been posted to comp.arch
- the readerships of the two newsgroups are probably sufficiently disjoint
For more information, read the README_A and RATIONALE files. - Reinhold Weicker

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	RATIONALE
#	README_A
#	d_global.s
#	d_main.b
#	d_pack_1.b
#	d_pack_1.s
#	d_pack_2.b
#	d_pack_2.s
#	dhry_c.dif
#	submit.frm
# This archive created: Sat Feb 11 11:19:58 1989
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'RATIONALE'
then
	echo shar: "will not over-write existing file 'RATIONALE'"
else
cat << \SHAR_EOF > 'RATIONALE'

    Dhrystone Benchmark (Ada Version 2): Rationale and Measurement Rules


                 Reinhold P. Weicker
                 Siemens AG, E STE 35
                 Postfach 3220
                 D-8520 Erlangen
                 Germany (West)




1.  Why a Version 2 of Dhrystone?

The Dhrystone benchmark  program  [1]  has  become  a  popular  benchmark  for
CPU/compiler   performance   measurement,   in   particular  in  the  area  of
minicomputers, workstations, PC's and microprocesors.  It apparently satisfies
a  need  for  an  easy-to-use  integer benchmark; it gives a first performance
indication which is more meaningful than MIPS numbers which, in their  literal
meaning  (million  instructions  per  second), cannot be used across different
instruction sets (e.g. RISC  vs.  CISC).   With  the  increasing  use  of  the
benchmark, it seems necessary to reconsider the benchmark and to check whether
it can still fulfill this function.  Version 2 of Dhrystone is the  result  of
such a re-evaluation, it has been made for two reasons:

o As far as it is  possible  without  changes  to  the  Dhrystone  statistics,
  optimizing   compilers   should   be  prevented  from  removing  significant
  statements.  It has  turned  out  in  the  past  that  optimizing  compilers
  suppressed  code  generation for too many statements (by "dead code removal"
  or  "dead  variable  elimination").   This  has  lead  to  the  danger  that
  benchmarking  results obtained by a naive application of Dhrystone - without
  inspection of the code that was generated - could become meaningless.

o Dhrystone has been published in Ada [1], and versions in Ada, Pascal  and  C
  have  been  distributed  by  Reinhold Weicker via floppy disk.  However, the
  version that was used most often for benchmarking has been the version  made
  by  Rick  Richardson  by another translation from the Ada version into the C
  programming language, this has been the version  distributed  via  the  UNIX
  network Usenet [2].

  There has been an obvious need for a common C version of Dhrystone,  and  in
  the  process of publication of a version 2 for C [3], it became necessary to
  update the Ada version as well.  There should be, as far as  possible,  only
  one  version  of  Dhrystone  per  language such that results can be compared
  without restrictions.  In order to  allow  cross-language  comparisons,  the
  Ada,  Pascal,  and  C versions should be maintained together; they have been
  updated for version 2.1 in a consistent way.

Dhrystone uses only the "Pascal subset" of Ada, it cannot be used  to  measure
the  efficiency  of  implementation  for  Ada-specific  features like tasking,
generics etc.  However, often the "Pascal subset" language  features  will  be
the  ones  most often used in practical programs; so it is not unreasonable to
have a benchmark program that is restricted  to  these  features.   Experience
with previous measurements has shown that a common prejudice "Ada programs run
slower than programs written in other languages" is not true: While  the  very
first  Ada  compilers  sometimes  generated  slow code, this does not hold any
longer for the present generation of Ada compilers. If correct comparisons are
made  (i.e.  Ada  runtime  checks disabled for comparison with other languages
that do not have runtime checks), it turns out that Ada compilers can generate
code  that  is  as  fast  as  the code generated from other languages, or even
faster.

The  overall  policiy  for  version  2  has  been  that  the  distribution  of
statements,  operand types and operand locality described in [1] should remain
unchanged as much as possible.  (Very few changes were necessary; their impact
should be negligible.)  Also, the order of statements should remain unchanged.
Although I am aware of some critical remarks on the benchmark - I  agree  with
several  of them - and know some suggestions for improvement, I didn't want to
change the benchmark into something different from what has  become  known  as
"Dhrystone"; the confusion generated by such a change would probably outweight
the benefits. If I were to write a new benchmark program, I wouldn't  give  it
the  name  "Dhrystone"  since  this  denotes  the  program  published  in [1].
However, I do recognize  the  need  for  a  larger  number  of  representative
programs  that can be used as benchmarks; users should always be encouraged to
use more than just one benchmark.

The new versions (version 2.1 for Ada, Pascal and C) will  be  distributed  as
widely  as possible.  (Version 2.1 differs from the C version 2.0 published in
[3] only in a few corrections for minor deficiencies found by users of version
2.0.)   Readers  who  want to use the benchmark for their own measurements can
obtain a copy in machine-readable form on floppy disk (MS-DOS or XENIX format)
from the author.


2.  Overall Characteristics of Version 2

In general, version 2  follows  -  in  the  parts  that  are  significant  for
performance  measurement,  i.e.   within  the  measurement loop - the original
(Ada) version.  The original publication of  Dhrystone  did  not  contain  any
statements  for  time measurement since they are necessarily system-dependent.
However, it turned out that  it  is  not  enough  just  to  inclose  the  main
procedure  of  Dhrystone  in a loop and to measure the execution time.  If the
variables that are computed are not used somehow, there is the danger that the
compiler considers them as "dead variables" and suppresses code generation for
a part of the statements. Therefore in version 2 all variables are printed  at
the  end  of  the  program.  This  also  permits some plausibility control for
correct execution of the benchmark.

At several places in the benchmark, code has been added, but only in  branches
that  are  not  executed. The intention is that optimizing compilers should be
prevented from moving code out of the measurement loop, or from removing  code
altogether.  Statements that are executed have been changed in very few places
only.  In these cases, only the role of some operands has been changed, and it
was   made  sure  that  the  numbers  defining  the  "Dhrystone  distribution"
(distribution of statements, operand types and locality) still hold as much as
possible.   Except for sophisticated optimizing compilers, execution times for
version 2.1 should be the same as for previous versions.

Because of the self-imposed limitation that the order and distribution of  the
executed  statements  should  not  be  changed,  there  are  still cases where
optimizing compilers may not generate code for some statements. To  a  certain
degree,  this  is  unavoidable  for  small synthetic benchmarks.  Users of the
benchmark are advised to check code listings whether code is generated for all
statements of Dhrystone.

Contrary to the suggestion in the published paper and its realization  in  the
versions previously distributed, no attempt has been made to subtract the time
for the measurement loop overhead. (This calculation has proven  difficult  to
implement  in  a  correct  way,  and  its omission makes the program simpler.)
However, since the loop check is now part of the benchmark, this does have  an
impact  -  though a very minor one - on the distribution statistics which have
been updated for this version.


3.  Discussion of Individual Changes

In this section, all changes are described that affect  the  measurement  loop
and  that  are  not  just renamings of variables. All remarks refer to the Ada
version; the other language versions have been updated similarly.

In addition to adding  the  measurement  loop  and  the  printout  statements,
changes have been made at the following places:

o In procedure "Proc_0", three statements have been added in the  non-executed
  "then" part of the statement

        if Enum_Loc = Pack_2.Func_1 (Char_Index, 'C')

  they are

        String_Loc_2 := "DHRYSTONE PROGRAM, 3'RD STRING";
        Int_Loc_2 := Run_Index;
        Int_Glob := Run_Index;

  The string assignment prevents  movement  of  the  preceding  assignment  to
  String_Loc_2  (5'th statement of "Proc_0") out of the measurement loop (This
  happened with another language and compiler.)  The assignment  to  Int_Loc_2
  prevents  value  propagation  for  Int_Loc_2, and the assignment to Int_Glob
  makes the value of Int_Glob possibly dependent from the value of Run_Index.

o In the three arithmetic computations at the end of the measurement  loop  in
  "Proc_0  ",  the  role  of some variables has been exchanged, to prevent the
  division from just cancelling out the multiplication as it was  in  [1].   A
  very   smart  compiler  might  have  recognized  this  and  suppressed  code
  generation for the division.

o For Proc_2, no code has been changed, but the values of the actual parameter
  have changed due to changes in "Proc_0".

o In Proc_4, the second assignment has been changed from

        Bool_Loc := Bool_Loc or Bool_Glob;

  to

        Bool_Glob := Bool_Loc or Bool_Glob;

  It now assigns a value to a global variable  instead  of  a  local  variable
  (Bool_Loc);   Bool_Loc  would  be  a  "dead  variable"  which  is  not  used
  afterwards.

o In Func_1, the statement

        Pack_1.Char_Glob_1 := Char_Loc_1;

  was added in the non-executed "else" part of the "if" statement, to  prevent
  the suppression of code generation for the assignment to Char_Loc_1.

o In Func_2, the second character comparison statement has been changed to

        if Char_Loc = 'R'

  ('R' instead of 'X') because  a  comparison  with  'X'  is  implied  in  the
  preceding "if" statement.

  Also in Func_2, the statement

        Pack_1.Int_Glob := Int_Loc;

  has been added in the non-executed part of the last "if" statement, in order
  to prevent Int_Loc from becoming a dead variable.

o In Func_3, a non-executed "else" part has been added to the "if"  statement.
  While  the  program  would  not be incorrect without this "else" part, it is
  considered bad programming practice if a function  can  be  left  without  a
  return  value.  Also,  Ada requires that leaving a function without a return
  value raises an exception, and even though this exception is  never  raised,
  the presence of an exception handler may impact execution time.

  To compensate for this change, the (non-executed) "else" part  in  the  "if"
  statement of Proc_3 was removed.

The distribution statistics have been changed only  by  the  addition  of  the
measurement loop iteration (1 additional statement, 4 additional local integer
operands) and by the change in Proc_4  (one  operand  changed  from  local  to
global).  The distribution statistics in the comment headers have been updated
accordingly.


4.  String Operations

The string operations (string assignment and string comparison) have not  been
changed, to keep the program consistent with the original version.

There has been some concern, mostly from users of the C version,  that  string
operations  are  over-represented  in  the program, and that execution time is
dominated by these operations.  This was true in  particular  when  optimizing
compilers  removed  too much code in the main part of the program, this should
have been mitigated in version 2.

It should be noted that this is a  language-dependent  issue:   Dhrystone  was
first  published  in  Ada, and with Ada or Pascal semantics, the time spent in
the string operations is,  at  least  in  all  implementations  known  to  me,
considerably  smaller than in C.  In Ada and Pascal, assignment and comparison
of strings are operators defined in the language, and the upper bounds of  the
strings  occuring  in  Dhrystone  are  part  of  the type information known at
compilation time.  The compilers can therefore generate efficient inline  code
whereas  in  C,  the  string  operations  must  be expressed in terms of the C
library functions "strcpy" and "strcmp".  (This is probably  the  main  reason
why  on  most  systems known to me, the Ada and Pascal version are faster than
the C version.)

I admit that the  string  comparison  in  Dhrystone  terminates  later  (after
scanning  20  characters)  than most string comparisons in real programs.  For
consistency with the original benchmark, I didn't change the  program  despite
this weakness.


5.  Intended Use of Dhrystone

When Dhrystone is used, the following "ground rules" apply:

o Separate compilation (Ada and C versions)

  As mentioned in [1], Dhrystone was written  to  reflect  actual  programming
  practice  in  systems  programming.   The  division into several compilation
  units (5 in the Ada version, 2 in the C version)  is  intended,  as  is  the
  distribution of inter-module and intra-module subprogram calls.  Although on
  many systems there will be no difference in execution time  to  a  Dhrystone
  version  where  all  compilation units are merged into one file, the rule is
  that separate compilation should  be  used.   The  intention  is  that  real
  programming  practice,  where  programs  consist  of  several  independently
  compiled units, should  be  reflected.   This  also  has  implies  that  the
  compiler,  while  compiling  one  unit,  has no information about the use of
  variables, register allocation etc.  occuring in  other  compilation  units.
  Although  in  real  life  compilation  units  will  probably  be larger, the
  intention is that these effects  of  separate  compilation  are  modeled  in
  Dhrystone.

  A few language systems have post-linkage optimization available (e.g., final
  register allocation is performed after linkage).  This is a borderline case:
  Post-linkage  optimization  involves  additional  program  preparation  time
  (although  not  as  much  as  compilation in one unit) which may prevent its
  general use in practical programming.  I think that  since  it  defeats  the
  intentions given above, it should not be used for Dhrystone.

  Unfortunately, ISO/ANSI  Pascal  does  not  contain  language  features  for
  separate  compilation.   Although  most  commercial Pascal compilers provide
  separate compilation in some way, we cannot use it for Dhrystone since  such
  a  version  would  not  be portable.  Therefore, no attempt has been made to
  provide a Pascal  version  with  several  compilation  units.   When  Pascal
  results  are  compared with Ada or C results, it should be kept in mind that
  this difference can influence execution times.

o Results with and without runtime checks should be reported; default  results
  are those with runtime checks suppressed (Ada version)

  It is customary in benchmarking to publish only the fastest results possible
  for  the  particular  hardware/compiler  combination,  and therefore runtime
  checks are almost always disabled.  This is contrary to the  Ada  philosophy
  that the default case is the case "runtime checks enabled".  Since Dhrystone
  is often used for cross-language comparisons, and since other languages have
  either  no concept of runtime checks at all (C) or have runtime checks as an
  optional, non-standardized feature only (Pascal), default results should  be
  results  with all runtime checks suppressed.  However, Ada results should be
  reported for the case  "all  runtime  checks  enabled"  also;  a  comparison
  between  the  two  values shows how much thought the compiler implementation
  has given the idea that runtime checks should be implemented as  efficiently
  as  possible.  Dhrystone intentionally contains several statements where the
  compiler can recognize that a particular constraint is always satisfied, and
  where the corresponding constraint checks can be suppressed.

o No procedure merging (no pragma "inline")

  Although Dhrystone contains some very short procedures where execution would
  benefit  from  procedure  merging (inlining, macro expansion of procedures),
  procedure merging is not to be used.  The reason is that the  percentage  of
  procedure  and  function  calls  is  part of the "Dhrystone distribution" of
  statements contained in [1].  This restriction does not hold for the  string
  functions  of  the  C  version  since ANSI C allows an implementation to use
  inline code for these functions.

o Other optimizations are allowed, but they should be indicated

  It is often hard to draw an exact line between "normal code generation"  and
  "optimization"  in  compilers:  Some compilers perform operations by default
  that are invoked in other compilers only  when  optimization  is  explicitly
  requested.  Also, we cannot avoid that in benchmarking people try to achieve
  results that look as good as possible.  Therefore,  optimizations  performed
  by  compilers  -  other  than  those  listed  above - are not forbidden when
  Dhrystone execution times are measured.  Dhrystone is  not  intended  to  be
  non-optimizable  but  is  intended  to  be  similarly  optimizable as normal
  programs.   For  example,  there  are  several  places  in  Dhrystone  where
  performance   benefits   from   optimizations   like   common  subexpression
  elimination, value  propagation  etc.,  but  normal  programs  usually  also
  benefit  from  these  optimizations.   Therefore,  no  effort  was  made  to
  artificially  prevent  such  optimizations.   However,  measurement  reports
  should  indicate  which  compiler  optimization  levels  have been used, and
  reporting results with different levels of  compiler  optimization  for  the
  same hardware is encouraged.

Of course, for experimental  purposes,  post-linkage  optimization,  procedure
merging and/or compilation in one unit can be done to determine their effects.
However,  Dhrystone  numbers  obtained  under  these  conditions   should   be
explicitly  marked as such; "normal" Dhrystone results should be understood as
results obtained following the ground rules listed above.

In any case, for serious performance evaluation, users are advised to ask  for
code  listings  and  to  check  them carefully.  In this way, when results for
different systems are  compared,  the  reader  can  get  a  feeling  how  much
performance  difference is due to compiler optimization and how much is due to
hardware speed.


6.  Acknowledgements

This Ada version 2.1 of Dhrystone folllows closely the C version  2.1.  The  C
version  has been developed in cooperation with Rick Richardson (Tinton Falls,
NJ), it incorporates many ideas from the "Version 1.1" distributed  previously
by  him  over the UNIX network Usenet.  I also thank Chaim Benedelac (National
Semiconductor), David Ditzel (SUN), Earl Killian and John Mashey (MIPS),  Alan
Smith  and  Rafael  Saavedra-Barrera  (UC  at  Berkeley)  for  their help with
comments on earlier versions of the benchmark.


7.  Bibliography

[1]
   Reinhold P. Weicker: Dhrystone: A Synthetic Systems Programming Benchmark.
   Communications of the ACM 27, 10 (Oct. 1984), 1013-1030

[2]
   Rick Richardson: Dhrystone Benchmark Summary (and Program Text)
   Informal Distribution via "Usenet", Last Versions Known to  me:  Sept.  21,
   1987 (Version 1.1) and December 4, 1988 (Version 2)

[3]
   Reinhold P. Weicker: Dhrystone  Benchmark:  Rationale  for  Version  2  and
   Measurement Rules; Program Text (C Version 2.0)
   SIGPLAN Notices 23,8 (Aug. 1988), 49-62

SHAR_EOF
fi
if test -f 'README_A'
then
	echo shar: "will not over-write existing file 'README_A'"
else
cat << \SHAR_EOF > 'README_A'
This "shar" file contains the source code of the Dhrystone benchmark
(version 2.1) in Ada, together with some files with general remarks.
For versions in other languages, see the other "shar" files.

Files containing the Ada version (*.s: Specifications, *.b: Bodies):

  d_global.s
  d_main.b
  d_pack_1.b
  d_pack_1.s
  d_pack_2.b
  d_pack_2.s

The file RATIONALE contains the article 

  "Dhrystone Benchmark: Rationale for Version 2 and Measurement Rules"

which is similar to the article published in SIGPLAN Notices vol. 23, no. 8
(Aug. 1988), pp. 49-62, but modified for the Ada version.
This article explains all changes that have been made for Version 2,
compared with the version of the original publication
in Communications of the ACM vol. 27, no. 10 (Oct. 1984), pp. 1013-1030.
It also contains "ground rules" for benchmarking with Dhrystone
which should be followed by everyone who uses the program and publishes
Dhrystone results.

Compared with the Version 2.0 published in SIGPLAN Notices, Version 2.1
contains a few corrections that have been made after Version 2.0 was
distributed over the UNIX network Usenet. These small differences between
Version 2.0 and 2.1 should not affect execution time measurements.
For those who want to compare the exact contents of both versions,
the file "dhry_c.dif" contains the differences between the two versions,
as generated by a file comparison of the corresponding (C version)
files with the UNIX utility "diff".

Recipients of this shar file who perform measurements are asked
to send measurement results to the author and/or to Rick Richardson.
Rick Richardson publishes regularly Dhrystone results on the UNIX network
Usenet. For submissions of results to him (preferably by electronic mail,
see address in the program header), he has provided a form which is contained
in the file "submit.frm".


The following files are contained in other "shar" files:

Files containing the C version (*.h: Header File, *.c: C Modules)

  dhry.h
  dhry_1.c
  dhry_2.c
  
File containing the Pascal version:

  dhry.p


February 11, 1988

                 Reinhold P. Weicker
                 Siemens AG, E STE 35
                 Postfach 3220
                 D-8520 Erlangen
                 Germany (West)

                 Phone:  [xxx-49]-9131-7-20330  (8-17 Central European Time)
                 UUCP:   ..!mcvax!unido!estevax!weicker
SHAR_EOF
fi
if test -f 'd_global.s'
then
	echo shar: "will not over-write existing file 'd_global.s'"
else
cat << \SHAR_EOF > 'd_global.s'
------------------------------------------------------------------------
--
--                   "DHRYSTONE" Benchmark Program
--                   -----------------------------
--                                                                            
--  Version:    Ada, Version 2.1
--                                                                            
--  File:       d_global.s (part 1 of 6)
--
--  Date:       December 17, 1988
--
--  Author:     Reinhold P. Weicker
--                      Siemens AG, E STE 35
--                      Postfach 3220
--                      8520 Erlangen
--                      Germany (West)
--                              Phone:  [+49]-9131-7-20330
--                                      (8-17 Central European Time)
--                              Usenet: ..!mcvax!unido!estevax!weicker
--
--              Original Version published in "Communications of the ACM"
--		vol. 27., no. 10 (Oct. 1984), pp. 1013 - 1030,
--              together with the statistics on which the distribution
--		of statements etc. is based.
--
--              In this Ada version, the predefined package TEXT_IO
--		is used for Input/Output. For portability, only
--		Standard Ada language features are used for time
--		measaurement. This means that the procedure "Clock" of
--		package CALENDAR is used to measure the time,
--		even though it returns the elapsed time and not the CPU time.
--		See comments in d_pack_1.b for a discussion of
--		time measurement methods.
--
--  Collection of Results:
--              Reinhold Weicker (address see above) and
--              
--              Rick Richardson
--              PC Research. Inc.
--              94 Apple Orchard Drive
--              Tinton Falls, NJ 07724
--                      Phone:  (201) 834-1378 (9-17 EST)               
--                      Usenet: ...!seismo!uunet!pcrat!rick
--
--      Please send results to Reinhold Weicker and Rick Richardson.
--      Complete information should be given on hardware and software used.
--      Hardware information includes: Machine type, CPU, type and size
--      of caches; for microprocessors: clock frequency, memory speed
--      (number of wait states).
--      Software information includes: Compiler (and runtime library)
--      manufacturer and version, compilation switches, OS version.
--      The Operating System version may give an indication about the
--      compiler; Dhrystone itself performs no OS calls in the measurement loop.
--
--      The complete output generated by the program should be mailed
--      such that at least some checks for correctness can be made.
--
------------------------------------------------------------------------
--
--  History:    This version Ada/2.1 has been made for two reasons:
--
--              1) As far as it is possible without changes to the Dhrystone
--              statistics, optimizing compilers should be prevented from
--              removing significant statements.
--
--              2) With the new (2.1) C and Pascal versions, there should
--		be a corresponding Ada version. Also, the Ada version of
--		Dhrystone has not yet found a network distribution comparable
--		to the C version (version 1.1) distributed by Rick Richardson.
--             
--              This Ada version 2.1 has been made consistent with the
--              C version 2.1; therefore the acknowledgments for the C version
--              are due for the Ada version as well: I thank
--              Rick Richardson (Tinton Falls, NJ), Chaim Benedelac (Nat.
--              Semi.), David Ditzel (SUN), Earl Killian and John Mashey (MIPS),
--              Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley)
--              for their help with comments on earlier versions of the
--              benchmark.
--
--  Changes:    In the initialization part, this version follows mostly
--              Rick Richardson's C version distributed via Usenet, not the
--              version distributed earlier via floppy disk by Reinhold Weicker.
--              Inside the measurement loop, this version follows the
--              version previously distributed by Reinhold Weicker.
--
--              At several places in the benchmark, code has been added,
--              but within the measurement loop only in branches that 
--              are not executed. The intention is that optimizing compilers
--              should be prevented from moving code out of the measurement
--              loop, or from removing code altogether. Since the statements
--              that are executed within the measurement loop have NOT been
--              changed, the numbers defining the "Dhrystone distribution"
--              (distribution of statements, operand types and locality)
--              still hold. Except for sophisticated optimizing compilers,
--              execution times for this version should be the same as
--              for previous versions.
--              
--		Since it has proven difficult to subtract the time for the
--		measurement loop overhead in a correct way, the loop check
--		has been made a part of the benchmark. This does have
--		an impact - though a very minor one - on the distribution
--		statistics which have been updated for this version.
--
--              All changes within the measurement loop are described
--              and discussed in the companion paper "Rationale for
--              Dhrystone version 2".
--
--              Because of the self-imposed limitation that the order and
--              distribution of the executed statements should not be
--              changed, there are still cases where optimizing compilers
--              may not generate code for some statements. To a certain
--              degree, this is unavoidable for small synthetic benchmarks.
--              Users of the benchmark are advised to check code listings
--              whether code is generated for all statements of Dhrystone.
--
------------------------------------------------------------------------
--
--  Compilation model and measurement (IMPORTANT):
--
--  This Ada version of Dhrystone consists of six files
--  (file names shortened to 8 characters for MS-DOS floppy disk distribution):
--
--  - d_global.s (this file, containing global definitions and comments)
--  - d_pack_1.s (containing the package specification of Pack_1)
--  - d_pack_2.s (containing the package specification of Pack_2)
--  - d_pack_1.b (containing the package body of Pack_1)
--  - d_pack_2.b (containing the package body of Pack_2)
--  - d_main.b (containing procedure "main", very short)
--
--  The following "ground rules" apply for measurements:
--  - Separate compilation
--  - No procedure merging
--  - Otherwise, compiler optimizations are allowed but should be indicated
--  - Default results are those without register declarations
--  See the companion paper "Rationale for Dhrystone Version 2" for a more
--  detailed discussion of these ground rules.
--
--  For 16-Bit processors (e.g. 80186, 80286), times for all compilation
--  models ("small", "medium", "large" etc.) should be given if possible,
--  together with a definition of these models for the compiler system used.
--
--------------------------------------------------------------------------------
--
--  [Comment from the first distribution, still valid in principle.
--   Note that because of the inclusion of the measurement loop iteration,
--   the numbers are slightly different from the published version.]
--
--  The following program contains statements of a high level programming
--  language (here: Ada) in a distribution considered representative:
--
--    assignments                  53 %
--    control statements           32 %
--    procedure, function calls    15 %
--
--  100 statements are dynamically executed. The program is balanced with
--  respect to the three aspects:
--
--    - statement type
--    - operand type (for simple data types)
--    - operand access
--         operand global, local, parameter, or constant.
--
--  The combination of these three aspects is balanced only approximately.
--
--  1. Statement Type:
--  -----------------             number
--
--     V1 := V2                   10
--     V := Constant              12
--       (incl. V1 := F(
--     Assignment,                 7
--       with array element
--     Assignment,                 6
--       with record component
--                                --
--                                35       35
--
--     X := Y +|-|and|or Z         5
--     X := Y +|-|"=" Constant     6
--     X := X +|- 1                3
--     X := Y *|/ Z                2
--     X := Expression,            1
--          two operators
--     X := Expression,            1
--          three operators
--                                --
--                                18       18
--
--     if .... then ....          14
--       with "else"      7
--       without "else"   7
--           executed        3
--           not executed    4
--     for  ...  loop              7  |  counted every time
--     while ... loop              4  |  the loop condition
--     loop .... exit              1  |  is evaluated
--     case ... end case           1
--     return                      5
--     rename                      1
--                                --
--                                33       33
--
--     P (...)  proced. call      10
--       same package        5
--       other package       5
--
--     X := F (
--          function  call         5
--       same package        2
--       other package       3
--                                --
--                                15       15
--                                        ---
--                                        101
--
--    22 of the 58 assignments have a variable of a constrained
--    (sub-)type as their destination. In general, discriminant checks
--    will be necessary in these cases; however, the compiler may
--    optimize out some of these checks.
--
--    The average number of parameters in procedure or function calls
--    is 1.80 (not counting the function values as implicit parameters)
--
--
--  2. Operators
--  ------------
--                          number    approximate
--                                    percentage
--
--    Arithmetic             27          52.9
--
--       +                     16          31.4
--       -                      7          13.7
--       *                      3           5.9
--       /                      1           2.0
--
--    Comparison             20           39.2
--
--       =                      9           17.6
--       /=                     4            7.8
--       >                      1            2.0
--       <                      3            5.9
--       >=                     1            2.0
--       <=                     2            3.9
--
--    Logic                   4            7.8
--
--       AND                    1            2.0
--       OR                     1            2.0
--       NOT                    2            3.9
--
--                           --          -----
--                           51           99.9
--
--
--  3. Operand Type (counted once per operand reference)
--  ---------------
--                          number    approximate
--                                    percentage
--
--     Integer               135        55.1 %
--     Character              47        19.2 %
--     Enumeration            30        12.2 %
--     Boolean                11         4.5 %
--     Pointer                12         5.0 %
--     String30                6         2.4 %
--     Array                   2         0.8 %
--     Record                  2         0.8 %
--                           ---       -------
--                           245       100.0 %
--
--  When there is an access path leading to the final operand (e.g. a record
--  component), only the final data type on the access path is counted.
--
--  There are 16 accesses to components of a record, 9 of them go to
--  a component in a variant part. For some of these accesses, the
--  compiler may suppress generation of code checking the tag field
--  during optimization.
--
--
--  3. Operand Locality:
--  -------------------
--
--     local variable              120        49.0 %
--     global variable              20         8.2 %
--        same package                 19          7.8 %
--        other package                 1          0.4 %
--     parameter                    45        18.3 %
--        in                           27         11.0 %
--        inout                        12          5.0 %
--        out                           6          2.4 %
--     function result               5         2.0 %
--     constant                     55        22.4 %
--                                 ---       -------
--                                 245        99.9 %
--
--
--  There may be cases where a highly optimizing compiler may recognize
--  unnecessary statements and may not generate code for them.
--
--  There has been no explicit effort to account for the effects of a
--  cache, or to balance the use of long or short displacements for code or
--  data.
--
--  The program does not compute anything meaningful, but it is syntactically
--  and semantically correct. All variables have a value assigned to them
--  before they are used as a source operand.
--
--------------------------------------------------------------------------------

package Global_Def is
------------------

  -- Global type definitions

  type Enumeration is (Ident_1, Ident_2, Ident_3, Ident_4, Ident_5);

  subtype One_To_Thirty is integer range 1..30;
  subtype One_To_Fifty is integer range 1..50;
  subtype Capital_Letter is character range 'A'..'Z';

  type String_30 is array (One_To_Thirty) of character;
    pragma Pack (String_30);

  type Array_1_Dim_Integer is array (One_To_Fifty) of integer;
  type Array_2_Dim_Integer is array (One_To_Fifty,
                                     One_To_Fifty) of integer;

  type Record_Type (Discr: Enumeration := Ident_1);
  type Record_Pointer is access Record_Type;

  type Record_Type (Discr: Enumeration := Ident_1) is
               record
                Pointer_Comp:   Record_Pointer;
                case Discr is
                  when Ident_1 =>     -- only this variant is used,
                                      -- but in some cases discriminant
                                      -- checks are necessary
                    Enum_Comp:      Enumeration;
                    Int_Comp:       One_To_Fifty;
                    String_Comp:    String_30;
                  when Ident_2 =>
                    Enum_Comp_2:    Enumeration;
                    String_Comp_2:  String_30;
                  when others =>
                    Char_Comp_1,
                    Char_Comp_2:    character;
                end case;
              end record;

end Global_Def;
SHAR_EOF
fi
if test -f 'd_main.b'
then
	echo shar: "will not over-write existing file 'd_main.b'"
else
cat << \SHAR_EOF > 'd_main.b'
------------------------------------------------------------------------
--
--                   "DHRYSTONE" Benchmark Program
--                   -----------------------------
--                                                                            
--  Version:    Ada, Version 2.1
--                                                                            
--  File:       d_main.b (part 6 of 6)
--
--  Date:       August 17, 1988
--
--  Author:     Reinhold P. Weicker
--
------------------------------------------------------------------------

  with Global_Def, Pack_1;
  use Global_Def;

procedure Main is
--------------

begin

  Pack_1.Proc_0;   -- Proc_0 is actually the main program, but it is part
                   -- of a package, and a program within a package can
                   -- not be designated as the main program for execution.
                   -- Therefore Proc_0 is activated by a call from "Main".

end Main;

SHAR_EOF
fi
if test -f 'd_pack_1.b'
then
	echo shar: "will not over-write existing file 'd_pack_1.b'"
else
cat << \SHAR_EOF > 'd_pack_1.b'
------------------------------------------------------------------------
--
--                   "DHRYSTONE" Benchmark Program
--                   -----------------------------
--                                                                            
--  Version:    Ada, Version 2.1
--		(Portable Version)
--                                                                            
--  File:       d_pack_1.b (part 4 of 6)
--
--  Date:       December 17, 1988
--
--  Author:     Reinhold P. Weicker
--
--  Comments:	This package contains, along with other procedures,
--		Proc_0 which encloses the measurement loop
--		and the statements printing the results.
--
--		For execution time measurement, a call to the procedure
--		"Clock" of package CALENDAR is used.
--		Note that Clock returns the elapsed time
--		(wall clock time). When more processes than Dhrystone
--		are running, the time values returned by the procedures
--		of CALENDAR do NOT represent the (process-specific)
--		execution time of Dhrystone.
--		
--		For more accurate time measurement, replace the calls to
--		Clock by calls to (implementation-specific)
--		procedures that return the process-specific time.
--		However, no such procedures are defined in Standard Ada.
--
--		Timing issues for Ada are discussed in "Toward Real-Time
--		Performance Benchmarks for Ada" (Russell M. Clapp et al.,
--		CACM vol. 29, no. 8, August 1986, pp. 760-778).
--
------------------------------------------------------------------------

with	Global_Def, Pack_2, TEXT_IO, CALENDAR;
pragma  ELABORATE (TEXT_IO);
use	Global_Def, TEXT_IO;

package body Pack_1 is
-------------------

  package INT_IO is new TEXT_IO.INTEGER_IO (Integer);
  package FLOAT_IO is new TEXT_IO.FLOAT_IO (Float);
  package ENUM_IO is new TEXT_IO.ENUMERATION_IO (Enumeration);
  package BOOL_IO is new TEXT_IO.ENUMERATION_IO (Boolean);
  use     INT_IO, FLOAT_IO, ENUM_IO, BOOL_IO;


  Bool_Glob:         boolean;
  Char_Glob_2:       character;
  Array_Glob_1:      Array_1_Dim_Integer;
  Array_Glob_2:      Array_2_Dim_Integer;
  Pointer_Glob,
  Pointer_Glob_Next: Record_Pointer;

  procedure Proc_4;
  procedure Proc_5;

  -- for measurement:
  Too_Small_Time:	constant := 2.0;
	-- Measurements should last at least 2 seconds
  Max_Number_Of_Runs:	constant := 1_000_000;
  subtype Run_Range is integer range 1 .. Max_Number_Of_Runs;

procedure Proc_0
is
  Int_Loc_1,
  Int_Loc_2,
  Int_Loc_3:     One_To_Fifty;
  Char_Loc:      character;
  Enum_Loc:      Enumeration;
  String_Loc_1,
  String_Loc_2:  String_30;

  -- Variables for time measurement:
  Run_Index,
  Number_Of_Runs:	Run_Range;
  Begin_Time,
  End_Time:		Calendar.Time;
  Run_Time:		Duration;
  Microseconds,
  Dhry_Per_Sec:		float;

begin

  -- Initializations

  Pack_1.Pointer_Glob_Next := new Record_Type;

  Pack_1.Pointer_Glob := new Record_Type
                        '(
                          Pointer_Comp   => Pack_1.Pointer_Glob_Next,
                          Discr          => Ident_1,
                          Enum_Comp      => Ident_3,
                          Int_Comp       => 40,
                          String_Comp    => "DHRYSTONE PROGRAM, SOME STRING"
                         );

  String_Loc_1 := "DHRYSTONE PROGRAM, 1'ST STRING";

  Array_Glob_2 (8,7) := 10;

  Put_Line ("Dhrystone Benchmark, Version 2.1 (Language: Ada)");
  New_Line;
  Put_Line ("Please give the number of runs through the benchmark: ");
  Put ("> ");
  Get (Number_Of_Runs);

  Put ("Execution starts, ");
  Put (Number_Of_Runs);
  Put ("  runs through Dhrystone");
  New_Line;
  
  -----------------
  -- Start timer --
  -----------------

  Begin_Time := Calendar.Clock;

  for Run_Index in 1 .. Number_Of_Runs Loop

    Proc_5;
    Proc_4;
      -- Char_Glob_ 'A', Char_Glob_2 = 'B', Bool_Glob = false
    Int_Loc_1 := 2;
    Int_Loc_2 := 3;
    String_Loc_2 := "DHRYSTONE PROGRAM, 2'ND STRING";
    Enum_Loc := Ident_2;
    Bool_Glob := not Pack_2.Func_2 (String_Loc_1, String_Loc_2);
      -- Bool_Glob = true
    while Int_Loc_1 < Int_Loc_2 loop  -- loop body executed once
      Int_Loc_3 := 5 * Int_Loc_1 - Int_Loc_2;
        -- Int_Loc_3 = 7
      Pack_2.Proc_7 (Int_Loc_1, Int_Loc_2, Int_Loc_3);
        -- Int_Loc_3 = 7
      Int_Loc_1 := Int_Loc_1 + 1;
    end loop;
        -- Int_Loc_1 = 3
    Pack_2.Proc_8 (Array_Glob_1, Array_Glob_2, Int_Loc_1, Int_Loc_3);
      -- Int_Glob = 5
    Proc_1 (Pointer_Glob);
    for Char_Index in 'A' .. Char_Glob_2 loop -- loop body executed twice
      if Enum_Loc = Pack_2.Func_1 (Char_Index, 'C')
      then -- not executed
        Pack_2.Proc_6 (Ident_1, Enum_Loc);
        String_Loc_2 := "DHRYSTONE PROGRAM, 3'RD STRING";
        Int_Loc_2 := Run_Index;
        Int_Glob := Run_Index;
      end if;
    end loop;
      -- Enum_Loc = Ident_1
      -- Int_Loc_1 = 3, Int_Loc_2 = 3, Int_Loc_3 = 7
    Int_Loc_2 := Int_Loc_2 * Int_Loc_1;
    Int_Loc_1 := Int_Loc_2 / Int_Loc_3;
    Int_Loc_2 := 7 * (Int_Loc_2 - Int_Loc_3) - Int_Loc_1;
      -- Int_Loc_1 = 1, Int_Loc_2 = 13, Int_Loc_3 = 7
    Proc_2 (Int_Loc_1);
      -- Int_Loc_1 = 5

  end loop; -- for Run_Index

  ----------------
  -- Stop timer --
  ----------------

  End_Time := Calendar.Clock;

  Put_Line ("Execution ends");
  New_Line;
  Put_Line ("Final values of the variables used in the benchmark:");
  New_Line;

  INT_IO.DEFAULT_WIDTH := 6;
  Put      ("Int_Glob:          ");
  Put (Int_Glob);
  New_Line; 
  Put_Line ("        should be:      5");
  Put      ("Bool_Glob:           ");
  Put (Bool_Glob);
  New_Line;
  Put_Line ("        should be:   TRUE");
  Put      ("Char_Glob_1:         ");
  Put (Char_Glob_1);
  New_Line;
  Put_Line ("        should be:   A");
  Put      ("Char_Glob_2:         ");
  Put (Char_Glob_2);
  New_Line;
  Put_Line ("        should be:   B");
  Put      ("Array_Glob_1 (8):  ");
  Put (Array_Glob_1 (8));
  New_Line;
  Put_Line ("        should be:      7");
  Put      ("Array_Glob_2 (8,7): ");
  Put (Array_Glob_2 (8,7));
  New_Line;
  Put_Line ("        should be:   Number_Of_Runs + 10");
  Put_Line ("Pointer_Glob.");
  Put_Line ("  Pointer_Comp:      (implementation-dependent)");
  Put      ("  Discr:             ");
  Put (Pointer_Glob.Discr);
  New_Line;
  Put_Line ("        should be:   IDENT_1");
  Put      ("  Enum_Comp:         ");
  Put (Pointer_Glob.Enum_Comp);
  New_Line;
  Put_Line ("     should be:      IDENT_3");
  Put      ("  Int_Comp:        ");
  Put (Pointer_Glob.Int_Comp);
  New_Line;
  Put_Line ("     should be:        17");
  Put      ("  String_Comp:       ");
  for I in 1 .. 30 loop
    Put (Pointer_Glob.String_Comp (I));
  end loop;
  New_Line;
  Put_Line ("     should be:      DHRYSTONE PROGRAM, SOME STRING");
  Put_Line ("Pointer_Glob_Next.");
  Put_Line ("  Pointer_Comp:      (implementation-dependent)");
  Put      ("  Discr:             ");
  Put (Pointer_Glob_Next.Discr);
  New_Line;
  Put_Line ("        should be:   IDENT_1");
  Put      ("  Enum_Comp:         ");
  Put (Pointer_Glob_Next.Enum_Comp);
  New_Line;
  Put_Line ("     should be:      IDENT_2");
  Put      ("  Int_Comp:        ");
  Put (Pointer_Glob_Next.Int_Comp);
  New_Line;
  Put_Line ("     should be:        18");
  Put      ("  String_Comp:       ");
  for I in 1 .. 30 loop
    Put (Pointer_Glob_Next.String_Comp (I));
  end loop;
  New_Line;
  Put_Line ("     should be:      DHRYSTONE PROGRAM, SOME STRING");
  Put      ("Int_Loc_1:         ");
  Put (Int_Loc_1);
  New_Line;
  Put_Line ("        should be:      5");
  Put      ("Int_Loc_2:         ");
  Put (Int_Loc_2);
  New_Line;
  Put_Line ("        should be:     13");
  Put      ("Int_Loc_3:         ");
  Put (Int_Loc_3);
  New_Line;
  Put_Line ("        should be:      7");
  Put      ("Enum_Loc:            ");
  Put (Enum_Loc);
  New_Line;
  Put_Line ("     should be:      IDENT_2");
  Put      ("String_Loc_1         ");
  for I in 1 .. 30 loop
    Put (String_Loc_1 (I));
  end loop;
  New_Line;
  Put_Line ("     should be:      DHRYSTONE PROGRAM, 1'ST STRING");
  Put      ("String_Loc_2         ");
  for I in 1 .. 30 loop
    Put (String_Loc_2 (I));
  end loop;
  New_Line;
  Put_Line ("     should be:      DHRYSTONE PROGRAM, 2'ND STRING");
  New_Line;
 
  -- Compute Execution Time

  Run_Time :=  Calendar."-" (End_Time, Begin_Time);
  if Run_Time < Too_Small_Time
  then
    Put_Line ("Measured Time too small to obtain meaningful results");
    Put_Line ("Please increase number of runs");
  else
    Microseconds := 1_000_000.0 * float (Run_Time) / float (Number_Of_Runs);
    Dhry_Per_Sec := float (Number_of_Runs) / float (Run_Time);
    Put ("Microseconds for one run through Dhrystone:  ");
    Put (Microseconds, Aft => 2, Exp => 0);
    New_Line;
    Put ("Dhrystones per second:                       ");
    Put (Dhry_Per_Sec, Aft => 2, Exp => 0);
    New_Line;
  end if;
  New_Line;

end Proc_0;

procedure Proc_1 (Pointer_Par_In: in Record_Pointer)
is  -- executed once
  Next_Record: Record_Type
    renames Pointer_Par_In.Pointer_Comp.all; -- = Pointer_Glob_Next.all
begin
  Next_Record := Pointer_Glob.all;
  Pointer_Par_In.Int_Comp := 5;
  Next_Record.Int_Comp := Pointer_Par_In.Int_Comp;
  Next_Record.Pointer_Comp := Pointer_Par_In.Pointer_Comp;
  Proc_3 (Next_Record.Pointer_Comp);
    -- Next_Record.Pointer_Comp = Pointer_Glob.Pointer_Comp = Pointer_Glob_Next
  if Next_Record.Discr = Ident_1
  then -- executed
    Next_Record.Int_Comp := 6;
    Pack_2.Proc_6 (Pointer_Par_In.Enum_Comp, Next_Record.Enum_Comp);
    Next_Record.Pointer_Comp := Pointer_Glob.Pointer_Comp;
    Pack_2.Proc_7 (Next_Record.Int_Comp, 10, Next_Record.Int_Comp);
  else -- not executed
    Pointer_Par_In.all := Next_Record;
  end if;
end Proc_1;

procedure Proc_2 (Int_Par_In_Out: in out One_To_Fifty)
is  -- executed once
    -- In_Par_In_Out = 3, becomes 7
  Int_Loc:  One_To_Fifty;
  Enum_Loc: Enumeration;
begin
  Int_Loc := Int_Par_In_Out + 10;
  loop -- executed once
    if Char_Glob_1 = 'A'
    then -- executed
      Int_Loc := Int_Loc - 1;
      Int_Par_In_Out := Int_Loc - Int_Glob;
      Enum_Loc := Ident_1;
    end if;
  exit when Enum_Loc = Ident_1; -- true
  end loop;
end Proc_2;

procedure Proc_3 (Pointer_Par_Out: out Record_Pointer)
is  -- executed once
    -- Pointer_Par_Out becomes Pointer_Glob
begin
  if Pointer_Glob /= null
  then -- executed
    Pointer_Par_Out := Pointer_Glob.Pointer_Comp;
  end if;
  Pack_2.Proc_7 (10, Int_Glob, Pointer_Glob.Int_Comp);
end Proc_3;

procedure Proc_4 -- without parameters
is  -- executed once
  Bool_Loc: boolean;
begin
  Bool_Loc := Char_Glob_1 = 'A';
  Bool_Glob := Bool_Loc or Bool_Glob;
  Char_Glob_2 := 'B';
end Proc_4;

procedure Proc_5 -- without parameters
is  -- executed once
begin
  Char_Glob_1 := 'A';
  Bool_Glob := false;
end Proc_5;

end Pack_1;


SHAR_EOF
fi
if test -f 'd_pack_1.s'
then
	echo shar: "will not over-write existing file 'd_pack_1.s'"
else
cat << \SHAR_EOF > 'd_pack_1.s'
------------------------------------------------------------------------
--
--                   "DHRYSTONE" Benchmark Program
--                   -----------------------------
--                                                                            
--  Version:    Ada, Version 2.1
--                                                                            
--  File:       d_pack_1.s (part 2 of 6)
--
--  Date:       August 17, 1988
--
--  Author:     Reinhold P. Weicker
--
------------------------------------------------------------------------

  with Global_Def;
  use Global_Def;

package Pack_1 is
--------------

  procedure Proc_0;
  procedure Proc_1 (Pointer_Par_In:     in     Record_Pointer);
  procedure Proc_2 (Int_Par_In_Out:     in out One_To_Fifty);
  procedure Proc_3 (Pointer_Par_Out:    out    Record_Pointer);

  Int_Glob:          integer;
  Char_Glob_1:       character;

end Pack_1;


SHAR_EOF
fi
if test -f 'd_pack_2.b'
then
	echo shar: "will not over-write existing file 'd_pack_2.b'"
else
cat << \SHAR_EOF > 'd_pack_2.b'
------------------------------------------------------------------------
--
--                   "DHRYSTONE" Benchmark Program
--                   -----------------------------
--                                                                            
--  Version:    Ada, Version 2.1
--                                                                            
--  File:       d_pack_2.b (part 5 of 6)
--
--  Date:       August 17, 1988
--
--  Author:     Reinhold P. Weicker
--
------------------------------------------------------------------------

with Global_Def, Pack_1;
use Global_Def;

package body Pack_2 is
-------------------

function Func_3 (Enum_Par_In: in Enumeration) return boolean;
         -- forward declaration

procedure Proc_6 (Enum_Par_In:  in  Enumeration;
                  Enum_Par_Out: out Enumeration)
is  -- executed once
    -- Enum_Par_In = Ident_3, Enum_Par_Out becomes Ident_2
begin
  Enum_Par_Out := Enum_Par_In;
  if not Func_3 (Enum_Par_In)
  then -- not executed
    Enum_Par_Out := Ident_4;
  end if;
  case Enum_Par_In is
    when Ident_1 => Enum_Par_Out := Ident_1;
    when Ident_2 => if Pack_1.Int_Glob > 100
                      then Enum_Par_Out := Ident_1;
                      else Enum_Par_Out := Ident_4;
                    end if;
    when Ident_3 => Enum_Par_Out := Ident_2;    -- executed
    when Ident_4 => null;
    when Ident_5 => Enum_Par_Out := Ident_3;
  end case;
end Proc_6;

procedure Proc_7 (Int_Par_In_1,
                  Int_Par_In_2:   in  One_To_Fifty;
                  Int_Par_Out:    out One_To_Fifty)
is  -- executed three times
    -- first call:      Int_Par_In_1 = 2, Int_Par_In_2 = 3,
    --                  Int_Par_Out becomes 7
    -- second call:     Int_Par_In_1 = 6, Int_Par_In_2 = 10,
    --                  Int_Par_Out becomes 18
    -- third call:      Int_Par_In_1 = 10, Int_Par_In_2 = 5,
    --                  Int_Par_Out becomes 17
  Int_Loc: One_To_Fifty;
begin
  Int_Loc := Int_Par_In_1 + 2;
  Int_Par_Out := Int_Par_In_2 + Int_Loc;
end Proc_7;

procedure Proc_8 (Array_Par_In_Out_1: in out Array_1_Dim_Integer;
                  Array_Par_In_Out_2: in out Array_2_Dim_Integer;
                  Int_Par_In_1,
                  Int_Par_In_2:       in     integer)
is  -- executed once
    -- Int_Par_In_1 = 3
    -- Int_Par_In_2 = 7
  Int_Loc: One_To_Fifty;
begin
  Int_Loc := Int_Par_In_1 + 5;
  Array_Par_In_Out_1 (Int_Loc) := Int_Par_In_2;
  Array_Par_In_Out_1 (Int_Loc+1) :=
                          Array_Par_In_Out_1 (Int_Loc);
  Array_Par_In_Out_1 (Int_Loc+30) := Int_Loc;
  for Int_Index in Int_Loc .. Int_Loc+1 loop -- loop body executed twice
    Array_Par_In_Out_2 (Int_Loc, Int_Index) := Int_Loc;
  end loop;
  Array_Par_In_Out_2 (Int_Loc, Int_Loc-1) :=
                          Array_Par_In_Out_2 (Int_Loc, Int_Loc-1) + 1;
  Array_Par_In_Out_2 (Int_Loc+20, Int_Loc) :=
                          Array_Par_In_Out_1 (Int_Loc);
  Pack_1.Int_Glob := 5;
end Proc_8;

function Func_1 (Char_Par_In_1,
                 Char_Par_In_2: in Capital_Letter)
                                                return Enumeration
is  -- executed three times, returns Ident_1 each time
    -- first call:      Char_Par_In_1 = 'H', Char_Par_In_2 = 'R'
    -- second call:     Char_Par_In_1 = 'A', Char_Par_In_2 = 'C'
    -- third call:      Char_Par_In_1 = 'B', Char_Par_In_2 = 'C'
  Char_Loc_1, Char_Loc_2: Capital_Letter;
begin
  Char_Loc_1 := Char_Par_In_1;
  Char_Loc_2 := Char_Loc_1;
  if Char_Loc_2 /= Char_Par_In_2
  then  -- executed
    return Ident_1;
  else  -- not executed
    Pack_1.Char_Glob_1 := Char_Loc_1;
    return Ident_2;
  end if;
  end Func_1;

function Func_2 (String_Par_In_1,
                 String_Par_In_2: in String_30) return boolean
is  -- executed once, returns false
    -- String_Par_In_1 = "DHRYSTONE PROGRAM, 1'ST STRING"
    -- String_Par_In_2 = "DHRYSTONE PROGRAM, 2'ND STRING"
  Int_Loc:  One_To_Thirty;
  Char_Loc: Capital_Letter;
begin
  Int_Loc := 2;
  while Int_Loc <= 2 loop -- loop body executed once
    if Func_1 (String_Par_In_1(Int_Loc),
               String_Par_In_2(Int_Loc+1)) = Ident_1
    then -- executed
      Char_Loc := 'A';
      Int_Loc := Int_Loc + 1;
    end if;
  end loop;
  if Char_Loc >= 'W' and Char_Loc < 'Z'
  then -- not executed
    Int_Loc := 7;
  end if;
  if Char_Loc = 'R'
  then -- not executed
    return true;
  else -- executed
    if String_Par_In_1 = String_Par_In_2
    -- if String_Par_In_1 > String_Par_In_2
    -- not yet implemented
    then -- not executed
      Int_Loc := Int_Loc + 7;
      Pack_1.Int_Glob := Int_Loc;
      return true;
    else -- executed
      return false;
    end if;
  end if;
end Func_2;

function Func_3 (Enum_Par_In: in Enumeration) return boolean
is  -- executed once, returns true
    -- Enum_Par_In = Ident_3
  Enum_Loc:  Enumeration;
begin
  Enum_Loc := Enum_Par_In;
  if Enum_Loc = Ident_3
  then -- executed
    return true;
  else -- not executed
    return false;
  end if;
end Func_3;

end Pack_2;
SHAR_EOF
fi
if test -f 'd_pack_2.s'
then
	echo shar: "will not over-write existing file 'd_pack_2.s'"
else
cat << \SHAR_EOF > 'd_pack_2.s'
------------------------------------------------------------------------
--
--                   "DHRYSTONE" Benchmark Program
--                   -----------------------------
--                                                                            
--  Version:    Ada, Version 2.1
--                                                                            
--  File:       d_pack_2.s (part 3 of 6)
--
--  Date:       August 17, 1988
--
--  Author:     Reinhold P. Weicker
--
------------------------------------------------------------------------

  with Global_Def;
  use Global_Def;

package Pack_2 is
--------------

  procedure Proc_6 (Enum_Par_In:        in     Enumeration;
                    Enum_Par_Out:       out    Enumeration);
  procedure Proc_7 (Int_Par_In_1,
                    Int_Par_In_2:       in     One_To_Fifty;
                    Int_Par_Out:        out    One_To_Fifty);
  procedure Proc_8 (Array_Par_In_Out_1: in out Array_1_Dim_Integer;
                    Array_Par_In_Out_2: in out Array_2_Dim_Integer;
                    Int_Par_In_1,
                    Int_Par_In_2:       in     integer);
  function Func_1 (Char_Par_In_1,
                   Char_Par_In_2:       in     Capital_Letter)
                                                    return Enumeration;
  function Func_2 (String_Par_In_1,
                   String_Par_In_2:     in     String_30)
                                                    return boolean;

end Pack_2;


SHAR_EOF
fi
if test -f 'dhry_c.dif'
then
	echo shar: "will not over-write existing file 'dhry_c.dif'"
else
cat << \SHAR_EOF > 'dhry_c.dif'
7c7
<  *  Version:    C, Version 2.1
---
>  *  Version:    C, Version 2.0
11c11
<  *  Date:       May 17, 1988
---
>  *  Date:       March 3, 1988
50,51d49
< #define Too_Small_Time 120
<                 /* Measurements should last at least about 2 seconds */
55a54,58
> #endif
> #ifdef MSC_TIME
> clock_t	clock();
> #endif
> 
58d60
< #endif
73a76
> 
84a88
> 
99,100c103,105
<         /* Was missing in published program. Without this statement,    */
<         /* Arr_2_Glob [8][7] would have an undefined value.             */
---
>         /* Was missing in published program. Without this               */
>         /* initialization, Arr_2_Glob [8][7] would have an              */
>         /* undefined value.                                             */
105c110
<   printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
---
>   printf ("Dhrystone Benchmark, Version 2.0 (Language: C)\n");
134a140,142
> #ifdef MSC_CLOCK
>   Begin_Time = clock();
> #endif
192a201,203
> #ifdef MSC_CLOCK
>   End_Time = clock();
> #endif
281c292
< /******************/
---
> /**********************/
338c349
< /******************/
---
> /**********************/
347a359,360
>   else /* not executed */
>     Int_Glob = 100;
351a365
> 
384,385d397
< 
< 
SHAR_EOF
fi
if test -f 'submit.frm'
then
	echo shar: "will not over-write existing file 'submit.frm'"
else
cat << \SHAR_EOF > 'submit.frm'
DHRYSTONE 2.1 BENCHMARK REPORTING FORM
MANUF:
MODEL:
PROC:
CLOCK:
OS:
OVERSION:
COMPILER:
CVERSION:
OPTIONS:
NOREG:
REG:
NOTES:
DATE:
SUBMITTER:
CODESIZE:
MAILTO: uunet!pcrat!dry2
SHAR_EOF
fi
exit 0
#	End of shell archive
-- 
Reinhold P. Weicker, Siemens AG, E STE 35, PO Box 3220, D-8520 Erlangen, Germany
Phone:		     +49-9131-720330 (Centr.Europ.Time, 8 am - 5 pm)
UUCP:		     ...!mcvax!unido!estevax!weicker
Disclaimer:	     Although I work for Siemens, I speak here only for myself