xref: /OK3568_Linux_fs/u-boot/lib/dhry/dhry.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * (C) Copyright 2015 Google, Inc
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * SPDX-License-Identifier:     GPL-2.0+
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Dhrystone is widely available in the public domain. A GPL license is
7*4882a593Smuzhiyun  * chosen for U-Boot.
8*4882a593Smuzhiyun  */
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun /*****************************************************************************
11*4882a593Smuzhiyun  *  The BYTE UNIX Benchmarks - Release 3
12*4882a593Smuzhiyun  *          Module: dhry.h   SID: 3.4 5/15/91 19:30:21
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  *****************************************************************************
15*4882a593Smuzhiyun  * Bug reports, patches, comments, suggestions should be sent to:
16*4882a593Smuzhiyun  *
17*4882a593Smuzhiyun  *	Ben Smith, Rick Grehan or Tom Yager
18*4882a593Smuzhiyun  *	ben@bytepb.byte.com   rick_g@bytepb.byte.com   tyager@bytepb.byte.com
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  *****************************************************************************
21*4882a593Smuzhiyun  *  Modification Log:
22*4882a593Smuzhiyun  *  addapted from:
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  *
25*4882a593Smuzhiyun  *                   "DHRYSTONE" Benchmark Program
26*4882a593Smuzhiyun  *                   -----------------------------
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  *  Version:    C, Version 2.1
29*4882a593Smuzhiyun  *
30*4882a593Smuzhiyun  *  File:       dhry.h (part 1 of 3)
31*4882a593Smuzhiyun  *
32*4882a593Smuzhiyun  *  Date:       May 25, 1988
33*4882a593Smuzhiyun  *
34*4882a593Smuzhiyun  *  Author:     Reinhold P. Weicker
35*4882a593Smuzhiyun  *                      Siemens AG, AUT E 51
36*4882a593Smuzhiyun  *                      Postfach 3220
37*4882a593Smuzhiyun  *                      8520 Erlangen
38*4882a593Smuzhiyun  *                      Germany (West)
39*4882a593Smuzhiyun  *                              Phone:  [+49]-9131-7-20330
40*4882a593Smuzhiyun  *                                      (8-17 Central European Time)
41*4882a593Smuzhiyun  *                              Usenet: ..!mcvax!unido!estevax!weicker
42*4882a593Smuzhiyun  *
43*4882a593Smuzhiyun  *              Original Version (in Ada) published in
44*4882a593Smuzhiyun  *              "Communications of the ACM" vol. 27., no. 10 (Oct. 1984),
45*4882a593Smuzhiyun  *              pp. 1013 - 1030, together with the statistics
46*4882a593Smuzhiyun  *              on which the distribution of statements etc. is based.
47*4882a593Smuzhiyun  *
48*4882a593Smuzhiyun  *              In this C version, the following C library functions are used:
49*4882a593Smuzhiyun  *              - strcpy, strcmp (inside the measurement loop)
50*4882a593Smuzhiyun  *              - printf, scanf (outside the measurement loop)
51*4882a593Smuzhiyun  *              In addition, Berkeley UNIX system calls "times ()" or "time ()"
52*4882a593Smuzhiyun  *              are used for execution time measurement. For measurements
53*4882a593Smuzhiyun  *              on other systems, these calls have to be changed.
54*4882a593Smuzhiyun  *
55*4882a593Smuzhiyun  *  Collection of Results:
56*4882a593Smuzhiyun  *              Reinhold Weicker (address see above) and
57*4882a593Smuzhiyun  *
58*4882a593Smuzhiyun  *              Rick Richardson
59*4882a593Smuzhiyun  *              PC Research. Inc.
60*4882a593Smuzhiyun  *              94 Apple Orchard Drive
61*4882a593Smuzhiyun  *              Tinton Falls, NJ 07724
62*4882a593Smuzhiyun  *                      Phone:  (201) 834-1378 (9-17 EST)
63*4882a593Smuzhiyun  *                      Usenet: ...!seismo!uunet!pcrat!rick
64*4882a593Smuzhiyun  *
65*4882a593Smuzhiyun  *      Please send results to Rick Richardson and/or Reinhold Weicker.
66*4882a593Smuzhiyun  *      Complete information should be given on hardware and software used.
67*4882a593Smuzhiyun  *      Hardware information includes: Machine type, CPU, type and size
68*4882a593Smuzhiyun  *      of caches; for microprocessors: clock frequency, memory speed
69*4882a593Smuzhiyun  *      (number of wait states).
70*4882a593Smuzhiyun  *      Software information includes: Compiler (and runtime library)
71*4882a593Smuzhiyun  *      manufacturer and version, compilation switches, OS version.
72*4882a593Smuzhiyun  *      The Operating System version may give an indication about the
73*4882a593Smuzhiyun  *      compiler; Dhrystone itself performs no OS calls in the measurement loop.
74*4882a593Smuzhiyun  *
75*4882a593Smuzhiyun  *      The complete output generated by the program should be mailed
76*4882a593Smuzhiyun  *      such that at least some checks for correctness can be made.
77*4882a593Smuzhiyun  *
78*4882a593Smuzhiyun  ***************************************************************************
79*4882a593Smuzhiyun  *
80*4882a593Smuzhiyun  *  History:    This version C/2.1 has been made for two reasons:
81*4882a593Smuzhiyun  *
82*4882a593Smuzhiyun  *              1) There is an obvious need for a common C version of
83*4882a593Smuzhiyun  *              Dhrystone, since C is at present the most popular system
84*4882a593Smuzhiyun  *              programming language for the class of processors
85*4882a593Smuzhiyun  *              (microcomputers, minicomputers) where Dhrystone is used most.
86*4882a593Smuzhiyun  *              There should be, as far as possible, only one C version of
87*4882a593Smuzhiyun  *              Dhrystone such that results can be compared without
88*4882a593Smuzhiyun  *              restrictions. In the past, the C versions distributed
89*4882a593Smuzhiyun  *              by Rick Richardson (Version 1.1) and by Reinhold Weicker
90*4882a593Smuzhiyun  *              had small (though not significant) differences.
91*4882a593Smuzhiyun  *
92*4882a593Smuzhiyun  *              2) As far as it is possible without changes to the Dhrystone
93*4882a593Smuzhiyun  *              statistics, optimizing compilers should be prevented from
94*4882a593Smuzhiyun  *              removing significant statements.
95*4882a593Smuzhiyun  *
96*4882a593Smuzhiyun  *              This C version has been developed in cooperation with
97*4882a593Smuzhiyun  *              Rick Richardson (Tinton Falls, NJ), it incorporates many
98*4882a593Smuzhiyun  *              ideas from the "Version 1.1" distributed previously by
99*4882a593Smuzhiyun  *              him over the UNIX network Usenet.
100*4882a593Smuzhiyun  *              I also thank Chaim Benedelac (National Semiconductor),
101*4882a593Smuzhiyun  *              David Ditzel (SUN), Earl Killian and John Mashey (MIPS),
102*4882a593Smuzhiyun  *              Alan Smith and Rafael Saavedra-Barrera (UC at Berkeley)
103*4882a593Smuzhiyun  *              for their help with comments on earlier versions of the
104*4882a593Smuzhiyun  *              benchmark.
105*4882a593Smuzhiyun  *
106*4882a593Smuzhiyun  *  Changes:    In the initialization part, this version follows mostly
107*4882a593Smuzhiyun  *              Rick Richardson's version distributed via Usenet, not the
108*4882a593Smuzhiyun  *              version distributed earlier via floppy disk by Reinhold Weicker.
109*4882a593Smuzhiyun  *              As a concession to older compilers, names have been made
110*4882a593Smuzhiyun  *              unique within the first 8 characters.
111*4882a593Smuzhiyun  *              Inside the measurement loop, this version follows the
112*4882a593Smuzhiyun  *              version previously distributed by Reinhold Weicker.
113*4882a593Smuzhiyun  *
114*4882a593Smuzhiyun  *              At several places in the benchmark, code has been added,
115*4882a593Smuzhiyun  *              but within the measurement loop only in branches that
116*4882a593Smuzhiyun  *              are not executed. The intention is that optimizing compilers
117*4882a593Smuzhiyun  *              should be prevented from moving code out of the measurement
118*4882a593Smuzhiyun  *              loop, or from removing code altogether. Since the statements
119*4882a593Smuzhiyun  *              that are executed within the measurement loop have NOT been
120*4882a593Smuzhiyun  *              changed, the numbers defining the "Dhrystone distribution"
121*4882a593Smuzhiyun  *              (distribution of statements, operand types and locality)
122*4882a593Smuzhiyun  *              still hold. Except for sophisticated optimizing compilers,
123*4882a593Smuzhiyun  *              execution times for this version should be the same as
124*4882a593Smuzhiyun  *              for previous versions.
125*4882a593Smuzhiyun  *
126*4882a593Smuzhiyun  *              Since it has proven difficult to subtract the time for the
127*4882a593Smuzhiyun  *              measurement loop overhead in a correct way, the loop check
128*4882a593Smuzhiyun  *              has been made a part of the benchmark. This does have
129*4882a593Smuzhiyun  *              an impact - though a very minor one - on the distribution
130*4882a593Smuzhiyun  *              statistics which have been updated for this version.
131*4882a593Smuzhiyun  *
132*4882a593Smuzhiyun  *              All changes within the measurement loop are described
133*4882a593Smuzhiyun  *              and discussed in the companion paper "Rationale for
134*4882a593Smuzhiyun  *              Dhrystone version 2".
135*4882a593Smuzhiyun  *
136*4882a593Smuzhiyun  *              Because of the self-imposed limitation that the order and
137*4882a593Smuzhiyun  *              distribution of the executed statements should not be
138*4882a593Smuzhiyun  *              changed, there are still cases where optimizing compilers
139*4882a593Smuzhiyun  *              may not generate code for some statements. To a certain
140*4882a593Smuzhiyun  *              degree, this is unavoidable for small synthetic benchmarks.
141*4882a593Smuzhiyun  *              Users of the benchmark are advised to check code listings
142*4882a593Smuzhiyun  *              whether code is generated for all statements of Dhrystone.
143*4882a593Smuzhiyun  *
144*4882a593Smuzhiyun  *              Version 2.1 is identical to version 2.0 distributed via
145*4882a593Smuzhiyun  *              the UNIX network Usenet in March 1988 except that it corrects
146*4882a593Smuzhiyun  *              some minor deficiencies that were found by users of version 2.0.
147*4882a593Smuzhiyun  *              The only change within the measurement loop is that a
148*4882a593Smuzhiyun  *              non-executed "else" part was added to the "if" statement in
149*4882a593Smuzhiyun  *              Func_3, and a non-executed "else" part removed from Proc_3.
150*4882a593Smuzhiyun  *
151*4882a593Smuzhiyun  ***************************************************************************
152*4882a593Smuzhiyun  *
153*4882a593Smuzhiyun  * Defines:     The following "Defines" are possible:
154*4882a593Smuzhiyun  *              -DREG=register          (default: Not defined)
155*4882a593Smuzhiyun  *                      As an approximation to what an average C programmer
156*4882a593Smuzhiyun  *                      might do, the "register" storage class is applied
157*4882a593Smuzhiyun  *                      (if enabled by -DREG=register)
158*4882a593Smuzhiyun  *                      - for local variables, if they are used (dynamically)
159*4882a593Smuzhiyun  *                        five or more times
160*4882a593Smuzhiyun  *                      - for parameters if they are used (dynamically)
161*4882a593Smuzhiyun  *                        six or more times
162*4882a593Smuzhiyun  *                      Note that an optimal "register" strategy is
163*4882a593Smuzhiyun  *                      compiler-dependent, and that "register" declarations
164*4882a593Smuzhiyun  *                      do not necessarily lead to faster execution.
165*4882a593Smuzhiyun  *              -DNOSTRUCTASSIGN        (default: Not defined)
166*4882a593Smuzhiyun  *                      Define if the C compiler does not support
167*4882a593Smuzhiyun  *                      assignment of structures.
168*4882a593Smuzhiyun  *              -DNOENUMS               (default: Not defined)
169*4882a593Smuzhiyun  *                      Define if the C compiler does not support
170*4882a593Smuzhiyun  *                      enumeration types.
171*4882a593Smuzhiyun  *              -DTIMES                 (default)
172*4882a593Smuzhiyun  *              -DTIME
173*4882a593Smuzhiyun  *                      The "times" function of UNIX (returning process times)
174*4882a593Smuzhiyun  *                      or the "time" function (returning wallclock time)
175*4882a593Smuzhiyun  *                      is used for measurement.
176*4882a593Smuzhiyun  *                      For single user machines, "time ()" is adequate. For
177*4882a593Smuzhiyun  *                      multi-user machines where you cannot get single-user
178*4882a593Smuzhiyun  *                      access, use the "times ()" function. If you have
179*4882a593Smuzhiyun  *                      neither, use a stopwatch in the dead of night.
180*4882a593Smuzhiyun  *                      "printf"s are provided marking the points "Start Timer"
181*4882a593Smuzhiyun  *                      and "Stop Timer". DO NOT use the UNIX "time(1)"
182*4882a593Smuzhiyun  *                      command, as this will measure the total time to
183*4882a593Smuzhiyun  *                      run this program, which will (erroneously) include
184*4882a593Smuzhiyun  *                      the time to allocate storage (malloc) and to perform
185*4882a593Smuzhiyun  *                      the initialization.
186*4882a593Smuzhiyun  *              -DHZ=nnn
187*4882a593Smuzhiyun  *                      In Berkeley UNIX, the function "times" returns process
188*4882a593Smuzhiyun  *                      time in 1/HZ seconds, with HZ = 60 for most systems.
189*4882a593Smuzhiyun  *                      CHECK YOUR SYSTEM DESCRIPTION BEFORE YOU JUST APPLY
190*4882a593Smuzhiyun  *                      A VALUE.
191*4882a593Smuzhiyun  *
192*4882a593Smuzhiyun  ***************************************************************************
193*4882a593Smuzhiyun  *
194*4882a593Smuzhiyun  *  Compilation model and measurement (IMPORTANT):
195*4882a593Smuzhiyun  *
196*4882a593Smuzhiyun  *  This C version of Dhrystone consists of three files:
197*4882a593Smuzhiyun  *  - dhry.h (this file, containing global definitions and comments)
198*4882a593Smuzhiyun  *  - dhry_1.c (containing the code corresponding to Ada package Pack_1)
199*4882a593Smuzhiyun  *  - dhry_2.c (containing the code corresponding to Ada package Pack_2)
200*4882a593Smuzhiyun  *
201*4882a593Smuzhiyun  *  The following "ground rules" apply for measurements:
202*4882a593Smuzhiyun  *  - Separate compilation
203*4882a593Smuzhiyun  *  - No procedure merging
204*4882a593Smuzhiyun  *  - Otherwise, compiler optimizations are allowed but should be indicated
205*4882a593Smuzhiyun  *  - Default results are those without register declarations
206*4882a593Smuzhiyun  *  See the companion paper "Rationale for Dhrystone Version 2" for a more
207*4882a593Smuzhiyun  *  detailed discussion of these ground rules.
208*4882a593Smuzhiyun  *
209*4882a593Smuzhiyun  *  For 16-Bit processors (e.g. 80186, 80286), times for all compilation
210*4882a593Smuzhiyun  *  models ("small", "medium", "large" etc.) should be given if possible,
211*4882a593Smuzhiyun  *  together with a definition of these models for the compiler system used.
212*4882a593Smuzhiyun  *
213*4882a593Smuzhiyun  **************************************************************************
214*4882a593Smuzhiyun  *
215*4882a593Smuzhiyun  *  Dhrystone (C version) statistics:
216*4882a593Smuzhiyun  *
217*4882a593Smuzhiyun  *  [Comment from the first distribution, updated for version 2.
218*4882a593Smuzhiyun  *   Note that because of language differences, the numbers are slightly
219*4882a593Smuzhiyun  *   different from the Ada version.]
220*4882a593Smuzhiyun  *
221*4882a593Smuzhiyun  *  The following program contains statements of a high level programming
222*4882a593Smuzhiyun  *  language (here: C) in a distribution considered representative:
223*4882a593Smuzhiyun  *
224*4882a593Smuzhiyun  *    assignments                  52 (51.0 %)
225*4882a593Smuzhiyun  *    control statements           33 (32.4 %)
226*4882a593Smuzhiyun  *    procedure, function calls    17 (16.7 %)
227*4882a593Smuzhiyun  *
228*4882a593Smuzhiyun  *  103 statements are dynamically executed. The program is balanced with
229*4882a593Smuzhiyun  *  respect to the three aspects:
230*4882a593Smuzhiyun  *
231*4882a593Smuzhiyun  *    - statement type
232*4882a593Smuzhiyun  *    - operand type
233*4882a593Smuzhiyun  *    - operand locality
234*4882a593Smuzhiyun  *         operand global, local, parameter, or constant.
235*4882a593Smuzhiyun  *
236*4882a593Smuzhiyun  *  The combination of these three aspects is balanced only approximately.
237*4882a593Smuzhiyun  *
238*4882a593Smuzhiyun  *  1. Statement Type:
239*4882a593Smuzhiyun  *  -----------------             number
240*4882a593Smuzhiyun  *
241*4882a593Smuzhiyun  *     V1 = V2                     9
242*4882a593Smuzhiyun  *       (incl. V1 = F(..)
243*4882a593Smuzhiyun  *     V = Constant               12
244*4882a593Smuzhiyun  *     Assignment,                 7
245*4882a593Smuzhiyun  *       with array element
246*4882a593Smuzhiyun  *     Assignment,                 6
247*4882a593Smuzhiyun  *       with record component
248*4882a593Smuzhiyun  *                                --
249*4882a593Smuzhiyun  *                                34       34
250*4882a593Smuzhiyun  *
251*4882a593Smuzhiyun  *     X = Y +|-|"&&"|"|" Z        5
252*4882a593Smuzhiyun  *     X = Y +|-|"==" Constant     6
253*4882a593Smuzhiyun  *     X = X +|- 1                 3
254*4882a593Smuzhiyun  *     X = Y *|/ Z                 2
255*4882a593Smuzhiyun  *     X = Expression,             1
256*4882a593Smuzhiyun  *           two operators
257*4882a593Smuzhiyun  *     X = Expression,             1
258*4882a593Smuzhiyun  *           three operators
259*4882a593Smuzhiyun  *                                --
260*4882a593Smuzhiyun  *                                18       18
261*4882a593Smuzhiyun  *
262*4882a593Smuzhiyun  *     if ....                    14
263*4882a593Smuzhiyun  *       with "else"      7
264*4882a593Smuzhiyun  *       without "else"   7
265*4882a593Smuzhiyun  *           executed        3
266*4882a593Smuzhiyun  *           not executed    4
267*4882a593Smuzhiyun  *     for ...                     7  |  counted every time
268*4882a593Smuzhiyun  *     while ...                   4  |  the loop condition
269*4882a593Smuzhiyun  *     do ... while                1  |  is evaluated
270*4882a593Smuzhiyun  *     switch ...                  1
271*4882a593Smuzhiyun  *     break                       1
272*4882a593Smuzhiyun  *     declaration with            1
273*4882a593Smuzhiyun  *       initialization
274*4882a593Smuzhiyun  *                                --
275*4882a593Smuzhiyun  *                                34       34
276*4882a593Smuzhiyun  *
277*4882a593Smuzhiyun  *     P (...)  procedure call    11
278*4882a593Smuzhiyun  *       user procedure      10
279*4882a593Smuzhiyun  *       library procedure    1
280*4882a593Smuzhiyun  *     X = F (...)
281*4882a593Smuzhiyun  *             function  call      6
282*4882a593Smuzhiyun  *       user function        5
283*4882a593Smuzhiyun  *       library function     1
284*4882a593Smuzhiyun  *                                --
285*4882a593Smuzhiyun  *                                17       17
286*4882a593Smuzhiyun  *                                        ---
287*4882a593Smuzhiyun  *                                        103
288*4882a593Smuzhiyun  *
289*4882a593Smuzhiyun  *    The average number of parameters in procedure or function calls
290*4882a593Smuzhiyun  *    is 1.82 (not counting the function values as implicit parameters).
291*4882a593Smuzhiyun  *
292*4882a593Smuzhiyun  *
293*4882a593Smuzhiyun  *  2. Operators
294*4882a593Smuzhiyun  *  ------------
295*4882a593Smuzhiyun  *                          number    approximate
296*4882a593Smuzhiyun  *                                    percentage
297*4882a593Smuzhiyun  *
298*4882a593Smuzhiyun  *    Arithmetic             32          50.8
299*4882a593Smuzhiyun  *
300*4882a593Smuzhiyun  *       +                     21          33.3
301*4882a593Smuzhiyun  *       -                      7          11.1
302*4882a593Smuzhiyun  *       *                      3           4.8
303*4882a593Smuzhiyun  *       / (int div)            1           1.6
304*4882a593Smuzhiyun  *
305*4882a593Smuzhiyun  *    Comparison             27           42.8
306*4882a593Smuzhiyun  *
307*4882a593Smuzhiyun  *       ==                     9           14.3
308*4882a593Smuzhiyun  *       /=                     4            6.3
309*4882a593Smuzhiyun  *       >                      1            1.6
310*4882a593Smuzhiyun  *       <                      3            4.8
311*4882a593Smuzhiyun  *       >=                     1            1.6
312*4882a593Smuzhiyun  *       <=                     9           14.3
313*4882a593Smuzhiyun  *
314*4882a593Smuzhiyun  *    Logic                   4            6.3
315*4882a593Smuzhiyun  *
316*4882a593Smuzhiyun  *       && (AND-THEN)          1            1.6
317*4882a593Smuzhiyun  *       |  (OR)                1            1.6
318*4882a593Smuzhiyun  *       !  (NOT)               2            3.2
319*4882a593Smuzhiyun  *
320*4882a593Smuzhiyun  *                           --          -----
321*4882a593Smuzhiyun  *                           63          100.1
322*4882a593Smuzhiyun  *
323*4882a593Smuzhiyun  *
324*4882a593Smuzhiyun  *  3. Operand Type (counted once per operand reference):
325*4882a593Smuzhiyun  *  ---------------
326*4882a593Smuzhiyun  *                          number    approximate
327*4882a593Smuzhiyun  *                                    percentage
328*4882a593Smuzhiyun  *
329*4882a593Smuzhiyun  *     Integer               175        72.3 %
330*4882a593Smuzhiyun  *     Character              45        18.6 %
331*4882a593Smuzhiyun  *     Pointer                12         5.0 %
332*4882a593Smuzhiyun  *     String30                6         2.5 %
333*4882a593Smuzhiyun  *     Array                   2         0.8 %
334*4882a593Smuzhiyun  *     Record                  2         0.8 %
335*4882a593Smuzhiyun  *                           ---       -------
336*4882a593Smuzhiyun  *                           242       100.0 %
337*4882a593Smuzhiyun  *
338*4882a593Smuzhiyun  *  When there is an access path leading to the final operand (e.g. a record
339*4882a593Smuzhiyun  *  component), only the final data type on the access path is counted.
340*4882a593Smuzhiyun  *
341*4882a593Smuzhiyun  *
342*4882a593Smuzhiyun  *  4. Operand Locality:
343*4882a593Smuzhiyun  *  -------------------
344*4882a593Smuzhiyun  *                                number    approximate
345*4882a593Smuzhiyun  *                                          percentage
346*4882a593Smuzhiyun  *
347*4882a593Smuzhiyun  *     local variable              114        47.1 %
348*4882a593Smuzhiyun  *     global variable              22         9.1 %
349*4882a593Smuzhiyun  *     parameter                    45        18.6 %
350*4882a593Smuzhiyun  *        value                        23         9.5 %
351*4882a593Smuzhiyun  *        reference                    22         9.1 %
352*4882a593Smuzhiyun  *     function result               6         2.5 %
353*4882a593Smuzhiyun  *     constant                     55        22.7 %
354*4882a593Smuzhiyun  *                                 ---       -------
355*4882a593Smuzhiyun  *                                 242       100.0 %
356*4882a593Smuzhiyun  *
357*4882a593Smuzhiyun  *
358*4882a593Smuzhiyun  *  The program does not compute anything meaningful, but it is syntactically
359*4882a593Smuzhiyun  *  and semantically correct. All variables have a value assigned to them
360*4882a593Smuzhiyun  *  before they are used as a source operand.
361*4882a593Smuzhiyun  *
362*4882a593Smuzhiyun  *  There has been no explicit effort to account for the effects of a
363*4882a593Smuzhiyun  *  cache, or to balance the use of long or short displacements for code or
364*4882a593Smuzhiyun  *  data.
365*4882a593Smuzhiyun  *
366*4882a593Smuzhiyun  ***************************************************************************
367*4882a593Smuzhiyun  */
368*4882a593Smuzhiyun 
369*4882a593Smuzhiyun 
370*4882a593Smuzhiyun /* Compiler and system dependent definitions: */
371*4882a593Smuzhiyun 
372*4882a593Smuzhiyun #ifndef TIME
373*4882a593Smuzhiyun #define TIMES
374*4882a593Smuzhiyun #endif
375*4882a593Smuzhiyun                 /* Use times(2) time function unless    */
376*4882a593Smuzhiyun                 /* explicitly defined otherwise         */
377*4882a593Smuzhiyun 
378*4882a593Smuzhiyun #define Mic_secs_Per_Second     1000000.0
379*4882a593Smuzhiyun                 /* Berkeley UNIX C returns process times in seconds/HZ */
380*4882a593Smuzhiyun 
381*4882a593Smuzhiyun #ifdef  NOSTRUCTASSIGN
382*4882a593Smuzhiyun #define structassign(d, s)      memcpy(&(d), &(s), sizeof(d))
383*4882a593Smuzhiyun #else
384*4882a593Smuzhiyun #define structassign(d, s)      d = s
385*4882a593Smuzhiyun #endif
386*4882a593Smuzhiyun 
387*4882a593Smuzhiyun #ifdef  NOENUM
388*4882a593Smuzhiyun #define Ident_1 0
389*4882a593Smuzhiyun #define Ident_2 1
390*4882a593Smuzhiyun #define Ident_3 2
391*4882a593Smuzhiyun #define Ident_4 3
392*4882a593Smuzhiyun #define Ident_5 4
393*4882a593Smuzhiyun   typedef int   Enumeration;
394*4882a593Smuzhiyun #else
395*4882a593Smuzhiyun   typedef       enum    {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5}
396*4882a593Smuzhiyun                 Enumeration;
397*4882a593Smuzhiyun #endif
398*4882a593Smuzhiyun         /* for boolean and enumeration types in Ada, Pascal */
399*4882a593Smuzhiyun 
400*4882a593Smuzhiyun /* General definitions: */
401*4882a593Smuzhiyun 
402*4882a593Smuzhiyun #define Null 0
403*4882a593Smuzhiyun                 /* Value of a Null pointer */
404*4882a593Smuzhiyun #define true  1
405*4882a593Smuzhiyun #define false 0
406*4882a593Smuzhiyun 
407*4882a593Smuzhiyun typedef int     One_Thirty;
408*4882a593Smuzhiyun typedef int     One_Fifty;
409*4882a593Smuzhiyun typedef char    Capital_Letter;
410*4882a593Smuzhiyun typedef int     Boolean;
411*4882a593Smuzhiyun typedef char    Str_30 [31];
412*4882a593Smuzhiyun typedef int     Arr_1_Dim [50];
413*4882a593Smuzhiyun typedef int     Arr_2_Dim [50] [50];
414*4882a593Smuzhiyun 
415*4882a593Smuzhiyun typedef struct record
416*4882a593Smuzhiyun     {
417*4882a593Smuzhiyun     struct record *Ptr_Comp;
418*4882a593Smuzhiyun     Enumeration    Discr;
419*4882a593Smuzhiyun     union {
420*4882a593Smuzhiyun           struct {
421*4882a593Smuzhiyun                   Enumeration Enum_Comp;
422*4882a593Smuzhiyun                   int         Int_Comp;
423*4882a593Smuzhiyun                   char        Str_Comp [31];
424*4882a593Smuzhiyun                   } var_1;
425*4882a593Smuzhiyun           struct {
426*4882a593Smuzhiyun                   Enumeration E_Comp_2;
427*4882a593Smuzhiyun                   char        Str_2_Comp [31];
428*4882a593Smuzhiyun                   } var_2;
429*4882a593Smuzhiyun           struct {
430*4882a593Smuzhiyun                   char        Ch_1_Comp;
431*4882a593Smuzhiyun                   char        Ch_2_Comp;
432*4882a593Smuzhiyun                   } var_3;
433*4882a593Smuzhiyun           } variant;
434*4882a593Smuzhiyun       } Rec_Type, *Rec_Pointer;
435*4882a593Smuzhiyun 
436*4882a593Smuzhiyun 
437*4882a593Smuzhiyun /*
438*4882a593Smuzhiyun  * dhry() - run dhrystone for a given number of iterations
439*4882a593Smuzhiyun  *
440*4882a593Smuzhiyun  * @iterations:	Number of iterations to run
441*4882a593Smuzhiyun  */
442*4882a593Smuzhiyun void dhry(int iterations);
443