dhrystone.c 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. /* EVERBODY: Please read "APOLOGY" below. -rick 01/06/86
  2. *
  3. * "DHRYSTONE" Benchmark Program
  4. *
  5. * Version: C/1.1, 12/01/84
  6. *
  7. * Date: PROGRAM updated 01/06/86, RESULTS updated 02/17/86
  8. *
  9. * Author: Reinhold P. Weicker, CACM Vol 27, No 10, 10/84 pg. 1013
  10. * Translated from ADA by Rick Richardson
  11. * Every method to preserve ADA-likeness has been used,
  12. * at the expense of C-ness.
  13. *
  14. * Compile: cc -O dry.c -o drynr : No registers
  15. * cc -O -DREG=register dry.c -o dryr : Registers
  16. *
  17. * Defines: Defines are provided for old C compiler's
  18. * which don't have enums, and can't assign structures.
  19. * The time(2) function is library dependant; Most
  20. * return the time in seconds, but beware of some, like
  21. * Aztec C, which return other units.
  22. * The LOOPS define is initially set for 50000 loops.
  23. * If you have a machine with large integers and is
  24. * very fast, please change this number to 500000 to
  25. * get better accuracy. Please select the way to
  26. * measure the execution time using the TIME define.
  27. * For single user machines, time(2) is adequate. For
  28. * multi-user machines where you cannot get single-user
  29. * access, use the times(2) function. If you have
  30. * neither, use a stopwatch in the dead of night.
  31. * Use a "printf" at the point marked "start timer"
  32. * to begin your timings. DO NOT use the UNIX "time(1)"
  33. * command, as this will measure the total time to
  34. * run this program, which will (erroneously) include
  35. * the time to malloc(3) storage and to compute the
  36. * time it takes to do nothing.
  37. *
  38. * Run: drynr; dryr
  39. *
  40. * Results: If you get any new machine/OS results, please send to:
  41. *
  42. * {ihnp4,vax135,..}!houxm!castor!pcrat!rick
  43. *
  44. * and thanks to all that do. Space prevents listing
  45. * the names of those who have provided some of these
  46. * results. I'll be forwarding these results to
  47. * Rheinhold Weicker.
  48. *
  49. * Note: I order the list in increasing performance of the
  50. * "with registers" benchmark. If the compiler doesn't
  51. * provide register variables, then the benchmark
  52. * is the same for both REG and NOREG.
  53. *
  54. * PLEASE: Send complete information about the machine type,
  55. * clock speed, OS and C manufacturer/version. If
  56. * the machine is modified, tell me what was done.
  57. * On UNIX, execute uname -a and cc -V to get this info.
  58. *
  59. * 80x8x NOTE: 80x8x benchers: please try to do all memory models
  60. * for a particular compiler.
  61. *
  62. * APOLOGY (1/30/86):
  63. * Well, I goofed things up! As pointed out by Haakon Bugge,
  64. * the line of code marked "GOOF" below was missing from the
  65. * Dhrystone distribution for the last several months. It
  66. * *WAS* in a backup copy I made last winter, so no doubt it
  67. * was victimized by sleepy fingers operating vi!
  68. *
  69. * The effect of the line missing is that the reported benchmarks
  70. * are 15% too fast (at least on a 80286). Now, this creates
  71. * a dilema - do I throw out ALL the data so far collected
  72. * and use only results from this (corrected) version, or
  73. * do I just keep collecting data for the old version?
  74. *
  75. * Since the data collected so far *is* valid as long as it
  76. * is compared with like data, I have decided to keep
  77. * TWO lists- one for the old benchmark, and one for the
  78. * new. This also gives me an opportunity to correct one
  79. * other error I made in the instructions for this benchmark.
  80. * My experience with C compilers has been mostly with
  81. * UNIX 'pcc' derived compilers, where the 'optimizer' simply
  82. * fixes sloppy code generation (peephole optimization).
  83. * But today, there exist C compiler optimizers that will actually
  84. * perform optimization in the Computer Science sense of the word,
  85. * by removing, for example, assignments to a variable whose
  86. * value is never used. Dhrystone, unfortunately, provides
  87. * lots of opportunities for this sort of optimization.
  88. *
  89. * I request that benchmarkers re-run this new, corrected
  90. * version of Dhrystone, turning off or bypassing optimizers
  91. * which perform more than peephole optimization. Please
  92. * indicate the version of Dhrystone used when reporting the
  93. * results to me.
  94. *
  95. * RESULTS BEGIN HERE
  96. *
  97. *----------------DHRYSTONE VERSION 1.1 RESULTS BEGIN--------------------------
  98. *
  99. * MACHINE MICROPROCESSOR OPERATING COMPILER DHRYSTONES/SEC.
  100. * TYPE SYSTEM NO REG REGS
  101. * -------------------------- ------------ ----------- ---------------
  102. * IBM PC/AT 80286-7.5Mhz Venix/286 SVR2 cc 1159 1254 *15
  103. *
  104. *
  105. *----------------DHRYSTONE VERSION 1.0 RESULTS BEGIN--------------------------
  106. *
  107. * MACHINE MICROPROCESSOR OPERATING COMPILER DHRYSTONES/SEC.
  108. * TYPE SYSTEM NO REG REGS
  109. * -------------------------- ------------ ----------- ---------------
  110. * Commodore 64 6510-1MHz C64 ROM C Power 2.8 36 36
  111. * HP-110 8086-5.33Mhz MSDOS 2.11 Lattice 2.14 284 284
  112. * IBM PC/XT 8088-4.77Mhz PC/IX cc 271 294
  113. * CCC 3205 ? Xelos(SVR2) cc 279 296
  114. * Perq-II 2901 bitslice Accent S5c cc (CMU) 301 301
  115. * IBM PC/XT 8088-4.77Mhz COHERENT 2.3.43 MarkWilliams cc 296 317
  116. * Cosmos 68000-8Mhz UniSoft cc 305 322
  117. * IBM PC/XT 8088-4.77Mhz Venix/86 2.0 cc 297 324
  118. * DEC PRO 350 11/23 Venix/PRO SVR2 cc 299 325
  119. * IBM PC 8088-4.77Mhz MSDOS 2.0 b16cc 2.0 310 340
  120. * PDP11/23 11/23 Venix (V7) cc 320 358
  121. * Commodore Amiga ? Lattice 3.02 368 371
  122. * PC/XT 8088-4.77Mhz Venix/86 SYS V cc 339 377
  123. * IBM PC 8088-4.77Mhz MSDOS 2.0 CI-C86 2.20M 390 390
  124. * IBM PC/XT 8088-4.77Mhz PCDOS 2.1 Wizard 2.1 367 403
  125. * IBM PC/XT 8088-4.77Mhz PCDOS 3.1 Lattice 2.15 403 403 @
  126. * Colex DM-6 68010-8Mhz Unisoft SYSV cc 378 410
  127. * IBM PC 8088-4.77Mhz PCDOS 3.1 Datalight 1.10 416 416
  128. * IBM PC NEC V20-4.77Mhz MSDOS 3.1 MS 3.1 387 420
  129. * IBM PC/XT 8088-4.77Mhz PCDOS 2.1 Microsoft 3.0 390 427
  130. * IBM PC NEC V20-4.77Mhz MSDOS 3.1 MS 3.1 (186) 393 427
  131. * PDP-11/34 - UNIX V7M cc 387 438
  132. * IBM PC 8088, 4.77mhz PC-DOS 2.1 Aztec C v3.2d 423 454
  133. * Tandy 1000 V20, 4.77mhz MS-DOS 2.11 Aztec C v3.2d 423 458
  134. * Tandy TRS-16B 68000-6Mhz Xenix 1.3.5 cc 438 458
  135. * PDP-11/34 - RSTS/E decus c 438 495
  136. * Onyx C8002 Z8000-4Mhz IS/1 1.1 (V7) cc 476 511
  137. * CCC 3230 Xelos (SysV.2) cc 507 565
  138. * Tandy TRS-16B 68000-6Mhz Xenix 1.3.5 Green Hills 609 617
  139. * DEC PRO 380 11/73 Venix/PRO SVR2 cc 577 628
  140. * FHL QT+ 68000-10Mhz Os9/68000 version 1.3 603 649 FH
  141. * Apollo DN550 68010-?Mhz AegisSR9/IX cc 3.12 666 666
  142. * HP-110 8086-5.33Mhz MSDOS 2.11 Aztec-C 641 676
  143. * ATT PC6300 8086-8Mhz MSDOS 2.11 b16cc 2.0 632 684
  144. * IBM PC/AT 80286-6Mhz PCDOS 3.0 CI-C86 2.1 666 684
  145. * Tandy 6000 68000-8Mhz Xenix 3.0 cc 694 694
  146. * IBM PC/AT 80286-6Mhz Xenix 3.0 cc 684 704 MM
  147. * Macintosh 68000-7.8Mhz 2M Mac Rom Mac C 32 bit int 694 704
  148. * Macintosh 68000-7.7Mhz - MegaMax C 2.0 661 709
  149. * IBM PC/AT 80286-6Mhz Xenix 3.0 cc 704 714 LM
  150. * Codata 3300 68000-8Mhz UniPlus+ (v7) cc 678 725
  151. * WICAT MB 68000-8Mhz System V WICAT C 4.1 585 731 ~
  152. * Cadmus 9000 68010-10Mhz UNIX cc 714 735
  153. * AT&T 6300 8086-8Mhz Venix/86 SVR2 cc 668 743
  154. * Cadmus 9790 68010-10Mhz 1MB SVR0,Cadmus3.7 cc 720 747
  155. * NEC PC9801F 8086-8Mhz PCDOS 2.11 Lattice 2.15 768 - @
  156. * ATT PC6300 8086-8Mhz MSDOS 2.11 CI-C86 2.20M 769 769
  157. * Burroughs XE550 68010-10Mhz Centix 2.10 cc 769 769 CT1
  158. * EAGLE/TURBO 8086-8Mhz Venix/86 SVR2 cc 696 779
  159. * ALTOS 586 8086-10Mhz Xenix 3.0b cc 724 793
  160. * DEC 11/73 J-11 micro Ultrix-11 V3.0 System V 735 793
  161. * ATT 3B2/300 WE32000-?Mhz UNIX 5.0.2 cc 735 806
  162. * Apollo DN320 68010-?Mhz AegisSR9/IX cc 3.12 806 806
  163. * IRIS-2400 68010-10Mhz UNIX System V cc 772 829
  164. * Atari 520ST 68000-8Mhz TOS DigResearch 839 846
  165. * IBM PC/AT 80286-6Mhz PCDOS 3.0 MS 3.0(large) 833 847 LM
  166. * WICAT MB 68000-8Mhz System V WICAT C 4.1 675 853 S~
  167. * VAX 11/750 - Ultrix 1.1 4.2BSD cc 781 862
  168. * CCC 7350A 68000-8MHz UniSoft V.2 cc 821 875
  169. * VAX 11/750 - UNIX 4.2bsd cc 862 877
  170. * Fast Mac 68000-7.7Mhz - MegaMax C 2.0 839 904 +
  171. * IBM PC/XT 8086-9.54Mhz PCDOS 3.1 Microsoft 3.0 833 909 C1
  172. * DEC 11/44 Ultrix-11 V3.0 System V 862 909
  173. * Macintosh 68000-7.8Mhz 2M Mac Rom Mac C 16 bit int 877 909 S
  174. * CCC 3210 ? Xelos R01(SVR2) cc 849 924
  175. * CCC 3220 ? Ed. 7 v2.3 cc 892 925
  176. * IBM PC/AT 80286-6Mhz Xenix 3.0 cc -i 909 925
  177. * AT&T 6300 8086, 8mhz MS-DOS 2.11 Aztec C v3.2d 862 943
  178. * IBM PC/AT 80286-6Mhz Xenix 3.0 cc 892 961
  179. * VAX 11/750 w/FPA Eunice 3.2 cc 914 976
  180. * IBM PC/XT 8086-9.54Mhz PCDOS 3.1 Wizard 2.1 892 980 C1
  181. * IBM PC/XT 8086-9.54Mhz PCDOS 3.1 Lattice 2.15 980 980 C1
  182. * Plexus P35 68000-10Mhz UNIX System III cc 984 980
  183. * PDP-11/73 KDJ11-AA 15Mhz UNIX V7M 2.1 cc 862 981
  184. * VAX 11/750 w/FPA UNIX 4.3bsd cc 994 997
  185. * IRIS-1400 68010-10Mhz UNIX System V cc 909 1000
  186. * IBM PC/AT 80286-6Mhz Venix/86 2.1 cc 961 1000
  187. * IBM PC/AT 80286-6Mhz PCDOS 3.0 b16cc 2.0 943 1063
  188. * Zilog S8000/11 Z8001-5.5Mhz Zeus 3.2 cc 1011 1084
  189. * NSC ICM-3216 NSC 32016-10Mhz UNIX SVR2 cc 1041 1084
  190. * IBM PC/AT 80286-6Mhz PCDOS 3.0 MS 3.0(small) 1063 1086
  191. * VAX 11/750 w/FPA VMS VAX-11 C 2.0 958 1091
  192. * Stride 68000-10Mhz System-V/68 cc 1041 1111
  193. * Plexus P/60 MC68000-12.5Mhz UNIX SYSIII Plexus 1111 1111
  194. * ATT PC7300 68010-10Mhz UNIX 5.2 cc 1041 1111
  195. * CCC 3230 ? Xelos R01(SVR2) cc 1040 1126
  196. * Stride 68000-12Mhz System-V/68 cc 1063 1136
  197. * IBM PC/AT 80286-6Mhz Venix/286 SVR2 cc 1056 1149
  198. * Plexus P/60 MC68000-12.5Mhz UNIX SYSIII Plexus 1111 1163 T
  199. * IBM PC/AT 80286-6Mhz PCDOS 3.0 Datalight 1.10 1190 1190
  200. * ATT PC6300+ 80286-6Mhz MSDOS 3.1 b16cc 2.0 1111 1219
  201. * IBM PC/AT 80286-6Mhz PCDOS 3.1 Wizard 2.1 1136 1219
  202. * Sun2/120 68010-10Mhz Sun 4.2BSD cc 1136 1219
  203. * IBM PC/AT 80286-6Mhz PCDOS 3.0 CI-C86 2.20M 1219 1219
  204. * WICAT PB 68000-8Mhz System V WICAT C 4.1 998 1226 ~
  205. * MASSCOMP 500 68010-10MHz RTU V3.0 cc (V3.2) 1156 1238
  206. * Alliant FX/8 IP (68012-12Mhz) Concentrix cc -ip;exec -i 1170 1243 FX
  207. * Cyb DataMate 68010-12.5Mhz Uniplus 5.0 Unisoft cc 1162 1250
  208. * PDP 11/70 - UNIX 5.2 cc 1162 1250
  209. * IBM PC/AT 80286-6Mhz PCDOS 3.1 Lattice 2.15 1250 1250
  210. * IBM PC/AT 80286-7.5Mhz Venix/86 2.1 cc 1190 1315 *15
  211. * Sun2/120 68010-10Mhz Standalone cc 1219 1315
  212. * Intel 380 80286-8Mhz Xenix R3.0up1 cc 1250 1315 *16
  213. * Sequent Balance 8000 NS32032-10MHz Dynix 2.0 cc 1250 1315 N12
  214. * IBM PC/DSI-32 32032-10Mhz MSDOS 3.1 GreenHills 2.14 1282 1315 C3
  215. * ATT 3B2/400 WE32100-?Mhz UNIX 5.2 cc 1315 1315
  216. * CCC 3250XP - Xelos R01(SVR2) cc 1215 1318
  217. * IBM PC/RT 032 RISC(801?)?Mhz BSD 4.2 cc 1248 1333 RT
  218. * DG MV4000 - AOS/VS 5.00 cc 1333 1333
  219. * IBM PC/AT 80286-8Mhz Venix/86 2.1 cc 1275 1380 *16
  220. * IBM PC/AT 80286-6Mhz MSDOS 3.0 Microsoft 3.0 1250 1388
  221. * ATT PC6300+ 80286-6Mhz MSDOS 3.1 CI-C86 2.20M 1428 1428
  222. * COMPAQ/286 80286-8Mhz Venix/286 SVR2 cc 1326 1443
  223. * IBM PC/AT 80286-7.5Mhz Venix/286 SVR2 cc 1333 1449 *15
  224. * WICAT PB 68000-8Mhz System V WICAT C 4.1 1169 1464 S~
  225. * Tandy II/6000 68000-8Mhz Xenix 3.0 cc 1384 1477
  226. * WICAT MB 68000-12.5Mhz System V WICAT C 4.1 1246 1537 ~
  227. * IBM PC/AT 80286-9Mhz SCO Xenix V cc 1540 1556 *18
  228. * Cyb DataMate 68010-12.5Mhz Uniplus 5.0 Unisoft cc 1470 1562 S
  229. * VAX 11/780 - UNIX 5.2 cc 1515 1562
  230. * MicroVAX-II - - - 1562 1612
  231. * VAX 11/780 - UNIX 4.3bsd cc 1646 1662
  232. * Apollo DN660 - AegisSR9/IX cc 3.12 1666 1666
  233. * ATT 3B20 - UNIX 5.2 cc 1515 1724
  234. * NEC PC-98XA 80286-8Mhz PCDOS 3.1 Lattice 2.15 1724 1724 @
  235. * HP9000-500 B series CPU HP-UX 4.02 cc 1724 -
  236. * IBM PC/STD 80286-8Mhz MSDOS 3.0 Microsoft 3.0 1724 1785 C2
  237. * WICAT MB 68000-12.5Mhz System V WICAT C 4.1 1450 1814 S~
  238. * WICAT PB 68000-12.5Mhz System V WICAT C 4.1 1530 1898 ~
  239. * DEC-2065 KL10-Model B TOPS-20 6.1FT5 Port. C Comp. 1937 1946
  240. * Gould PN6005 - UTX 1.1(4.2BSD) cc 1675 1964
  241. * DEC2060 KL-10 TOPS-20 cc 2000 2000 &
  242. * VAX 11/785 - UNIX 5.2 cc 2083 2083
  243. * VAX 11/785 - VMS VAX-11 C 2.0 2083 2083
  244. * VAX 11/785 - UNIX SVR2 cc 2123 2083
  245. * VAX 11/785 - ULTRIX-32 1.1 cc 2083 2091
  246. * VAX 11/785 - UNIX 4.3bsd cc 2135 2136
  247. * WICAT PB 68000-12.5Mhz System V WICAT C 4.1 1780 2233 S~
  248. * Pyramid 90x - OSx 2.3 cc 2272 2272
  249. * Pyramid 90x FPA,cache,4Mb OSx 2.5 cc no -O 2777 2777
  250. * Pyramid 90x w/cache OSx 2.5 cc w/-O 3333 3333
  251. * IBM-4341-II - VM/SP3 Waterloo C 1.2 3333 3333
  252. * IRIS-2400T 68020-16.67Mhz UNIX System V cc 3105 3401
  253. * Celerity C-1200 ? UNIX 4.2BSD cc 3485 3468
  254. * SUN 3/75 68020-16.67Mhz SUN 4.2 V3 cc 3333 3571
  255. * IBM-4341 Model 12 UTS 5.0 ? 3685 3685
  256. * SUN-3/160 68020-16.67Mhz Sun 4.2 V3.0A cc 3381 3764
  257. * Sun 3/180 68020-16.67Mhz Sun 4.2 cc 3333 3846
  258. * IBM-4341 Model 12 UTS 5.0 ? 3910 3910 MN
  259. * MC 5400 68020-16.67MHz RTU V3.0 cc (V4.0) 3952 4054
  260. * NCR Tower32 68020-16.67Mhz SYS 5.0 Rel 2.0 cc 3846 4545
  261. * Gould PN9080 - UTX-32 1.1c cc - 4629
  262. * MC 5600/5700 68020-16.67MHz RTU V3.0 cc (V4.0) 4504 4746 %
  263. * Gould 1460-342 ECL proc UTX/32 11/c c    342 677G1
  264. * VX 800  UIX .3bd c 724 088 * AX 600- MS VAX11  2. 712 742
  265. * Aliat F/8 E oncntrx c -c;exc - 652 655FX
  266. * CI PWER6/3 CS(S+4.) c 700 800 * CI OWE 6/2 OWE 6 NIXV c 836 498 * CI OWE 6/2 .2 el.1.2 cc 893 944
  267. * Serr (CI Pwer6) 4.2SD cc 934 000
  268. *CRA-X-P/1 105hz OS .14Cra C   020 020
  269. *IBM308 - UTS5.0Rel1 c  1666 1250
  270.  CRY-1  80hz TSS Cry C2.0 1210 1388
  271.  IB-303 - VMCMSHPO3.4Watrlo C .2 388 388
  272. *Amdhl 70 /8  UT/V .2   ccv1.3  1550 1550
  273.  CRY-XMP/8  10MhzCTS Cay  2.  1525  1757
  274. * Adah 58 - UTS5.0Rel1.2cc 1.5  307 307
  275. *Amdhl 860 TS/ 5.  c v.23  2970 2970 *
  276. * NTE
  277. * * Crytalchagedfro 'sock tolised alu.
  278.   hisMacntoh ws ugraed rom128 to512 insuc a ay hat *   th ne 38K o memory is not slowed down by video generator accesses.
  279. * % Single processor; MC == MASSCOMP
  280. * & A version 7 C compiler written at New Mexico Tech.
  281. * @ vanilla Lattice compiler used with MicroPro standard library
  282. * S Shorts used instead of ints
  283. * T with Chris Torek's patches (whatever they are).
  284. * ~ For WICAT Systems: MB=MultiBus, PB=Proprietary Bus
  285. * LM Large Memory Model. (Otherwise, all 80x8x results are small model)
  286. * MM Medium Memory Model. (Otherwise, all 80x8x results are small model)
  287. * C1 Univation PC TURBO Co-processor; 9.54Mhz 8086, 640K RAM
  288. * C2 Seattle Telecom STD-286 board
  289. * C3 Definicon DSI-32 coprocessor
  290. * C? Unknown co-processor board?
  291. * CT1 Convergent Technologies MegaFrame, 1 processor.
  292. * MN Using Mike Newtons 'optimizer' (see net.sources).
  293. * G1 This Gould machine has 2 processors and was able to run 2 dhrystone
  294. * Benchmarks in parallel with no slowdown.
  295. * FH FHC == Frank Hogg Labs (Hazelwood Uniquad 2 in an FHL box).
  296. * FX The Alliant FX/8 is a system consisting of 1-8 CEs (computation
  297. * engines) and 1-12 IPs (interactive processors). Note N8 applies.
  298. * RT This is one of the RT's that CMU has been using for awhile. I'm
  299. * not sure that this is identical to the machine that IBM is selling
  300. * to the public.
  301. * Nnn This machine has multiple processors, allowing "nn" copies of the
  302. * benchmark to run in the same time as 1 copy.
  303. * ? I don't trust results marked with '?'. These were sent to me with
  304. * either incomplete info, or with times that just don't make sense.
  305. * ?? means I think the performance is too poor, ?! means too good.
  306. * If anybody can confirm these figures, please respond.
  307. *
  308. * ABBREVIATIONS
  309. * CCC Concurrent Computer Corp. (was Perkin-Elmer)
  310. * MC Masscomp
  311. *
  312. *--------------------------------RESULTS END----------------------------------
  313. *
  314. * The following program contains statements of a high-level programming
  315. * language (C) in a distribution considered representative:
  316. *
  317. * assignments 53%
  318. * control statements 32%
  319. * procedure, function calls 15%
  320. *
  321. * 100 statements are dynamically executed. The program is balanced with
  322. * respect to the three aspects:
  323. * - statement type
  324. * - operand type (for simple data types)
  325. * - operand access
  326. * operand global, local, parameter, or constant.
  327. *
  328. * The combination of these three aspects is balanced only approximately.
  329. *
  330. * The program does not compute anything meaningfull, but it is
  331. * syntactically and semantically correct.
  332. *
  333. */
  334. /* Accuracy of timings and human fatigue controlled by next two lines */
  335. /*#define LOOPS 50000 /* Use this for slow or 16 bit machines */
  336. #define LOOPS 5000 /* Use this for faster machines */
  337. /* Compiler dependent options */
  338. #undef NOENUM /* Define if compiler has no enum's */
  339. #undef NOSTRUCTASSIGN /* Define if compiler can't assign structures */
  340. /* define only one of the next two defines */
  341. #define TIMES /* Use times(2) time function */
  342. /*#define TIME /* Use time(2) time function */
  343. /* define the granularity of your times(2) function (when used) */
  344. /*#define HZ 60 /* times(2) returns 1/60 second (most) */
  345. #define HZ 100 /* times(2) returns 1/100 second (WECo) */
  346. /* for compatibility with goofed up version */
  347. /*#define GOOF /* Define if you want the goofed up version */
  348. #ifdef GOOF
  349. char Version[] = "1.0";
  350. #else
  351. char Version[] = "1.1";
  352. #endif
  353. #ifdef NOSTRUCTASSIGN
  354. #define structassign(d, s) memcpy(&(d), &(s), sizeof(d))
  355. #else
  356. #define structassign(d, s) d = s
  357. #endif
  358. #ifdef NOENUM
  359. #define Ident1 1
  360. #define Ident2 2
  361. #define Ident3 3
  362. #define Ident4 4
  363. #define Ident5 5
  364. typedef int Enumeration;
  365. #else
  366. typedef enum {Ident1, Ident2, Ident3, Ident4, Ident5} Enumeration;
  367. #endif
  368. typedef int OneToThirty;
  369. typedef int OneToFifty;
  370. typedef char CapitalLetter;
  371. typedef char String30[31];
  372. typedef int Array1Dim[51];
  373. typedef int Array2Dim[51][51];
  374. struct Record
  375. {
  376. struct Record *PtrComp;
  377. Enumeration Discr;
  378. Enumeration EnumComp;
  379. OneToFifty IntComp;
  380. String30 StringComp;
  381. };
  382. typedef struct Record RecordType;
  383. typedef RecordType * RecordPtr;
  384. typedef int boolean;
  385. #define NULL 0
  386. #define TRUE 1
  387. #define FALSE 0
  388. #ifndef REG
  389. #define REG
  390. #endif
  391. extern Enumeration Func1();
  392. extern boolean Func2();
  393. #ifdef TIMES
  394. #include <sys/types.h>
  395. #include <sys/times.h>
  396. #endif
  397. main()
  398. {
  399. Proc0();
  400. exit(0);
  401. }
  402. /*
  403. * Package 1
  404. */
  405. int IntGlob;
  406. boolean BoolGlob;
  407. char Char1Glob;
  408. char Char2Glob;
  409. Array1Dim Array1Glob;
  410. Array2Dim Array2Glob;
  411. RecordPtr PtrGlb;
  412. RecordPtr PtrGlbNext;
  413. Proc0()
  414. {
  415. OneToFifty IntLoc1;
  416. REG OneToFifty IntLoc2;
  417. OneToFifty IntLoc3;
  418. REG char CharLoc;
  419. REG char CharIndex;
  420. Enumeration EnumLoc;
  421. String30 String1Loc;
  422. String30 String2Loc;
  423. extern char *malloc();
  424. #ifdef TIME
  425. long time();
  426. long starttime;
  427. long benchtime;
  428. long nulltime;
  429. register unsigned int i;
  430. starttime = time( (long *) 0);
  431. for (i = 0; i < LOOPS; ++i);
  432. nulltime = time( (long *) 0) - starttime; /* Computes o'head of loop */
  433. #endif
  434. #ifdef TIMES
  435. time_t starttime;
  436. time_t benchtime;
  437. time_t nulltime;
  438. struct tms tms;
  439. register unsigned int i;
  440. times(&tms); starttime = tms.tms_utime;
  441. for (i = 0; i < LOOPS; ++i);
  442. times(&tms);
  443. nulltime = tms.tms_utime - starttime; /* Computes overhead of looping */
  444. #endif
  445. PtrGlbNext = (RecordPtr) malloc(sizeof(RecordType));
  446. PtrGlb = (RecordPtr) malloc(sizeof(RecordType));
  447. PtrGlb->PtrComp = PtrGlbNext;
  448. PtrGlb->Discr = Ident1;
  449. PtrGlb->EnumComp = Ident3;
  450. PtrGlb->IntComp = 40;
  451. strcpy(PtrGlb->StringComp, "DHRYSTONE PROGRAM, SOME STRING");
  452. #ifndef GOOF
  453. strcpy(String1Loc, "DHRYSTONE PROGRAM, 1'ST STRING"); /*GOOF*/
  454. #endif
  455. Array2Glob[8][7] = 10; /* Was missing in published program */
  456. /*****************
  457. -- Start Timer --
  458. *****************/
  459. #ifdef TIME
  460. starttime = time( (long *) 0);
  461. #endif
  462. #ifdef TIMES
  463. times(&tms); starttime = tms.tms_utime;
  464. #endif
  465. for (i = 0; i < LOOPS; ++i)
  466. {
  467. Proc5();
  468. Proc4();
  469. IntLoc1 = 2;
  470. IntLoc2 = 3;
  471. strcpy(String2Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
  472. EnumLoc = Ident2;
  473. BoolGlob = ! Func2(String1Loc, String2Loc);
  474. while (IntLoc1 < IntLoc2)
  475. {
  476. IntLoc3 = 5 * IntLoc1 - IntLoc2;
  477. Proc7(IntLoc1, IntLoc2, &IntLoc3);
  478. ++IntLoc1;
  479. }
  480. Proc8(Array1Glob, Array2Glob, IntLoc1, IntLoc3);
  481. Proc1(PtrGlb);
  482. for (CharIndex = 'A'; CharIndex <= Char2Glob; ++CharIndex)
  483. if (EnumLoc == Func1(CharIndex, 'C'))
  484. Proc6(Ident1, &EnumLoc);
  485. IntLoc3 = IntLoc2 * IntLoc1;
  486. IntLoc2 = IntLoc3 / IntLoc1;
  487. IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1;
  488. Proc2(&IntLoc1);
  489. }
  490. /*****************
  491. -- Stop Timer --
  492. *****************/
  493. #ifdef TIME
  494. benchtime = time( (long *) 0) - starttime - nulltime;
  495. printf("Dhrystone(%s) time for %ld passes = %ld\n",
  496. Version,
  497. (long) LOOPS, benchtime);
  498. printf("This machine benchmarks at %ld dhrystones/second\n",
  499. ((long) LOOPS) / benchtime);
  500. #endif
  501. #ifdef TIMES
  502. times(&tms);
  503. benchtime = tms.tms_utime - starttime - nulltime;
  504. printf("Dhrystone(%s) time for %ld passes = %ld\n",
  505. Version,
  506. (long) LOOPS, benchtime/HZ);
  507. printf("This machine benchmarks at %ld dhrystones/second\n",
  508. ((long) LOOPS) * HZ / benchtime);
  509. #endif
  510. }
  511. Proc1(PtrParIn)
  512. REG RecordPtr PtrParIn;
  513. {
  514. #define NextRecord (*(PtrParIn->PtrComp))
  515. structassign(NextRecord, *PtrGlb);
  516. PtrParIn->IntComp = 5;
  517. NextRecord.IntComp = PtrParIn->IntComp;
  518. NextRecord.PtrComp = PtrParIn->PtrComp;
  519. Proc3(NextRecord.PtrComp);
  520. if (NextRecord.Discr == Ident1)
  521. {
  522. NextRecord.IntComp = 6;
  523. Proc6(PtrParIn->EnumComp, &NextRecord.EnumComp);
  524. NextRecord.PtrComp = PtrGlb->PtrComp;
  525. Proc7(NextRecord.IntComp, 10, &NextRecord.IntComp);
  526. }
  527. else
  528. structassign(*PtrParIn, NextRecord);
  529. #undef NextRecord
  530. }
  531. Proc2(IntParIO)
  532. OneToFifty *IntParIO;
  533. {
  534. REG OneToFifty IntLoc;
  535. REG Enumeration EnumLoc;
  536. IntLoc = *IntParIO + 10;
  537. for(;;)
  538. {
  539. if (Char1Glob == 'A')
  540. {
  541. --IntLoc;
  542. *IntParIO = IntLoc - IntGlob;
  543. EnumLoc = Ident1;
  544. }
  545. if (EnumLoc == Ident1)
  546. break;
  547. }
  548. }
  549. Proc3(PtrParOut)
  550. RecordPtr *PtrParOut;
  551. {
  552. if (PtrGlb != NULL)
  553. *PtrParOut = PtrGlb->PtrComp;
  554. else
  555. IntGlob = 100;
  556. Proc7(10, IntGlob, &PtrGlb->IntComp);
  557. }
  558. Proc4()
  559. {
  560. REG boolean BoolLoc;
  561. BoolLoc = Char1Glob == 'A';
  562. BoolLoc |= BoolGlob;
  563. Char2Glob = 'B';
  564. }
  565. Proc5()
  566. {
  567. Char1Glob = 'A';
  568. BoolGlob = FALSE;
  569. }
  570. extern boolean Func3();
  571. Proc6(EnumParIn, EnumParOut)
  572. REG Enumeration EnumParIn;
  573. REG Enumeration *EnumParOut;
  574. {
  575. *EnumParOut = EnumParIn;
  576. if (! Func3(EnumParIn) )
  577. *EnumParOut = Ident4;
  578. switch (EnumParIn)
  579. {
  580. case Ident1: *EnumParOut = Ident1; break;
  581. case Ident2: if (IntGlob > 100) *EnumParOut = Ident1;
  582. else *EnumParOut = Ident4;
  583. break;
  584. case Ident3: *EnumParOut = Ident2; break;
  585. case Ident4: break;
  586. case Ident5: *EnumParOut = Ident3;
  587. }
  588. }
  589. Proc7(IntParI1, IntParI2, IntParOut)
  590. OneToFifty IntParI1;
  591. OneToFifty IntParI2;
  592. OneToFifty *IntParOut;
  593. {
  594. REG OneToFifty IntLoc;
  595. IntLoc = IntParI1 + 2;
  596. *IntParOut = IntParI2 + IntLoc;
  597. }
  598. Proc8(Array1Par, Array2Par, IntParI1, IntParI2)
  599. Array1Dim Array1Par;
  600. Array2Dim Array2Par;
  601. OneToFifty IntParI1;
  602. OneToFifty IntParI2;
  603. {
  604. REG OneToFifty IntLoc;
  605. REG OneToFifty IntIndex;
  606. IntLoc = IntParI1 + 5;
  607. Array1Par[IntLoc] = IntParI2;
  608. Array1Par[IntLoc+1] = Array1Par[IntLoc];
  609. Array1Par[IntLoc+30] = IntLoc;
  610. for (IntIndex = IntLoc; IntIndex <= (IntLoc+1); ++IntIndex)
  611. Array2Par[IntLoc][IntIndex] = IntLoc;
  612. ++Array2Par[IntLoc][IntLoc-1];
  613. Array2Par[IntLoc+20][IntLoc] = Array1Par[IntLoc];
  614. IntGlob = 5;
  615. }
  616. Enumeration Func1(CharPar1, CharPar2)
  617. CapitalLetter CharPar1;
  618. CapitalLetter CharPar2;
  619. {
  620. REG CapitalLetter CharLoc1;
  621. REG CapitalLetter CharLoc2;
  622. CharLoc1 = CharPar1;
  623. CharLoc2 = CharLoc1;
  624. if (CharLoc2 != CharPar2)
  625. return (Ident1);
  626. else
  627. return (Ident2);
  628. }
  629. boolean Func2(StrParI1, StrParI2)
  630. String30 StrParI1;
  631. String30 StrParI2;
  632. {
  633. REG OneToThirty IntLoc;
  634. REG CapitalLetter CharLoc;
  635. IntLoc = 1;
  636. while (IntLoc <= 1)
  637. if (Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1)
  638. {
  639. CharLoc = 'A';
  640. ++IntLoc;
  641. }
  642. if (CharLoc >= 'W' && CharLoc <= 'Z')
  643. IntLoc = 7;
  644. if (CharLoc == 'X')
  645. return(TRUE);
  646. else
  647. {
  648. if (strcmp(StrParI1, StrParI2) > 0)
  649. {
  650. IntLoc += 7;
  651. return (TRUE);
  652. }
  653. else
  654. return (FALSE);
  655. }
  656. }
  657. boolean Func3(EnumParIn)
  658. REG Enumeration EnumParIn;
  659. {
  660. REG Enumeration EnumLoc;
  661. EnumLoc = EnumParIn;
  662. if (EnumLoc == Ident3) return (TRUE);
  663. return (FALSE);
  664. }
  665. #ifdef NOSTRUCTASSIGN
  666. memcpy(d, s, l)
  667. register char *d;
  668. register char *s;
  669. register int l;
  670. {
  671. while (l--) *d++ = *s++;
  672. }
  673. #endif
  674. #if 0
  675. IntLoc;
  676. }
  677. if (CharLoc >= 'W' && CharLoc <= 'Z')
  678. IntLoc = 7;
  679. if (CharLoc == 'X')
  680. return(TRUE);
  681. else
  682. {
  683. if (strcmp(StrParI1, StrParI2) > 0)
  684. {
  685. IntLoc += 7;
  686. return (TRUE);
  687. }
  688. else
  689. return (FALSE);
  690. }
  691. }
  692. #endif