home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / next / misc / 19132 < prev    next >
Encoding:
Text File  |  1992-08-30  |  37.1 KB  |  1,781 lines

  1. Path: sparky!uunet!ulowell!news.bbn.com!olivea!isc-br!tau-ceti!jimc
  2. From: jimc@tau-ceti.isc-br.com (Jim Cathey)
  3. Newsgroups: comp.sys.next.misc
  4. Subject: C compiler optimization
  5. Message-ID: <2578@tau-ceti.isc-br.com>
  6. Date: 30 Aug 92 01:45:56 GMT
  7. Organization: ISC - Bunker Ramo, Spokane, WA
  8. Lines: 1771
  9.  
  10. OK, I was (finally!) able to get our dcc compiler to generate a Dhrystone
  11. test for my NeXT ('030 cube) to compare its code with gcc's.  For those
  12. who don't remember, dcc (Diab's C compiler) does a pretty good job at
  13. optimization, and is now available for NeXT (although, sans Objective C
  14. extensions).  Here are the numbers I got ('030 cube, 2.1 software, single-
  15. user mode, average of 3 times to 3 sig figs):
  16.  
  17. gcc (reg)    5880
  18. dcc        7490
  19.  
  20. Dcc generally does a better job if you don't use the register
  21. declarative.  It makes me wonder how much more usable my cube would be
  22. had a decent C compiler been used to build everything!  Disclaimer: I
  23. have no connection with Diab except as a happy customer, and that I've
  24. met the author.  
  25.  
  26. I've enclosed the assembly-language output of the compiler for your
  27. perusal, and for maybe running on a 040 machine.  The C-source as
  28. comments is one of the dcc's options, which makes some kinds of
  29. debugging easier.  Note that I had to hand-assemble (actually I used
  30. our system's assembler) some of the opcodes, since **@#$ gas apparently
  31. doesn't know about some of the 68020/30/40's addressing modes, and dcc
  32. uses them (though gcc obviously doesn't).  Also, the code has not been
  33. run through Diab's 68040 code-rearranger, which tries to do pipeline
  34. rearrangement.  It runs against the assembly-language file, and
  35. doesn't recognize the syntax variant that gas uses.  I don't know
  36. what (if any) difference it would have made on this particular program.
  37.  
  38. -- Jim
  39. #
  40. # This is a Shell Archive.
  41. # Remove everything above and including the cut line.
  42. # Then run the rest of the file through #! /bin/sh.
  43. # -----cut here-----cut here-----cut here-----cut here-----
  44. #! /bin/sh
  45. # Execute the file with #! /bin/sh (not csh) to create the files:
  46. #    dhry_1.s
  47. #    dhry_2.s
  48. # This Archive created: Sat Aug 29 18:32:36 1992
  49. # By: Jim Cathey at ISC - Bunker Ramo, Spokane, WA
  50. #
  51. export PATH; PATH=/bin:$PATH
  52. if test -f 'dhry_1.s'
  53. then
  54. echo shar: will not over-write existing file "'dhry_1.s'"
  55. else
  56. cat > 'dhry_1.s' << \SHAR_EOF
  57. |$$p68020    - MC68020/30 CPU
  58. |$$m0        - MIT mnemonics
  59. |$$k0        - Reorder info
  60. | /*
  61. |  ****************************************************************************
  62. |  *
  63. |  *                   "DHRYSTONE" Benchmark Program
  64. |  *                   -----------------------------
  65. |  *                                                                            
  66. |  *  Version:    C, Version 2.1
  67. |  *                                                                            
  68. |  *  File:       dhry_1.c (part 2 of 3)
  69. |  *
  70. |  *  Date:       May 17, 1988
  71. |  *
  72. |  *  Author:     Reinhold P. Weicker
  73. |  *
  74. |  ****************************************************************************
  75. |  */
  76. | #include "dhry.h"
  77. | /* Global Variables: */
  78. | #ifdef DNIX
  79. | #ifndef F_UNAME
  80. | #include <dnix/fcodes.h>
  81. | #include <dnix/dutsname.h>
  82. | #endif
  83. | #endif
  84. | #ifdef DNIX
  85. | int HZ;
  86. | #endif
  87. | Rec_Pointer     Ptr_Glob,
  88. |                 Next_Ptr_Glob;
  89. | int             Int_Glob;
  90. | Boolean         Bool_Glob;
  91. | char            Ch_1_Glob,
  92. |                 Ch_2_Glob;
  93. | int             Arr_1_Glob [50];
  94. | int             Arr_2_Glob [50] [50];
  95. | extern char     *malloc (long size);
  96. | Enumeration     Func_1 ();
  97. |   /* forward declaration necessary since Enumeration may not simply be int */
  98. | #ifndef REG
  99. |         Boolean Reg = false;
  100. | #define REG
  101. |         /* REG becomes defined as empty */
  102. |         /* i.e. no register variables   */
  103. | #else
  104. |         Boolean Reg = true;
  105. | #endif
  106. | /* variables for time measurement: */
  107. | #ifdef TIMES
  108. | struct tms      time_info;
  109. | extern  int     times ();
  110. |                 /* see library function "times" */
  111. | #define Too_Small_Time (2*HZ)
  112. |                 /* Measurements should last at least about 2 seconds */
  113. | #endif
  114. | #ifdef TIME
  115. | extern long     time();
  116. |                 /* see library function "time"  */
  117. | #define Too_Small_Time 2
  118. |                 /* Measurements should last at least 2 seconds */
  119. | #endif
  120. | #ifdef MSC_CLOCK
  121. | extern clock_t    clock();
  122. | #define Too_Small_Time (2*HZ)
  123. | #endif
  124. | long            Begin_Time,
  125. |                 End_Time,
  126. |                 User_Time;
  127. | float           Microseconds,
  128. |                 Dhrystones_Per_Second;
  129. | /* end of variables for time measurement */
  130. | main ()
  131. | /*****/
  132. |   /* main program, corresponds to procedures        */
  133. |   /* Main and Proc_0 in the Ada version             */
  134. | {
  135.  
  136.     .text
  137.     .globl    _main
  138. _main:
  139. |$$v0
  140.     link    a6,#-80
  141.     moveml    #5636,a7@-    | d3,d5,d6,a5
  142. |         One_Fifty       Int_1_Loc;
  143. |   REG   One_Fifty       Int_2_Loc;
  144. |         One_Fifty       Int_3_Loc;
  145. |   REG   char            Ch_Index;
  146. |         Enumeration     Enum_Loc;
  147. |         Str_30          Str_1_Loc;
  148. |         Str_30          Str_2_Loc;
  149. |   REG   int             Run_Index;
  150. |   REG   int             Number_Of_Runs;
  151. |   /* Initializations */
  152. | #ifdef DNIX
  153. |     struct dutsname duts;
  154. |     long dnix();
  155. |     if (dnix((long) F_UNAME, &duts, (long) sizeof(duts)) < 0) {
  156. |         exit(1);
  157. |     }
  158. |     HZ = duts.clocktics;
  159. | printf("HZ = %d\n", (long) HZ);
  160. | #endif
  161. |   Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
  162.     pea    48:w
  163.     jbsr    _malloc
  164.     movel    d0,_Next_Ptr_Glob
  165. |   Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
  166.     pea    48:w
  167.     jbsr    _malloc
  168.     movel    d0,_Ptr_Glob
  169. |   Ptr_Glob->Ptr_Comp                    = Next_Ptr_Glob;
  170.     movel    _Ptr_Glob,a0
  171.     movel    _Next_Ptr_Glob,a0@
  172. |   Ptr_Glob->Discr                       = Ident_1;
  173.     movel    _Ptr_Glob,a0
  174.     clrl    a0@(4)
  175. |   Ptr_Glob->variant.var_1.Enum_Comp     = Ident_3;
  176.     movel    _Ptr_Glob,a0
  177.     moveq    #2,d0
  178.     movel    d0,a0@(8)
  179. |   Ptr_Glob->variant.var_1.Int_Comp      = 40;
  180.     movel    _Ptr_Glob,a0
  181.     moveq    #40,d0
  182.     movel    d0,a0@(12)
  183. |   strcpy (Ptr_Glob->variant.var_1.Str_Comp, 
  184.     movel    #.L2,a0
  185.     movel    _Ptr_Glob,a1
  186.     lea    a1@(16),a1
  187.     movel    a0@+,a1@+
  188.     movel    a0@+,a1@+
  189.     movel    a0@+,a1@+
  190.     movel    a0@+,a1@+
  191.     movel    a0@+,a1@+
  192.     movel    a0@+,a1@+
  193.     movel    a0@+,a1@+
  194.     movew    a0@+,a1@+
  195.     moveb    a0@+,a1@+
  196. |           "DHRYSTONE PROGRAM, SOME STRING");
  197. |   strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
  198.     movel    #.L3,a0
  199.     lea    a6@(-44),a1
  200.     movel    a0@+,a1@+
  201.     movel    a0@+,a1@+
  202.     movel    a0@+,a1@+
  203.     movel    a0@+,a1@+
  204.     movel    a0@+,a1@+
  205.     movel    a0@+,a1@+
  206.     movel    a0@+,a1@+
  207.     movew    a0@+,a1@+
  208.     moveb    a0@+,a1@+
  209. |   Arr_2_Glob [8][7] = 10;
  210.     moveq    #10,d0
  211.     movel    d0,_Arr_2_Glob+1628
  212. |         /* Was missing in published program. Without this statement,    */
  213. |         /* Arr_2_Glob [8][7] would have an undefined value.             */
  214. |         /* Warning: With 16-Bit processors and Number_Of_Runs > 32000,  */
  215. |         /* overflow may occur for this array element.                   */
  216. |   printf ("\n");
  217.     movel    #.L4,a7@-
  218.     jbsr    _printf
  219. |   printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
  220.     movel    #.L5,a7@-
  221.     jbsr    _printf
  222. |   printf ("\n");
  223.     movel    #.L6,a7@-
  224.     jbsr    _printf
  225. |   if (Reg)
  226.     lea    a7@(20),a7
  227.     tstl    _Reg
  228.     jeq    .L11
  229. |   {
  230. |     printf ("Program compiled with 'register' attribute\n");
  231.     movel    #.L7,a7@-
  232.     jbsr    _printf
  233. |     printf ("\n");
  234.     movel    #.L8,a7@-
  235.     jbsr    _printf
  236.     addql    #8,a7
  237.     jra    .L12
  238. .L11:
  239. |   }
  240. |   else
  241. |   {
  242. |     printf ("Program compiled without 'register' attribute\n");
  243.     movel    #.L9,a7@-
  244.     jbsr    _printf
  245. |     printf ("\n");
  246.     movel    #.L10,a7@-
  247.     jbsr    _printf
  248.     addql    #8,a7
  249. .L12:
  250. |   }
  251. |   printf ("Please give the number of runs through the benchmark: ");
  252.     movel    #.L13,a7@-
  253.     jbsr    _printf
  254. |   {
  255. |     long n;
  256. |     scanf ("%d", &n);
  257.     pea    a6@(-80)
  258.     movel    #.L14,a7@-
  259.     jbsr    _scanf
  260. |     Number_Of_Runs = n;
  261.     movel    a6@(-80),d3
  262. |   }
  263. |   printf ("\n");
  264.     movel    #.L15,a7@-
  265.     jbsr    _printf
  266. |   printf ("Execution starts, %d runs through Dhrystone\n", (long) Number_Of_Runs);
  267.     movel    d3,a7@-
  268.     movel    #.L16,a7@-
  269.     jbsr    _printf
  270.     movel    #_time_info,a5
  271. |   /***************/
  272. |   /* Start timer */
  273. |   /***************/
  274. |  
  275. | #ifdef TIMES
  276. |   times (&time_info);
  277.     movel    a5,a7@-
  278.     jbsr    _times
  279. |   Begin_Time = (long) time_info.tms_utime;
  280.     movel    a5@,_Begin_Time
  281. | #endif
  282. | #ifdef TIME
  283. |   Begin_Time = time ( (long *) 0);
  284. | #endif
  285. | #ifdef MSC_CLOCK
  286. |   Begin_Time = clock();
  287. | #endif
  288. |   for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
  289.     moveq    #1,d6
  290.     lea    a7@(28),a7
  291.     tstl    d3
  292.     jle    .L93
  293.     movel    d7,a7@-
  294.     movel    d4,a7@-
  295. .L30:
  296. |   {
  297. |     Proc_5();
  298.     jbsr    _Proc_5
  299. |     Proc_4();
  300.     jbsr    _Proc_4
  301. |       /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
  302. |     Int_1_Loc = 2;
  303.     moveq    #2,d0
  304.     movel    d0,a6@(-4)
  305. |     Int_2_Loc = 3;
  306.     moveq    #3,d5
  307. |     strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
  308.     movel    #.L19,a0
  309.     lea    a6@(-76),a1
  310.     movel    a0@+,a1@+
  311.     movel    a0@+,a1@+
  312.     movel    a0@+,a1@+
  313.     movel    a0@+,a1@+
  314.     movel    a0@+,a1@+
  315.     movel    a0@+,a1@+
  316.     movel    a0@+,a1@+
  317.     movew    a0@+,a1@+
  318.     moveb    a0@+,a1@+
  319. |     Enum_Loc = Ident_2;
  320.     moveq    #1,d0
  321.     movel    d0,a6@(-12)
  322. |     Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
  323.     pea    a6@(-76)
  324.     pea    a6@(-44)
  325.     jbsr    _Func_2
  326.     tstl    d0
  327.     seq    d0
  328.     andl    #1,d0
  329.     movel    d0,_Bool_Glob
  330.     addql    #8,a7
  331.     jra    .L92
  332. .L22:
  333.     movel    a6@(-4),d7
  334. |       /* Bool_Glob == 1 */
  335. |     while (Int_1_Loc < Int_2_Loc)  /* loop body executed once */
  336. |     {
  337. |       Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
  338.     movel    d7,d0
  339.     movel    d0,d1
  340.     lsll    #2,d0
  341.     addl    d0,d1
  342.     subql    #3,d1
  343.     movel    d1,a6@(-8)
  344. |         /* Int_3_Loc == 7 */
  345. |       Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
  346.     pea    a6@(-8)
  347.     pea    3:w
  348.     movel    d7,a7@-
  349.     jbsr    _Proc_7
  350. |         /* Int_3_Loc == 7 */
  351. |       Int_1_Loc += 1;
  352.     addql    #1,a6@(-4)
  353.     lea    a7@(12),a7
  354. .L92:
  355.     moveq    #3,d0
  356.     cmpl    a6@(-4),d0
  357.     jgt    .L22
  358. |     } /* while */
  359. |       /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
  360. |     Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
  361.     movel    a6@(-8),a7@-
  362.     movel    a6@(-4),a7@-
  363.     movel    #_Arr_2_Glob,a7@-
  364.     movel    #_Arr_1_Glob,a7@-
  365.     jbsr    _Proc_8
  366. |       /* Int_Glob == 5 */
  367. |     Proc_1 (Ptr_Glob);
  368.     movel    _Ptr_Glob,a7@-
  369.     jbsr    _Proc_1
  370. |     for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
  371.     moveq    #65,d7
  372.     lea    a7@(20),a7
  373.     cmpb    #65,_Ch_2_Glob
  374.     jlt    .L23
  375. .L28:
  376. |                              /* loop body executed twice */
  377. |     {
  378. |       if (Enum_Loc == Func_1 (Ch_Index, 'C'))
  379.     pea    67:w
  380.     extbl    d7
  381.     movel    d7,a7@-
  382.     jbsr    _Func_1
  383.     addql    #8,a7
  384.     cmpl    a6@(-12),d0
  385.     jne    .L24
  386. |           /* then, not executed */
  387. |         {
  388. |         Proc_6 (Ident_1, &Enum_Loc);
  389.     pea    a6@(-12)
  390.     clrl    a7@-
  391.     jbsr    _Proc_6
  392. |         strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
  393.     movel    #.L25,a0
  394.     lea    a6@(-76),a1
  395.     movel    a0@+,a1@+
  396.     movel    a0@+,a1@+
  397.     movel    a0@+,a1@+
  398.     movel    a0@+,a1@+
  399.     movel    a0@+,a1@+
  400.     movel    a0@+,a1@+
  401.     movel    a0@+,a1@+
  402.     movew    a0@+,a1@+
  403.     moveb    a0@+,a1@+
  404. |         Int_2_Loc = Run_Index;
  405.     movel    d6,d5
  406. |         Int_Glob = Run_Index;
  407.     movel    d6,_Int_Glob
  408.     addql    #8,a7
  409. .L24:
  410.     addqb    #1,d7
  411.     cmpb    _Ch_2_Glob,d7
  412.     jle    .L28
  413. .L23:
  414. |         }
  415. |     }
  416. |       /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
  417. |     Int_2_Loc = Int_2_Loc * Int_1_Loc;
  418.     mulsl    a6@(-4),d5
  419.     movel    a6@(-8),d7
  420.     movel    d5,d4
  421.     divsl    d7,d4
  422. |     Int_1_Loc = Int_2_Loc / Int_3_Loc;
  423.     movel    d4,a6@(-4)
  424. |     Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
  425.     movel    d5,d0
  426.     subl    d7,d0
  427.     moveq    #0,d1
  428.     subl    d0,d1
  429.     lsll    #3,d0
  430.     addl    d0,d1
  431.     subl    d4,d1
  432.     movel    d1,d5
  433. |       /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
  434. |     Proc_2 (&Int_1_Loc);
  435.     pea    a6@(-4)
  436.     jbsr    _Proc_2
  437.     addql    #1,d6
  438.     addql    #4,a7
  439.     cmpl    d3,d6
  440.     jle    .L30
  441.     movel    a7@+,d4
  442.     movel    a7@+,d7
  443. .L93:
  444.     movel    #_time_info,a5
  445. |       /* Int_1_Loc == 5 */
  446. |   } /* loop "for Run_Index" */
  447. |   /**************/
  448. |   /* Stop timer */
  449. |   /**************/
  450. |   
  451. | #ifdef TIMES
  452. |   times (&time_info);
  453.     movel    a5,a7@-
  454.     jbsr    _times
  455. |   End_Time = (long) time_info.tms_utime;
  456.     movel    a5@,_End_Time
  457. | #endif
  458. | #ifdef TIME
  459. |   End_Time = time ( (long *) 0);
  460. | #endif
  461. | #ifdef MSC_CLOCK
  462. |   End_Time = clock();
  463. | #endif
  464. |   printf ("Execution ends\n");
  465.     movel    #.L31,a7@-
  466.     jbsr    _printf
  467. |   printf ("\n");
  468.     movel    #.L32,a7@-
  469.     jbsr    _printf
  470. |   printf ("Final values of the variables used in the benchmark:\n");
  471.     movel    #.L33,a7@-
  472.     jbsr    _printf
  473. |   printf ("\n");
  474.     movel    #.L34,a7@-
  475.     jbsr    _printf
  476. |   printf ("Int_Glob:            %d\n", (long) Int_Glob);
  477.     movel    _Int_Glob,a7@-
  478.     movel    #.L35,a7@-
  479.     jbsr    _printf
  480. |   printf ("        should be:   %d\n", (long) 5);
  481.     pea    5:w
  482.     movel    #.L36,a7@-
  483.     jbsr    _printf
  484. |   printf ("Bool_Glob:           %d\n", (long) Bool_Glob);
  485.     movel    _Bool_Glob,a7@-
  486.     movel    #.L37,a7@-
  487.     jbsr    _printf
  488. |   printf ("        should be:   %d\n", (long) 1);
  489.     pea    1:w
  490.     movel    #.L38,a7@-
  491.     jbsr    _printf
  492. |   printf ("Ch_1_Glob:           %c\n", (long) Ch_1_Glob);
  493.     moveb    _Ch_1_Glob,d0
  494.     extbl    d0
  495.     movel    d0,a7@-
  496.     movel    #.L39,a7@-
  497.     jbsr    _printf
  498. |   printf ("        should be:   %c\n", (long) 'A');
  499.     pea    65:w
  500.     movel    #.L40,a7@-
  501.     jbsr    _printf
  502. |   printf ("Ch_2_Glob:           %c\n", (long) Ch_2_Glob);
  503.     moveb    _Ch_2_Glob,d0
  504.     extbl    d0
  505.     movel    d0,a7@-
  506.     movel    #.L41,a7@-
  507.     jbsr    _printf
  508. |   printf ("        should be:   %c\n", (long) 'B');
  509.     pea    66:w
  510.     movel    #.L42,a7@-
  511.     jbsr    _printf
  512. |   printf ("Arr_1_Glob[8]:       %d\n", (long) Arr_1_Glob[8]);
  513.     movel    _Arr_1_Glob+32,a7@-
  514.     movel    #.L43,a7@-
  515.     jbsr    _printf
  516. |   printf ("        should be:   %d\n", (long) 7);
  517.     pea    7:w
  518.     movel    #.L44,a7@-
  519.     jbsr    _printf
  520. |   printf ("Arr_2_Glob[8][7]:    %d\n", (long) Arr_2_Glob[8][7]);
  521.     movel    _Arr_2_Glob+1628,a7@-
  522.     movel    #.L45,a7@-
  523.     jbsr    _printf
  524. |   printf ("        should be:   Number_Of_Runs + 10\n");
  525.     movel    #.L46,a7@-
  526.     jbsr    _printf
  527. |   printf ("Ptr_Glob->\n");
  528.     movel    #.L47,a7@-
  529.     jbsr    _printf
  530. |   printf ("  Ptr_Comp:          %d\n", (long) Ptr_Glob->Ptr_Comp);
  531.     movel    _Ptr_Glob,a0
  532.     movel    a0@,a7@-
  533.     movel    #.L48,a7@-
  534.     jbsr    _printf
  535. |   printf ("        should be:   (implementation-dependent)\n");
  536.     movel    #.L49,a7@-
  537.     jbsr    _printf
  538. |   printf ("  Discr:             %d\n", (long) Ptr_Glob->Discr);
  539.     movel    _Ptr_Glob,a0
  540.     movel    a0@(4),a7@-
  541.     movel    #.L50,a7@-
  542.     jbsr    _printf
  543. |   printf ("        should be:   %d\n", (long) 0);
  544.     clrl    a7@-
  545.     movel    #.L51,a7@-
  546.     jbsr    _printf
  547. |   printf ("  Enum_Comp:         %d\n", (long) Ptr_Glob->variant.var_1.Enum_Comp);
  548.     movel    _Ptr_Glob,a0
  549.     movel    a0@(8),a7@-
  550.     movel    #.L52,a7@-
  551.     jbsr    _printf
  552. |   printf ("        should be:   %d\n", (long) 2);
  553.     pea    2:w
  554.     movel    #.L53,a7@-
  555.     jbsr    _printf
  556. |   printf ("  Int_Comp:          %d\n", (long) Ptr_Glob->variant.var_1.Int_Comp);
  557.     movel    _Ptr_Glob,a0
  558.     movel    a0@(12),a7@-
  559.     movel    #.L54,a7@-
  560.     jbsr    _printf
  561. |   printf ("        should be:   %d\n", (long) 17);
  562.     pea    17:w
  563.     movel    #.L55,a7@-
  564.     jbsr    _printf
  565. |   printf ("  Str_Comp:          %s\n", Ptr_Glob->variant.var_1.Str_Comp);
  566.     movel    _Ptr_Glob,a0
  567.     pea    a0@(16)
  568.     movel    #.L56,a7@-
  569.     jbsr    _printf
  570. |   printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
  571.     movel    #.L57,a7@-
  572.     jbsr    _printf
  573. |   printf ("Next_Ptr_Glob->\n");
  574.     movel    #.L58,a7@-
  575.     jbsr    _printf
  576. |   printf ("  Ptr_Comp:          %d\n", (long) Next_Ptr_Glob->Ptr_Comp);
  577.     movel    _Next_Ptr_Glob,a0
  578.     movel    a0@,a7@-
  579.     movel    #.L59,a7@-
  580.     jbsr    _printf
  581. |   printf ("        should be:   (implementation-dependent), same as above\n");
  582.     movel    #.L60,a7@-
  583.     jbsr    _printf
  584. |   printf ("  Discr:             %d\n", (long) Next_Ptr_Glob->Discr);
  585.     movel    _Next_Ptr_Glob,a0
  586.     movel    a0@(4),a7@-
  587.     movel    #.L61,a7@-
  588.     jbsr    _printf
  589. |   printf ("        should be:   %d\n", (long) 0);
  590.     clrl    a7@-
  591.     movel    #.L62,a7@-
  592.     jbsr    _printf
  593. |   printf ("  Enum_Comp:         %d\n", (long) Next_Ptr_Glob->variant.var_1.Enum_Comp);
  594.     movel    _Next_Ptr_Glob,a0
  595.     movel    a0@(8),a7@-
  596.     movel    #.L63,a7@-
  597.     jbsr    _printf
  598. |   printf ("        should be:   %d\n", (long) 1);
  599.     pea    1:w
  600.     movel    #.L64,a7@-
  601.     jbsr    _printf
  602. |   printf ("  Int_Comp:          %d\n", (long) Next_Ptr_Glob->variant.var_1.Int_Comp);
  603.     movel    _Next_Ptr_Glob,a0
  604.     movel    a0@(12),a7@-
  605.     movel    #.L65,a7@-
  606.     jbsr    _printf
  607. |   printf ("        should be:   %d\n", (long) 18);
  608.     pea    18:w
  609.     movel    #.L66,a7@-
  610.     jbsr    _printf
  611. |   printf ("  Str_Comp:          %s\n",
  612.     movel    _Next_Ptr_Glob,a0
  613.     pea    a0@(16)
  614.     movel    #.L67,a7@-
  615.     jbsr    _printf
  616. |                                 Next_Ptr_Glob->variant.var_1.Str_Comp);
  617. |   printf ("        should be:   DHRYSTONE PROGRAM, SOME STRING\n");
  618.     movel    #.L68,a7@-
  619.     jbsr    _printf
  620. |   printf ("Int_1_Loc:           %d\n", (long) Int_1_Loc);
  621.     movel    a6@(-4),a7@-
  622.     movel    #.L69,a7@-
  623.     jbsr    _printf
  624. |   printf ("        should be:   %d\n", (long) 5);
  625.     pea    5:w
  626.     movel    #.L70,a7@-
  627.     jbsr    _printf
  628. |   printf ("Int_2_Loc:           %d\n", (long) Int_2_Loc);
  629.     movel    d5,a7@-
  630.     movel    #.L71,a7@-
  631.     jbsr    _printf
  632. |   printf ("        should be:   %d\n", (long) 13);
  633.     pea    13:w
  634.     movel    #.L72,a7@-
  635.     jbsr    _printf
  636. |   printf ("Int_3_Loc:           %d\n", (long) Int_3_Loc);
  637.     movel    a6@(-8),a7@-
  638.     movel    #.L73,a7@-
  639.     jbsr    _printf
  640. |   printf ("        should be:   %d\n", (long) 7);
  641.     pea    7:w
  642.     movel    #.L74,a7@-
  643.     jbsr    _printf
  644. |   printf ("Enum_Loc:            %d\n", (long) Enum_Loc);
  645.     movel    a6@(-12),a7@-
  646.     movel    #.L75,a7@-
  647.     jbsr    _printf
  648. |   printf ("        should be:   %d\n", (long) 1);
  649.     pea    1:w
  650.     movel    #.L76,a7@-
  651.     jbsr    _printf
  652. |   printf ("Str_1_Loc:           %s\n", Str_1_Loc);
  653.     pea    a6@(-44)
  654.     movel    #.L77,a7@-
  655.     jbsr    _printf
  656. |   printf ("        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n");
  657.     movel    #.L78,a7@-
  658.     jbsr    _printf
  659. |   printf ("Str_2_Loc:           %s\n", Str_2_Loc);
  660.     pea    a6@(-76)
  661.     movel    #.L79,a7@-
  662.     jbsr    _printf
  663. |   printf ("        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n");
  664.     movel    #.L80,a7@-
  665.     jbsr    _printf
  666. |   printf ("\n");
  667.     movel    #.L81,a7@-
  668.     jbsr    _printf
  669.     movel    _End_Time,d5
  670.     subl    _Begin_Time,d5
  671. |   User_Time = End_Time - Begin_Time;
  672.     movel    d5,_User_Time
  673. |   if (User_Time < Too_Small_Time)
  674.     lea    a7@(356),a7
  675.     cmpl    #128,d5
  676.     jge    .L90
  677. |   {
  678. |     printf ("Measured time too small to obtain meaningful results\n");
  679.     movel    #.L82,a7@-
  680.     jbsr    _printf
  681. |     printf ("Please increase number of runs\n");
  682.     movel    #.L83,a7@-
  683.     jbsr    _printf
  684. |     printf ("\n");
  685.     movel    #.L84,a7@-
  686.     jbsr    _printf
  687.     lea    a7@(12),a7
  688.     jra    .L1
  689. .L90:
  690.     fmovel    d3,fp1
  691.     fmull    #64,fp1
  692. |   }
  693. |   else
  694. |   {
  695. | #ifdef TIME
  696. |     Microseconds = (float) User_Time * Mic_secs_Per_Second 
  697. |                         / (float) Number_Of_Runs;
  698. |     Dhrystones_Per_Second = (float) Number_Of_Runs / (float) User_Time;
  699. | #else
  700. |     Microseconds = (float) User_Time * Mic_secs_Per_Second 
  701. |                         / ((float) HZ * ((float) Number_Of_Runs));
  702.     fmovel    d5,fp0
  703.     fmull    #1000000,fp0
  704.     fdivx    fp1,fp0
  705.     fmoves    fp0,_Microseconds
  706. |     Dhrystones_Per_Second = ((float) HZ * (float) Number_Of_Runs)
  707. |                         / (float) User_Time;
  708.     fmovex    fp1,fp0
  709.     fdivl    d5,fp0
  710.     fmoves    fp0,_Dhrystones_Per_Second
  711. | #endif
  712. |     printf ("Microseconds for one run through Dhrystone: ");
  713.     movel    #.L85,a7@-
  714.     jbsr    _printf
  715. |     printf ("%6.1f \n", Microseconds);
  716.     fmoves    _Microseconds,fp0
  717.     fmoved    fp0,a7@-
  718.     movel    #.L86,a7@-
  719.     jbsr    _printf
  720. |     printf ("Dhrystones per Second:                      ");
  721.     movel    #.L87,a7@-
  722.     jbsr    _printf
  723. |     printf ("%6.1f \n", Dhrystones_Per_Second);
  724.     fmoves    _Dhrystones_Per_Second,fp0
  725.     fmoved    fp0,a7@-
  726.     movel    #.L88,a7@-
  727.     jbsr    _printf
  728. |     printf ("\n");
  729.     movel    #.L89,a7@-
  730.     jbsr    _printf
  731.     lea    a7@(36),a7
  732. .L1:
  733. |   }
  734. |   
  735. | }
  736.     movel    a7@+,d3
  737.     movel    a7@+,d5
  738.     movel    a7@+,d6
  739.     movel    a7@+,a5
  740.     unlk    a6
  741.     rts
  742.  
  743. | Allocations for _main
  744.     .data
  745. |    a6@(-4)    Int_1_Loc
  746. |    d5    Int_2_Loc
  747. |    a6@(-8)    Int_3_Loc
  748. |    d7    Ch_Index
  749. |    a6@(-12)    Enum_Loc
  750. |    a6@(-44)    Str_1_Loc
  751. |    a6@(-76)    Str_2_Loc
  752. |    d6    Run_Index
  753. |    d3    Number_Of_Runs
  754. |    fp1    $$1
  755. |    a5    $$2
  756. |    a5    $$3
  757. |    d5    $$4
  758. |    d4    $$5
  759. |    d7    $$6
  760. |    d7    $$7
  761. |    a6@(-80)    n
  762. | Proc_1 (Ptr_Val_Par)
  763. | /******************/
  764. | REG Rec_Pointer Ptr_Val_Par;
  765. |     /* executed once */
  766. | {
  767.  
  768.     .text
  769.     .globl    _Proc_1
  770. _Proc_1:
  771. |$$v0
  772.     movel    a5,a7@-
  773.     movel    a4,a7@-
  774.     movel    a7@(12),a4
  775.     movel    a4@,a5
  776. |   REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;  
  777. |                                         /* == Ptr_Glob_Next */
  778. |   /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp,    */
  779. |   /* corresponds to "rename" in Ada, "with" in Pascal           */
  780. |   
  781. |   structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob); 
  782.     movel    a5,a0
  783.     movel    _Ptr_Glob,a1
  784.     movel    a1@+,a0@+
  785.     movel    a1@+,a0@+
  786.     movel    a1@+,a0@+
  787.     movel    a1@+,a0@+
  788.     movel    a1@+,a0@+
  789.     movel    a1@+,a0@+
  790.     movel    a1@+,a0@+
  791.     movel    a1@+,a0@+
  792.     movel    a1@+,a0@+
  793.     movel    a1@+,a0@+
  794.     movel    a1@+,a0@+
  795.     movel    a1@+,a0@+
  796.     moveq    #5,d0
  797. |   Ptr_Val_Par->variant.var_1.Int_Comp = 5;
  798.     movel    d0,a4@(12)
  799. |   Next_Record->variant.var_1.Int_Comp 
  800. |         = Ptr_Val_Par->variant.var_1.Int_Comp;
  801.     movel    d0,a5@(12)
  802. |   Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
  803.     movel    a4@,a5@
  804. |   Proc_3 (&Next_Record->Ptr_Comp);
  805.     movel    a5,a7@-
  806.     jbsr    _Proc_3
  807. |     /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp 
  808. |                         == Ptr_Glob->Ptr_Comp */
  809. |   if (Next_Record->Discr == Ident_1)
  810.     addql    #4,a7
  811.     tstl    a5@(4)
  812.     jne    .L95
  813. |     /* then, executed */
  814. |   {
  815. |     Next_Record->variant.var_1.Int_Comp = 6;
  816.     moveq    #6,d0
  817.     movel    d0,a5@(12)
  818. |     Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp, 
  819.     pea    a5@(8)
  820.     movel    a4@(8),a7@-
  821.     jbsr    _Proc_6
  822. |            &Next_Record->variant.var_1.Enum_Comp);
  823. |     Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
  824.     movel    _Ptr_Glob,a0
  825.     movel    a0@,a5@
  826. |     Proc_7 (Next_Record->variant.var_1.Int_Comp, 10, 
  827.     pea    a5@(12)
  828.     pea    10:w
  829.     movel    a5@(12),a7@-
  830.     jbsr    _Proc_7
  831.     lea    a7@(20),a7
  832.     jra    .L94
  833. .L95:
  834. |            &Next_Record->variant.var_1.Int_Comp);
  835. |   }
  836. |   else /* not executed */
  837. |     structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
  838.     movel    a4,a0
  839.     movel    a4@,a1
  840.     movel    a1@+,a0@+
  841.     movel    a1@+,a0@+
  842.     movel    a1@+,a0@+
  843.     movel    a1@+,a0@+
  844.     movel    a1@+,a0@+
  845.     movel    a1@+,a0@+
  846.     movel    a1@+,a0@+
  847.     movel    a1@+,a0@+
  848.     movel    a1@+,a0@+
  849.     movel    a1@+,a0@+
  850.     movel    a1@+,a0@+
  851.     movel    a1@+,a0@+
  852. .L94:
  853. | } /* Proc_1 */
  854.     movel    a7@+,a4
  855.     movel    a7@+,a5
  856.     rts
  857.  
  858. | Allocations for _Proc_1
  859.     .data
  860. |    a4    Ptr_Val_Par
  861. |    not allocated    Next_Record
  862. |    d0    $$8
  863. |    a5    $$9
  864. | Proc_2 (Int_Par_Ref)
  865. | /******************/
  866. |     /* executed once */
  867. |     /* *Int_Par_Ref == 1, becomes 4 */
  868. | One_Fifty   *Int_Par_Ref;
  869. | {
  870.  
  871.     .text
  872.     .globl    _Proc_2
  873. _Proc_2:
  874. |$$v0
  875. |   One_Fifty  Int_Loc;  
  876. |   Enumeration   Enum_Loc;
  877. |   Int_Loc = *Int_Par_Ref + 10;
  878.     movel    a7@(4),a0
  879.     moveq    #10,d1
  880.     addl    a0@,d1
  881. |   do /* executed once */
  882. |     if (Ch_1_Glob == 'A')
  883.     cmpb    #65,_Ch_1_Glob
  884.     jne    .L99
  885. |       /* then, executed */
  886. |     {
  887. |       Int_Loc -= 1;
  888.     subql    #1,d1
  889. |       *Int_Par_Ref = Int_Loc - Int_Glob;
  890.     movel    a7@(4),a0
  891.     movel    d1,d0
  892.     subl    _Int_Glob,d0
  893.     movel    d0,a0@
  894. .L99:
  895. |       Enum_Loc = Ident_1;
  896. |     } /* if */
  897. |   while (Enum_Loc != Ident_1); /* true */
  898. | } /* Proc_2 */
  899.     rts
  900.  
  901. | Allocations for _Proc_2
  902.     .data
  903. |    a6@(8)    Int_Par_Ref
  904. |    d1    Int_Loc
  905. |    not allocated    Enum_Loc
  906. | Proc_3 (Ptr_Ref_Par)
  907. | /******************/
  908. |     /* executed once */
  909. |     /* Ptr_Ref_Par becomes Ptr_Glob */
  910. | Rec_Pointer *Ptr_Ref_Par;
  911. | {
  912.  
  913.     .text
  914.     .globl    _Proc_3
  915. _Proc_3:
  916. |$$v0
  917.     movel    a7@(4),a0
  918.     movel    _Ptr_Glob,a1
  919. |   if (Ptr_Glob != Null)
  920.     tstl    a1
  921.     jeq    .L103
  922. |     /* then, executed */
  923. |     *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
  924.     movel    a1@,a0@
  925. .L103:
  926. |   Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
  927.     movel    _Ptr_Glob,a0
  928.     pea    a0@(12)
  929.     movel    _Int_Glob,a7@-
  930.     pea    10:w
  931.     jbsr    _Proc_7
  932.     lea    a7@(12),a7
  933. | } /* Proc_3 */
  934.     rts
  935.  
  936. | Allocations for _Proc_3
  937.     .data
  938. |    a0    Ptr_Ref_Par
  939. |    a1    $$10
  940. | Proc_4 () /* without parameters */
  941. | /*******/
  942. |     /* executed once */
  943. | {
  944.  
  945.     .text
  946.     .globl    _Proc_4
  947. _Proc_4:
  948. |$$v0
  949. |   Boolean Bool_Loc;
  950. |   Bool_Loc = Ch_1_Glob == 'A';
  951.     moveq    #0,d1
  952.     cmpb    #65,_Ch_1_Glob
  953.     seq    d1
  954.     negb    d1
  955. |   Bool_Glob = Bool_Loc | Bool_Glob;
  956.     movel    _Bool_Glob,d0
  957.     orl    d1,d0
  958.     movel    d0,_Bool_Glob
  959. |   Ch_2_Glob = 'B';
  960.     moveb    #66,_Ch_2_Glob
  961. | } /* Proc_4 */
  962.     rts
  963.  
  964. | Allocations for _Proc_4
  965.     .data
  966. |    d1    Bool_Loc
  967. | Proc_5 () /* without parameters */
  968. | /*******/
  969. |     /* executed once */
  970. | {
  971.  
  972.     .text
  973.     .globl    _Proc_5
  974. _Proc_5:
  975. |$$v0
  976. |   Ch_1_Glob = 'A';
  977.     moveb    #65,_Ch_1_Glob
  978. |   Bool_Glob = false;
  979.     clrl    _Bool_Glob
  980. | } /* Proc_5 */
  981.     rts
  982.  
  983. | Allocations for _Proc_5
  984.     .data
  985.  
  986. | Allocations for module
  987.     .data
  988.     .comm    _Ptr_Glob,4
  989.     .comm    _Next_Ptr_Glob,4
  990.     .comm    _Int_Glob,4
  991.     .comm    _Bool_Glob,4
  992.     .comm    _Ch_1_Glob,1
  993.     .comm    _Ch_2_Glob,1
  994.     .comm    _Arr_1_Glob,200
  995.     .comm    _Arr_2_Glob,10000
  996.     .align    4
  997.     .globl    _Reg
  998. _Reg:
  999.     .long    0
  1000.     .comm    _time_info,16
  1001.     .comm    _Begin_Time,4
  1002.     .comm    _End_Time,4
  1003.     .comm    _User_Time,4
  1004.     .comm    _Microseconds,4
  1005.     .comm    _Dhrystones_Per_Second,4
  1006.     .align    4
  1007. .L2:
  1008.     .ascii    "DHRYSTONE PROGRAM, SOME STRING"
  1009.     .byte    0
  1010.     .align    4
  1011. .L3:
  1012.     .ascii    "DHRYSTONE PROGRAM, 1'ST STRING"
  1013.     .byte    0
  1014.     .align    4
  1015. .L4:
  1016.     .ascii    "\n"
  1017.     .byte    0
  1018.     .align    4
  1019. .L5:
  1020.     .ascii    "Dhrystone Benchmark, Version 2.1 (Language: C)\n"
  1021.     .byte    0
  1022.     .align    4
  1023. .L6:
  1024.     .ascii    "\n"
  1025.     .byte    0
  1026.     .align    4
  1027. .L7:
  1028.     .ascii    "Program compiled with 'register' attribute\n"
  1029.     .byte    0
  1030.     .align    4
  1031. .L8:
  1032.     .ascii    "\n"
  1033.     .byte    0
  1034.     .align    4
  1035. .L9:
  1036.     .ascii    "Program compiled without 'register' attribute\n"
  1037.     .byte    0
  1038.     .align    4
  1039. .L10:
  1040.     .ascii    "\n"
  1041.     .byte    0
  1042.     .align    4
  1043. .L13:
  1044.     .ascii    "Please give the number of runs through the benchmark: "
  1045.     .byte    0
  1046.     .align    4
  1047. .L14:
  1048.     .ascii    "%d"
  1049.     .byte    0
  1050.     .align    4
  1051. .L15:
  1052.     .ascii    "\n"
  1053.     .byte    0
  1054.     .align    4
  1055. .L16:
  1056.     .ascii    "Execution starts, %d runs through Dhrystone\n"
  1057.     .byte    0
  1058.     .align    4
  1059. .L19:
  1060.     .ascii    "DHRYSTONE PROGRAM, 2'ND STRING"
  1061.     .byte    0
  1062.     .align    4
  1063. .L25:
  1064.     .ascii    "DHRYSTONE PROGRAM, 3'RD STRING"
  1065.     .byte    0
  1066.     .align    4
  1067. .L31:
  1068.     .ascii    "Execution ends\n"
  1069.     .byte    0
  1070.     .align    4
  1071. .L32:
  1072.     .ascii    "\n"
  1073.     .byte    0
  1074.     .align    4
  1075. .L33:
  1076.     .ascii    "Final values of the variables used in the benchmark:\n"
  1077.     .byte    0
  1078.     .align    4
  1079. .L34:
  1080.     .ascii    "\n"
  1081.     .byte    0
  1082.     .align    4
  1083. .L35:
  1084.     .ascii    "Int_Glob:            %d\n"
  1085.     .byte    0
  1086.     .align    4
  1087. .L36:
  1088.     .ascii    "        should be:   %d\n"
  1089.     .byte    0
  1090.     .align    4
  1091. .L37:
  1092.     .ascii    "Bool_Glob:           %d\n"
  1093.     .byte    0
  1094.     .align    4
  1095. .L38:
  1096.     .ascii    "        should be:   %d\n"
  1097.     .byte    0
  1098.     .align    4
  1099. .L39:
  1100.     .ascii    "Ch_1_Glob:           %c\n"
  1101.     .byte    0
  1102.     .align    4
  1103. .L40:
  1104.     .ascii    "        should be:   %c\n"
  1105.     .byte    0
  1106.     .align    4
  1107. .L41:
  1108.     .ascii    "Ch_2_Glob:           %c\n"
  1109.     .byte    0
  1110.     .align    4
  1111. .L42:
  1112.     .ascii    "        should be:   %c\n"
  1113.     .byte    0
  1114.     .align    4
  1115. .L43:
  1116.     .ascii    "Arr_1_Glob[8]:       %d\n"
  1117.     .byte    0
  1118.     .align    4
  1119. .L44:
  1120.     .ascii    "        should be:   %d\n"
  1121.     .byte    0
  1122.     .align    4
  1123. .L45:
  1124.     .ascii    "Arr_2_Glob[8][7]:    %d\n"
  1125.     .byte    0
  1126.     .align    4
  1127. .L46:
  1128.     .ascii    "        should be:   Number_Of_Runs + 10\n"
  1129.     .byte    0
  1130.     .align    4
  1131. .L47:
  1132.     .ascii    "Ptr_Glob->\n"
  1133.     .byte    0
  1134.     .align    4
  1135. .L48:
  1136.     .ascii    "  Ptr_Comp:          %d\n"
  1137.     .byte    0
  1138.     .align    4
  1139. .L49:
  1140.     .ascii    "        should be:   (implementation-dependent)\n"
  1141.     .byte    0
  1142.     .align    4
  1143. .L50:
  1144.     .ascii    "  Discr:             %d\n"
  1145.     .byte    0
  1146.     .align    4
  1147. .L51:
  1148.     .ascii    "        should be:   %d\n"
  1149.     .byte    0
  1150.     .align    4
  1151. .L52:
  1152.     .ascii    "  Enum_Comp:         %d\n"
  1153.     .byte    0
  1154.     .align    4
  1155. .L53:
  1156.     .ascii    "        should be:   %d\n"
  1157.     .byte    0
  1158.     .align    4
  1159. .L54:
  1160.     .ascii    "  Int_Comp:          %d\n"
  1161.     .byte    0
  1162.     .align    4
  1163. .L55:
  1164.     .ascii    "        should be:   %d\n"
  1165.     .byte    0
  1166.     .align    4
  1167. .L56:
  1168.     .ascii    "  Str_Comp:          %s\n"
  1169.     .byte    0
  1170.     .align    4
  1171. .L57:
  1172.     .ascii    "        should be:   DHRYSTONE PROGRAM, SOME STRING\n"
  1173.     .byte    0
  1174.     .align    4
  1175. .L58:
  1176.     .ascii    "Next_Ptr_Glob->\n"
  1177.     .byte    0
  1178.     .align    4
  1179. .L59:
  1180.     .ascii    "  Ptr_Comp:          %d\n"
  1181.     .byte    0
  1182.     .align    4
  1183. .L60:
  1184.     .ascii    "        should be:   (implementation-dependent), same as abo"
  1185.     .ascii    "ve\n"
  1186.     .byte    0
  1187.     .align    4
  1188. .L61:
  1189.     .ascii    "  Discr:             %d\n"
  1190.     .byte    0
  1191.     .align    4
  1192. .L62:
  1193.     .ascii    "        should be:   %d\n"
  1194.     .byte    0
  1195.     .align    4
  1196. .L63:
  1197.     .ascii    "  Enum_Comp:         %d\n"
  1198.     .byte    0
  1199.     .align    4
  1200. .L64:
  1201.     .ascii    "        should be:   %d\n"
  1202.     .byte    0
  1203.     .align    4
  1204. .L65:
  1205.     .ascii    "  Int_Comp:          %d\n"
  1206.     .byte    0
  1207.     .align    4
  1208. .L66:
  1209.     .ascii    "        should be:   %d\n"
  1210.     .byte    0
  1211.     .align    4
  1212. .L67:
  1213.     .ascii    "  Str_Comp:          %s\n"
  1214.     .byte    0
  1215.     .align    4
  1216. .L68:
  1217.     .ascii    "        should be:   DHRYSTONE PROGRAM, SOME STRING\n"
  1218.     .byte    0
  1219.     .align    4
  1220. .L69:
  1221.     .ascii    "Int_1_Loc:           %d\n"
  1222.     .byte    0
  1223.     .align    4
  1224. .L70:
  1225.     .ascii    "        should be:   %d\n"
  1226.     .byte    0
  1227.     .align    4
  1228. .L71:
  1229.     .ascii    "Int_2_Loc:           %d\n"
  1230.     .byte    0
  1231.     .align    4
  1232. .L72:
  1233.     .ascii    "        should be:   %d\n"
  1234.     .byte    0
  1235.     .align    4
  1236. .L73:
  1237.     .ascii    "Int_3_Loc:           %d\n"
  1238.     .byte    0
  1239.     .align    4
  1240. .L74:
  1241.     .ascii    "        should be:   %d\n"
  1242.     .byte    0
  1243.     .align    4
  1244. .L75:
  1245.     .ascii    "Enum_Loc:            %d\n"
  1246.     .byte    0
  1247.     .align    4
  1248. .L76:
  1249.     .ascii    "        should be:   %d\n"
  1250.     .byte    0
  1251.     .align    4
  1252. .L77:
  1253.     .ascii    "Str_1_Loc:           %s\n"
  1254.     .byte    0
  1255.     .align    4
  1256. .L78:
  1257.     .ascii    "        should be:   DHRYSTONE PROGRAM, 1'ST STRING\n"
  1258.     .byte    0
  1259.     .align    4
  1260. .L79:
  1261.     .ascii    "Str_2_Loc:           %s\n"
  1262.     .byte    0
  1263.     .align    4
  1264. .L80:
  1265.     .ascii    "        should be:   DHRYSTONE PROGRAM, 2'ND STRING\n"
  1266.     .byte    0
  1267.     .align    4
  1268. .L81:
  1269.     .ascii    "\n"
  1270.     .byte    0
  1271.     .align    4
  1272. .L82:
  1273.     .ascii    "Measured time too small to obtain meaningful results\n"
  1274.     .byte    0
  1275.     .align    4
  1276. .L83:
  1277.     .ascii    "Please increase number of runs\n"
  1278.     .byte    0
  1279.     .align    4
  1280. .L84:
  1281.     .ascii    "\n"
  1282.     .byte    0
  1283.     .align    4
  1284. .L85:
  1285.     .ascii    "Microseconds for one run through Dhrystone: "
  1286.     .byte    0
  1287.     .align    4
  1288. .L86:
  1289.     .ascii    "%6.1f \n"
  1290.     .byte    0
  1291.     .align    4
  1292. .L87:
  1293.     .ascii    "Dhrystones per Second:                      "
  1294.     .byte    0
  1295.     .align    4
  1296. .L88:
  1297.     .ascii    "%6.1f \n"
  1298.     .byte    0
  1299.     .align    4
  1300. .L89:
  1301.     .ascii    "\n"
  1302.     .byte    0
  1303.     .text
  1304. SHAR_EOF
  1305. fi # end of overwriting check
  1306. if test -f 'dhry_2.s'
  1307. then
  1308. echo shar: will not over-write existing file "'dhry_2.s'"
  1309. else
  1310. cat > 'dhry_2.s' << \SHAR_EOF
  1311. |$$p68020    - MC68020/30 CPU
  1312. |$$m0        - MIT mnemonics
  1313. |$$k0        - Reorder info
  1314. | /*
  1315. |  ****************************************************************************
  1316. |  *
  1317. |  *                   "DHRYSTONE" Benchmark Program
  1318. |  *                   -----------------------------
  1319. |  *                                                                            
  1320. |  *  Version:    C, Version 2.1
  1321. |  *                                                                            
  1322. |  *  File:       dhry_2.c (part 3 of 3)
  1323. |  *
  1324. |  *  Date:       May 17, 1988
  1325. |  *
  1326. |  *  Author:     Reinhold P. Weicker
  1327. |  *
  1328. |  ****************************************************************************
  1329. |  */
  1330. | #include "dhry.h"
  1331. | #ifndef REG
  1332. | #define REG
  1333. |         /* REG becomes defined as empty */
  1334. |         /* i.e. no register variables   */
  1335. | #endif
  1336. | extern  int     Int_Glob;
  1337. | extern  char    Ch_1_Glob;
  1338. | Proc_6 (Enum_Val_Par, Enum_Ref_Par)
  1339. | /*********************************/
  1340. |     /* executed once */
  1341. |     /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
  1342. | Enumeration  Enum_Val_Par;
  1343. | Enumeration *Enum_Ref_Par;
  1344. | {
  1345.  
  1346.     .text
  1347.     .globl    _Proc_6
  1348. _Proc_6:
  1349. |$$v0
  1350.     movel    a5,a7@-
  1351.     movel    d7,a7@-
  1352.     movel    a7@(12),d7
  1353.     movel    a7@(16),a5
  1354. |   *Enum_Ref_Par = Enum_Val_Par;
  1355.     movel    d7,a5@
  1356. |   if (! Func_3 (Enum_Val_Par))
  1357.     movel    d7,a7@-
  1358.     jbsr    _Func_3
  1359.     addql    #4,a7
  1360.     tstl    d0
  1361.     jne    .L2
  1362. |     /* then, not executed */
  1363. |     *Enum_Ref_Par = Ident_4;
  1364.     moveq    #3,d0
  1365.     movel    d0,a5@
  1366. .L2:
  1367. |   switch (Enum_Val_Par)
  1368.     movel    d7,d0
  1369.     moveq    #4,d1
  1370.     cmpl    d1,d0
  1371.     jhi    .L1
  1372.     .long    0x303B0A06    | movew    pc@(6,d0:l*2),d0
  1373.     .long    0x4EFB0002    | jmp    pc@(2,d0:w)
  1374. .L11:
  1375.     .word    .L4-.L11
  1376.     .word    .L5-.L11
  1377.     .word    .L8-.L11
  1378.     .word    .L1-.L11
  1379.     .word    .L10-.L11
  1380. .L4:
  1381. |   {
  1382. |     case Ident_1: 
  1383. |       *Enum_Ref_Par = Ident_1;
  1384.     clrl    a5@
  1385.     jra    .L1
  1386. .L5:
  1387. |       break;
  1388. |     case Ident_2: 
  1389. |       if (Int_Glob > 100)
  1390.     moveq    #100,d0
  1391.     cmpl    _Int_Glob,d0
  1392.     jge    .L6
  1393. |         /* then */
  1394. |       *Enum_Ref_Par = Ident_1;
  1395.     clrl    a5@
  1396.     jra    .L1
  1397. .L6:
  1398. |       else *Enum_Ref_Par = Ident_4;
  1399.     moveq    #3,d0
  1400.     movel    d0,a5@
  1401.     jra    .L1
  1402. .L8:
  1403. |       break;
  1404. |     case Ident_3: /* executed */
  1405. |       *Enum_Ref_Par = Ident_2;
  1406.     moveq    #1,d0
  1407.     movel    d0,a5@
  1408.     jra    .L1
  1409. .L10:
  1410. |       break;
  1411. |     case Ident_4: break;
  1412. |     case Ident_5: 
  1413. |       *Enum_Ref_Par = Ident_3;
  1414.     moveq    #2,d0
  1415.     movel    d0,a5@
  1416. .L1:
  1417. |       break;
  1418. |   } /* switch */
  1419. | } /* Proc_6 */
  1420.     movel    a7@+,d7
  1421.     movel    a7@+,a5
  1422.     rts
  1423.  
  1424. | Allocations for _Proc_6
  1425.     .data
  1426. |    d7    Enum_Val_Par
  1427. |    a5    Enum_Ref_Par
  1428. | Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
  1429. | /**********************************************/
  1430. |     /* executed three times                                      */ 
  1431. |     /* first call:      Int_1_Par_Val == 2, Int_2_Par_Val == 3,  */
  1432. |     /*                  Int_Par_Ref becomes 7                    */
  1433. |     /* second call:     Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
  1434. |     /*                  Int_Par_Ref becomes 17                   */
  1435. |     /* third call:      Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
  1436. |     /*                  Int_Par_Ref becomes 18                   */
  1437. | One_Fifty       Int_1_Par_Val;
  1438. | One_Fifty       Int_2_Par_Val;
  1439. | One_Fifty      *Int_Par_Ref;
  1440. | {
  1441.  
  1442.     .text
  1443.     .globl    _Proc_7
  1444. _Proc_7:
  1445. |$$v0
  1446.     movel    a7@(4),d1
  1447. |   One_Fifty Int_Loc;
  1448. |   Int_Loc = Int_1_Par_Val + 2;
  1449.     addql    #2,d1
  1450. |   *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
  1451.     movel    a7@(12),a0
  1452.     movel    d1,d0
  1453.     addl    a7@(8),d0
  1454.     movel    d0,a0@
  1455. | } /* Proc_7 */
  1456.     rts
  1457.  
  1458. | Allocations for _Proc_7
  1459.     .data
  1460. |    d1    Int_1_Par_Val
  1461. |    a6@(12)    Int_2_Par_Val
  1462. |    a6@(16)    Int_Par_Ref
  1463. |    d1    Int_Loc
  1464. | Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
  1465. | /*********************************************************************/
  1466. |     /* executed once      */
  1467. |     /* Int_Par_Val_1 == 3 */
  1468. |     /* Int_Par_Val_2 == 7 */
  1469. | Arr_1_Dim       Arr_1_Par_Ref;
  1470. | Arr_2_Dim       Arr_2_Par_Ref;
  1471. | int             Int_1_Par_Val;
  1472. | int             Int_2_Par_Val;
  1473. | {
  1474.  
  1475.     .text
  1476.     .globl    _Proc_8
  1477. _Proc_8:
  1478. |$$v0
  1479.     movel    a5,a7@-
  1480.     movel    d7,a7@-
  1481.     movel    a7@(12),a1
  1482.     movel    a7@(16),a5
  1483.     movel    a7@(20),d7
  1484.     movel    a7@(24),d0
  1485. |   REG One_Fifty Int_Index;
  1486. |   REG One_Fifty Int_Loc;
  1487. |   Int_Loc = Int_1_Par_Val + 5;
  1488.     addql    #5,d7
  1489. |   Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
  1490. |***    movel    d0,a1@(d7:l*4)
  1491.  .long 0x23807d10
  1492. |   Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
  1493. |***    movel    d0,a1@(4,d7:l*4)
  1494.  .long 0x23807c04
  1495. |   Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
  1496. |***    movel    d7,a1@(120,d7:l*4)
  1497.  .long 0x23877c78
  1498.     movel    d7,d0
  1499.     lsll    #3,d0
  1500.     movel    d0,d1
  1501.     lsll    #3,d0
  1502.     addl    d0,d1
  1503.     addl    d0,d0
  1504.     addl    d0,d1
  1505.     addl    d1,a5
  1506. |***    lea    a5@(d7:l*4),a0
  1507.  .long 0x41f57d10
  1508. |   for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
  1509. |     Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
  1510.     movel    d7,a0@
  1511.     movel    d7,a0@(4)
  1512. |***    lea    a5@(d7:l*4),a5
  1513.  .long 0x4bf57d10
  1514. |   Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
  1515.     addql    #1,a5@(-4)
  1516. |   Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
  1517. |***    movel    a1@(d7:l*4),a5@(4000)
  1518.  .long 0x2b717d10
  1519.  .word 0x0fa0
  1520. |   Int_Glob = 5;
  1521.     moveq    #5,d0
  1522.     movel    d0,_Int_Glob
  1523. | } /* Proc_8 */
  1524.     movel    a7@+,d7
  1525.     movel    a7@+,a5
  1526.     rts
  1527.  
  1528. | Allocations for _Proc_8
  1529.     .data
  1530. |    a1    Arr_1_Par_Ref
  1531. |    a5    Arr_2_Par_Ref
  1532. |    d7    Int_1_Par_Val
  1533. |    d0    Int_2_Par_Val
  1534. |    not allocated    Int_Index
  1535. |    d7    Int_Loc
  1536. |    a0    $$1
  1537. |    a5    $$2
  1538. |    d0    $$3
  1539. |    a5    $$4
  1540. | Enumeration Func_1 (Ch_1_Par_Val, Ch_2_Par_Val)
  1541. | /*************************************************/
  1542. |     /* executed three times                                         */
  1543. |     /* first call:      Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R'    */
  1544. |     /* second call:     Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C'    */
  1545. |     /* third call:      Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C'    */
  1546. | Capital_Letter   Ch_1_Par_Val;
  1547. | Capital_Letter   Ch_2_Par_Val;
  1548. | {
  1549.  
  1550.     .text
  1551.     .globl    _Func_1
  1552. _Func_1:
  1553. |$$v0
  1554. |   Capital_Letter        Ch_1_Loc;
  1555. |   Capital_Letter        Ch_2_Loc;
  1556. |   Ch_1_Loc = Ch_1_Par_Val;
  1557. |   Ch_2_Loc = Ch_1_Loc;
  1558. |   if (Ch_2_Loc != Ch_2_Par_Val)
  1559.     moveb    a7@(11),d0
  1560.     cmpb    a7@(7),d0
  1561.     jeq    .L19
  1562. |     /* then, executed */
  1563. |     return (Ident_1);
  1564.     moveq    #0,d0
  1565.     rts
  1566. .L19:
  1567. |   else  /* not executed */
  1568. |   {
  1569. |     Ch_1_Glob = Ch_1_Loc;
  1570.     moveb    a7@(7),_Ch_1_Glob
  1571. |     return (Ident_2);
  1572.     moveq    #1,d0
  1573. .L18:
  1574. |    }
  1575. | } /* Func_1 */
  1576.     rts
  1577.  
  1578. | Allocations for _Func_1
  1579.     .data
  1580. |    a6@(11)    Ch_1_Par_Val
  1581. |    a6@(15)    Ch_2_Par_Val
  1582. |    not allocated    Ch_1_Loc
  1583. |    not allocated    Ch_2_Loc
  1584. | Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref)
  1585. | /*************************************************/
  1586. |     /* executed once */
  1587. |     /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
  1588. |     /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
  1589. | Str_30  Str_1_Par_Ref;
  1590. | Str_30  Str_2_Par_Ref;
  1591. | {
  1592.  
  1593.     .text
  1594.     .globl    _Func_2
  1595. _Func_2:
  1596. |$$v0
  1597.     movel    d7,a7@-
  1598.     movel    a7@(8),a1
  1599.     movel    a7@(12),a0
  1600. |   REG One_Thirty        Int_Loc;
  1601. |       Capital_Letter    Ch_Loc;
  1602. |   Int_Loc = 2;
  1603.     moveq    #2,d7
  1604. .L25:
  1605. |   while (Int_Loc <= 2) /* loop body executed once */
  1606. |     if (Func_1 (Str_1_Par_Ref[Int_Loc],
  1607. |                 Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
  1608.     moveb    a0@(1,d7),d0
  1609.     movel    d0,a7@-
  1610.     moveb    a1@(d7),d0
  1611.     movel    d0,a7@-
  1612.     jbsr    _Func_1
  1613.     addql    #8,a7
  1614.     tstl    d0
  1615.     jne    .L23
  1616. |       /* then, executed */
  1617. |     {
  1618. |       Ch_Loc = 'A';
  1619. |       Int_Loc += 1;
  1620.     addql    #1,d7
  1621. .L23:
  1622.     moveq    #2,d0
  1623.     cmpl    d7,d0
  1624.     jge    .L25
  1625. |     } /* if, while */
  1626. |   if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
  1627. |     /* then, not executed */
  1628. |     Int_Loc = 7;
  1629. |   if (Ch_Loc == 'R')
  1630. |     /* then, not executed */
  1631. |     return (true);
  1632. |   else /* executed */
  1633. |   {
  1634. |     if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
  1635.     movel    a0,a7@-
  1636.     movel    a1,a7@-
  1637.     jbsr    _strcmp
  1638.     addql    #8,a7
  1639.     tstl    d0
  1640.     jle    .L27
  1641. |       /* then, not executed */
  1642. |     {
  1643. |       Int_Loc += 7;
  1644.     addql    #7,d7
  1645. |       Int_Glob = Int_Loc;
  1646.     movel    d7,_Int_Glob
  1647. |       return (true);
  1648.     moveq    #1,d0
  1649.     jra    .L21
  1650. .L27:
  1651. |     }
  1652. |     else /* executed */
  1653. |       return (false);
  1654.     moveq    #0,d0
  1655. .L21:
  1656. |   } /* if Ch_Loc */
  1657. | } /* Func_2 */
  1658.     movel    a7@+,d7
  1659.     rts
  1660.  
  1661. | Allocations for _Func_2
  1662.     .data
  1663. |    a1    Str_1_Par_Ref
  1664. |    a0    Str_2_Par_Ref
  1665. |    d7    Int_Loc
  1666. |    not allocated    Ch_Loc
  1667. | Boolean Func_3 (Enum_Par_Val)
  1668. | /***************************/
  1669. |     /* executed once        */
  1670. |     /* Enum_Par_Val == Ident_3 */
  1671. | Enumeration Enum_Par_Val;
  1672. | {
  1673.  
  1674.     .text
  1675.     .globl    _Func_3
  1676. _Func_3:
  1677. |$$v0
  1678. |   Enumeration Enum_Loc;
  1679. |   Enum_Loc = Enum_Par_Val;
  1680. |   if (Enum_Loc == Ident_3)
  1681. |     /* then, executed */
  1682. |     return (true);
  1683.     moveq    #0,d0
  1684.     cmpl    #2,a7@(4)
  1685.     seq    d0
  1686.     negb    d0
  1687. |   else /* not executed */
  1688. |     return (false);
  1689. | } /* Func_3 */
  1690.     rts
  1691.  
  1692. | Allocations for _Func_3
  1693.     .data
  1694. |    a6@(8)    Enum_Par_Val
  1695. |    not allocated    Enum_Loc
  1696.  
  1697. | Allocations for module
  1698.     .data
  1699.     .text
  1700. SHAR_EOF
  1701. fi # end of overwriting check
  1702. #
  1703. # End of shell archive
  1704. #
  1705. exit 0
  1706. -- 
  1707. +----------------+
  1708. ! II      CCCCCC !  Jim Cathey
  1709. ! II  SSSSCC     !  ISC-Bunker Ramo
  1710. ! II      CC     !  TAF-C8;  Spokane, WA  99220
  1711. ! IISSSS  CC     !  UUCP: uunet!isc-br!jimc (jimc@isc-br.isc-br.com)
  1712. ! II      CCCCCC !  (509) 927-5757
  1713. +----------------+
  1714.             "PC's --- the junk bonds of the computer industry"
  1715.