home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-08-30 | 37.1 KB | 1,781 lines |
- Path: sparky!uunet!ulowell!news.bbn.com!olivea!isc-br!tau-ceti!jimc
- From: jimc@tau-ceti.isc-br.com (Jim Cathey)
- Newsgroups: comp.sys.next.misc
- Subject: C compiler optimization
- Message-ID: <2578@tau-ceti.isc-br.com>
- Date: 30 Aug 92 01:45:56 GMT
- Organization: ISC - Bunker Ramo, Spokane, WA
- Lines: 1771
-
- OK, I was (finally!) able to get our dcc compiler to generate a Dhrystone
- test for my NeXT ('030 cube) to compare its code with gcc's. For those
- who don't remember, dcc (Diab's C compiler) does a pretty good job at
- optimization, and is now available for NeXT (although, sans Objective C
- extensions). Here are the numbers I got ('030 cube, 2.1 software, single-
- user mode, average of 3 times to 3 sig figs):
-
- gcc (reg) 5880
- dcc 7490
-
- Dcc generally does a better job if you don't use the register
- declarative. It makes me wonder how much more usable my cube would be
- had a decent C compiler been used to build everything! Disclaimer: I
- have no connection with Diab except as a happy customer, and that I've
- met the author.
-
- I've enclosed the assembly-language output of the compiler for your
- perusal, and for maybe running on a 040 machine. The C-source as
- comments is one of the dcc's options, which makes some kinds of
- debugging easier. Note that I had to hand-assemble (actually I used
- our system's assembler) some of the opcodes, since **@#$ gas apparently
- doesn't know about some of the 68020/30/40's addressing modes, and dcc
- uses them (though gcc obviously doesn't). Also, the code has not been
- run through Diab's 68040 code-rearranger, which tries to do pipeline
- rearrangement. It runs against the assembly-language file, and
- doesn't recognize the syntax variant that gas uses. I don't know
- what (if any) difference it would have made on this particular program.
-
- -- Jim
- #
- # This is a Shell Archive.
- # Remove everything above and including the cut line.
- # Then run the rest of the file through #! /bin/sh.
- # -----cut here-----cut here-----cut here-----cut here-----
- #! /bin/sh
- # Execute the file with #! /bin/sh (not csh) to create the files:
- # dhry_1.s
- # dhry_2.s
- # This Archive created: Sat Aug 29 18:32:36 1992
- # By: Jim Cathey at ISC - Bunker Ramo, Spokane, WA
- #
- export PATH; PATH=/bin:$PATH
- if test -f 'dhry_1.s'
- then
- echo shar: will not over-write existing file "'dhry_1.s'"
- else
- cat > 'dhry_1.s' << \SHAR_EOF
- |$$p68020 - MC68020/30 CPU
- |$$m0 - MIT mnemonics
- |$$k0 - Reorder info
- | /*
- | ****************************************************************************
- | *
- | * "DHRYSTONE" Benchmark Program
- | * -----------------------------
- | *
- | * Version: C, Version 2.1
- | *
- | * File: dhry_1.c (part 2 of 3)
- | *
- | * Date: May 17, 1988
- | *
- | * Author: Reinhold P. Weicker
- | *
- | ****************************************************************************
- | */
- |
- | #include "dhry.h"
- |
- | /* Global Variables: */
- |
- | #ifdef DNIX
- | #ifndef F_UNAME
- | #include <dnix/fcodes.h>
- | #include <dnix/dutsname.h>
- | #endif
- | #endif
- | #ifdef DNIX
- | int HZ;
- | #endif
- |
- | Rec_Pointer Ptr_Glob,
- | Next_Ptr_Glob;
- | int Int_Glob;
- | Boolean Bool_Glob;
- | char Ch_1_Glob,
- | Ch_2_Glob;
- | int Arr_1_Glob [50];
- | int Arr_2_Glob [50] [50];
- |
- | extern char *malloc (long size);
- | Enumeration Func_1 ();
- | /* forward declaration necessary since Enumeration may not simply be int */
- |
- | #ifndef REG
- | Boolean Reg = false;
- | #define REG
- | /* REG becomes defined as empty */
- | /* i.e. no register variables */
- | #else
- | Boolean Reg = true;
- | #endif
- |
- | /* variables for time measurement: */
- |
- | #ifdef TIMES
- | struct tms time_info;
- | extern int times ();
- | /* see library function "times" */
- | #define Too_Small_Time (2*HZ)
- | /* Measurements should last at least about 2 seconds */
- | #endif
- | #ifdef TIME
- | extern long time();
- | /* see library function "time" */
- | #define Too_Small_Time 2
- | /* Measurements should last at least 2 seconds */
- | #endif
- | #ifdef MSC_CLOCK
- | extern clock_t clock();
- | #define Too_Small_Time (2*HZ)
- | #endif
- |
- | long Begin_Time,
- | End_Time,
- | User_Time;
- | float Microseconds,
- | Dhrystones_Per_Second;
- |
- | /* end of variables for time measurement */
- |
- |
- | main ()
- | /*****/
- |
- | /* main program, corresponds to procedures */
- | /* Main and Proc_0 in the Ada version */
- | {
-
- .text
- .globl _main
- _main:
- |$$v0
- link a6,#-80
- moveml #5636,a7@- | d3,d5,d6,a5
- | One_Fifty Int_1_Loc;
- | REG One_Fifty Int_2_Loc;
- | One_Fifty Int_3_Loc;
- | REG char Ch_Index;
- | Enumeration Enum_Loc;
- | Str_30 Str_1_Loc;
- | Str_30 Str_2_Loc;
- | REG int Run_Index;
- | REG int Number_Of_Runs;
- |
- | /* Initializations */
- |
- | #ifdef DNIX
- | struct dutsname duts;
- | long dnix();
- | if (dnix((long) F_UNAME, &duts, (long) sizeof(duts)) < 0) {
- | exit(1);
- | }
- | HZ = duts.clocktics;
- | printf("HZ = %d\n", (long) HZ);
- | #endif
- | Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
- pea 48:w
- jbsr _malloc
- movel d0,_Next_Ptr_Glob
- | Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
- pea 48:w
- jbsr _malloc
- movel d0,_Ptr_Glob
- |
- | Ptr_Glob->Ptr_Comp = Next_Ptr_Glob;
- movel _Ptr_Glob,a0
- movel _Next_Ptr_Glob,a0@
- | Ptr_Glob->Discr = Ident_1;
- movel _Ptr_Glob,a0
- clrl a0@(4)
- | Ptr_Glob->variant.var_1.Enum_Comp = Ident_3;
- movel _Ptr_Glob,a0
- moveq #2,d0
- movel d0,a0@(8)
- | Ptr_Glob->variant.var_1.Int_Comp = 40;
- movel _Ptr_Glob,a0
- moveq #40,d0
- movel d0,a0@(12)
- | strcpy (Ptr_Glob->variant.var_1.Str_Comp,
- movel #.L2,a0
- movel _Ptr_Glob,a1
- lea a1@(16),a1
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movew a0@+,a1@+
- moveb a0@+,a1@+
- | "DHRYSTONE PROGRAM, SOME STRING");
- | strcpy (Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");
- movel #.L3,a0
- lea a6@(-44),a1
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movew a0@+,a1@+
- moveb a0@+,a1@+
- |
- | Arr_2_Glob [8][7] = 10;
- moveq #10,d0
- movel d0,_Arr_2_Glob+1628
- | /* Was missing in published program. Without this statement, */
- | /* Arr_2_Glob [8][7] would have an undefined value. */
- | /* Warning: With 16-Bit processors and Number_Of_Runs > 32000, */
- | /* overflow may occur for this array element. */
- |
- | printf ("\n");
- movel #.L4,a7@-
- jbsr _printf
- | printf ("Dhrystone Benchmark, Version 2.1 (Language: C)\n");
- movel #.L5,a7@-
- jbsr _printf
- | printf ("\n");
- movel #.L6,a7@-
- jbsr _printf
- | if (Reg)
- lea a7@(20),a7
- tstl _Reg
- jeq .L11
- | {
- | printf ("Program compiled with 'register' attribute\n");
- movel #.L7,a7@-
- jbsr _printf
- | printf ("\n");
- movel #.L8,a7@-
- jbsr _printf
- addql #8,a7
- jra .L12
- .L11:
- | }
- | else
- | {
- | printf ("Program compiled without 'register' attribute\n");
- movel #.L9,a7@-
- jbsr _printf
- | printf ("\n");
- movel #.L10,a7@-
- jbsr _printf
- addql #8,a7
- .L12:
- | }
- | printf ("Please give the number of runs through the benchmark: ");
- movel #.L13,a7@-
- jbsr _printf
- | {
- | long n;
- | scanf ("%d", &n);
- pea a6@(-80)
- movel #.L14,a7@-
- jbsr _scanf
- | Number_Of_Runs = n;
- movel a6@(-80),d3
- | }
- | printf ("\n");
- movel #.L15,a7@-
- jbsr _printf
- |
- | printf ("Execution starts, %d runs through Dhrystone\n", (long) Number_Of_Runs);
- movel d3,a7@-
- movel #.L16,a7@-
- jbsr _printf
- movel #_time_info,a5
- |
- | /***************/
- | /* Start timer */
- | /***************/
- |
- | #ifdef TIMES
- | times (&time_info);
- movel a5,a7@-
- jbsr _times
- | Begin_Time = (long) time_info.tms_utime;
- movel a5@,_Begin_Time
- | #endif
- | #ifdef TIME
- | Begin_Time = time ( (long *) 0);
- | #endif
- | #ifdef MSC_CLOCK
- | Begin_Time = clock();
- | #endif
- |
- | for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)
- moveq #1,d6
- lea a7@(28),a7
- tstl d3
- jle .L93
- movel d7,a7@-
- movel d4,a7@-
- .L30:
- | {
- |
- | Proc_5();
- jbsr _Proc_5
- | Proc_4();
- jbsr _Proc_4
- | /* Ch_1_Glob == 'A', Ch_2_Glob == 'B', Bool_Glob == true */
- | Int_1_Loc = 2;
- moveq #2,d0
- movel d0,a6@(-4)
- | Int_2_Loc = 3;
- moveq #3,d5
- | strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 2'ND STRING");
- movel #.L19,a0
- lea a6@(-76),a1
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movew a0@+,a1@+
- moveb a0@+,a1@+
- | Enum_Loc = Ident_2;
- moveq #1,d0
- movel d0,a6@(-12)
- | Bool_Glob = ! Func_2 (Str_1_Loc, Str_2_Loc);
- pea a6@(-76)
- pea a6@(-44)
- jbsr _Func_2
- tstl d0
- seq d0
- andl #1,d0
- movel d0,_Bool_Glob
- addql #8,a7
- jra .L92
- .L22:
- movel a6@(-4),d7
- | /* Bool_Glob == 1 */
- | while (Int_1_Loc < Int_2_Loc) /* loop body executed once */
- | {
- | Int_3_Loc = 5 * Int_1_Loc - Int_2_Loc;
- movel d7,d0
- movel d0,d1
- lsll #2,d0
- addl d0,d1
- subql #3,d1
- movel d1,a6@(-8)
- | /* Int_3_Loc == 7 */
- | Proc_7 (Int_1_Loc, Int_2_Loc, &Int_3_Loc);
- pea a6@(-8)
- pea 3:w
- movel d7,a7@-
- jbsr _Proc_7
- | /* Int_3_Loc == 7 */
- | Int_1_Loc += 1;
- addql #1,a6@(-4)
- lea a7@(12),a7
- .L92:
- moveq #3,d0
- cmpl a6@(-4),d0
- jgt .L22
- | } /* while */
- | /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
- | Proc_8 (Arr_1_Glob, Arr_2_Glob, Int_1_Loc, Int_3_Loc);
- movel a6@(-8),a7@-
- movel a6@(-4),a7@-
- movel #_Arr_2_Glob,a7@-
- movel #_Arr_1_Glob,a7@-
- jbsr _Proc_8
- | /* Int_Glob == 5 */
- | Proc_1 (Ptr_Glob);
- movel _Ptr_Glob,a7@-
- jbsr _Proc_1
- | for (Ch_Index = 'A'; Ch_Index <= Ch_2_Glob; ++Ch_Index)
- moveq #65,d7
- lea a7@(20),a7
- cmpb #65,_Ch_2_Glob
- jlt .L23
- .L28:
- | /* loop body executed twice */
- | {
- | if (Enum_Loc == Func_1 (Ch_Index, 'C'))
- pea 67:w
- extbl d7
- movel d7,a7@-
- jbsr _Func_1
- addql #8,a7
- cmpl a6@(-12),d0
- jne .L24
- | /* then, not executed */
- | {
- | Proc_6 (Ident_1, &Enum_Loc);
- pea a6@(-12)
- clrl a7@-
- jbsr _Proc_6
- | strcpy (Str_2_Loc, "DHRYSTONE PROGRAM, 3'RD STRING");
- movel #.L25,a0
- lea a6@(-76),a1
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movel a0@+,a1@+
- movew a0@+,a1@+
- moveb a0@+,a1@+
- | Int_2_Loc = Run_Index;
- movel d6,d5
- | Int_Glob = Run_Index;
- movel d6,_Int_Glob
- addql #8,a7
- .L24:
- addqb #1,d7
- cmpb _Ch_2_Glob,d7
- jle .L28
- .L23:
- | }
- | }
- | /* Int_1_Loc == 3, Int_2_Loc == 3, Int_3_Loc == 7 */
- | Int_2_Loc = Int_2_Loc * Int_1_Loc;
- mulsl a6@(-4),d5
- movel a6@(-8),d7
- movel d5,d4
- divsl d7,d4
- | Int_1_Loc = Int_2_Loc / Int_3_Loc;
- movel d4,a6@(-4)
- | Int_2_Loc = 7 * (Int_2_Loc - Int_3_Loc) - Int_1_Loc;
- movel d5,d0
- subl d7,d0
- moveq #0,d1
- subl d0,d1
- lsll #3,d0
- addl d0,d1
- subl d4,d1
- movel d1,d5
- | /* Int_1_Loc == 1, Int_2_Loc == 13, Int_3_Loc == 7 */
- | Proc_2 (&Int_1_Loc);
- pea a6@(-4)
- jbsr _Proc_2
- addql #1,d6
- addql #4,a7
- cmpl d3,d6
- jle .L30
- movel a7@+,d4
- movel a7@+,d7
- .L93:
- movel #_time_info,a5
- | /* Int_1_Loc == 5 */
- |
- | } /* loop "for Run_Index" */
- |
- | /**************/
- | /* Stop timer */
- | /**************/
- |
- | #ifdef TIMES
- | times (&time_info);
- movel a5,a7@-
- jbsr _times
- | End_Time = (long) time_info.tms_utime;
- movel a5@,_End_Time
- | #endif
- | #ifdef TIME
- | End_Time = time ( (long *) 0);
- | #endif
- | #ifdef MSC_CLOCK
- | End_Time = clock();
- | #endif
- |
- | printf ("Execution ends\n");
- movel #.L31,a7@-
- jbsr _printf
- | printf ("\n");
- movel #.L32,a7@-
- jbsr _printf
- | printf ("Final values of the variables used in the benchmark:\n");
- movel #.L33,a7@-
- jbsr _printf
- | printf ("\n");
- movel #.L34,a7@-
- jbsr _printf
- | printf ("Int_Glob: %d\n", (long) Int_Glob);
- movel _Int_Glob,a7@-
- movel #.L35,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 5);
- pea 5:w
- movel #.L36,a7@-
- jbsr _printf
- | printf ("Bool_Glob: %d\n", (long) Bool_Glob);
- movel _Bool_Glob,a7@-
- movel #.L37,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 1);
- pea 1:w
- movel #.L38,a7@-
- jbsr _printf
- | printf ("Ch_1_Glob: %c\n", (long) Ch_1_Glob);
- moveb _Ch_1_Glob,d0
- extbl d0
- movel d0,a7@-
- movel #.L39,a7@-
- jbsr _printf
- | printf (" should be: %c\n", (long) 'A');
- pea 65:w
- movel #.L40,a7@-
- jbsr _printf
- | printf ("Ch_2_Glob: %c\n", (long) Ch_2_Glob);
- moveb _Ch_2_Glob,d0
- extbl d0
- movel d0,a7@-
- movel #.L41,a7@-
- jbsr _printf
- | printf (" should be: %c\n", (long) 'B');
- pea 66:w
- movel #.L42,a7@-
- jbsr _printf
- | printf ("Arr_1_Glob[8]: %d\n", (long) Arr_1_Glob[8]);
- movel _Arr_1_Glob+32,a7@-
- movel #.L43,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 7);
- pea 7:w
- movel #.L44,a7@-
- jbsr _printf
- | printf ("Arr_2_Glob[8][7]: %d\n", (long) Arr_2_Glob[8][7]);
- movel _Arr_2_Glob+1628,a7@-
- movel #.L45,a7@-
- jbsr _printf
- | printf (" should be: Number_Of_Runs + 10\n");
- movel #.L46,a7@-
- jbsr _printf
- | printf ("Ptr_Glob->\n");
- movel #.L47,a7@-
- jbsr _printf
- | printf (" Ptr_Comp: %d\n", (long) Ptr_Glob->Ptr_Comp);
- movel _Ptr_Glob,a0
- movel a0@,a7@-
- movel #.L48,a7@-
- jbsr _printf
- | printf (" should be: (implementation-dependent)\n");
- movel #.L49,a7@-
- jbsr _printf
- | printf (" Discr: %d\n", (long) Ptr_Glob->Discr);
- movel _Ptr_Glob,a0
- movel a0@(4),a7@-
- movel #.L50,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 0);
- clrl a7@-
- movel #.L51,a7@-
- jbsr _printf
- | printf (" Enum_Comp: %d\n", (long) Ptr_Glob->variant.var_1.Enum_Comp);
- movel _Ptr_Glob,a0
- movel a0@(8),a7@-
- movel #.L52,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 2);
- pea 2:w
- movel #.L53,a7@-
- jbsr _printf
- | printf (" Int_Comp: %d\n", (long) Ptr_Glob->variant.var_1.Int_Comp);
- movel _Ptr_Glob,a0
- movel a0@(12),a7@-
- movel #.L54,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 17);
- pea 17:w
- movel #.L55,a7@-
- jbsr _printf
- | printf (" Str_Comp: %s\n", Ptr_Glob->variant.var_1.Str_Comp);
- movel _Ptr_Glob,a0
- pea a0@(16)
- movel #.L56,a7@-
- jbsr _printf
- | printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n");
- movel #.L57,a7@-
- jbsr _printf
- | printf ("Next_Ptr_Glob->\n");
- movel #.L58,a7@-
- jbsr _printf
- | printf (" Ptr_Comp: %d\n", (long) Next_Ptr_Glob->Ptr_Comp);
- movel _Next_Ptr_Glob,a0
- movel a0@,a7@-
- movel #.L59,a7@-
- jbsr _printf
- | printf (" should be: (implementation-dependent), same as above\n");
- movel #.L60,a7@-
- jbsr _printf
- | printf (" Discr: %d\n", (long) Next_Ptr_Glob->Discr);
- movel _Next_Ptr_Glob,a0
- movel a0@(4),a7@-
- movel #.L61,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 0);
- clrl a7@-
- movel #.L62,a7@-
- jbsr _printf
- | printf (" Enum_Comp: %d\n", (long) Next_Ptr_Glob->variant.var_1.Enum_Comp);
- movel _Next_Ptr_Glob,a0
- movel a0@(8),a7@-
- movel #.L63,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 1);
- pea 1:w
- movel #.L64,a7@-
- jbsr _printf
- | printf (" Int_Comp: %d\n", (long) Next_Ptr_Glob->variant.var_1.Int_Comp);
- movel _Next_Ptr_Glob,a0
- movel a0@(12),a7@-
- movel #.L65,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 18);
- pea 18:w
- movel #.L66,a7@-
- jbsr _printf
- | printf (" Str_Comp: %s\n",
- movel _Next_Ptr_Glob,a0
- pea a0@(16)
- movel #.L67,a7@-
- jbsr _printf
- | Next_Ptr_Glob->variant.var_1.Str_Comp);
- | printf (" should be: DHRYSTONE PROGRAM, SOME STRING\n");
- movel #.L68,a7@-
- jbsr _printf
- | printf ("Int_1_Loc: %d\n", (long) Int_1_Loc);
- movel a6@(-4),a7@-
- movel #.L69,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 5);
- pea 5:w
- movel #.L70,a7@-
- jbsr _printf
- | printf ("Int_2_Loc: %d\n", (long) Int_2_Loc);
- movel d5,a7@-
- movel #.L71,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 13);
- pea 13:w
- movel #.L72,a7@-
- jbsr _printf
- | printf ("Int_3_Loc: %d\n", (long) Int_3_Loc);
- movel a6@(-8),a7@-
- movel #.L73,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 7);
- pea 7:w
- movel #.L74,a7@-
- jbsr _printf
- | printf ("Enum_Loc: %d\n", (long) Enum_Loc);
- movel a6@(-12),a7@-
- movel #.L75,a7@-
- jbsr _printf
- | printf (" should be: %d\n", (long) 1);
- pea 1:w
- movel #.L76,a7@-
- jbsr _printf
- | printf ("Str_1_Loc: %s\n", Str_1_Loc);
- pea a6@(-44)
- movel #.L77,a7@-
- jbsr _printf
- | printf (" should be: DHRYSTONE PROGRAM, 1'ST STRING\n");
- movel #.L78,a7@-
- jbsr _printf
- | printf ("Str_2_Loc: %s\n", Str_2_Loc);
- pea a6@(-76)
- movel #.L79,a7@-
- jbsr _printf
- | printf (" should be: DHRYSTONE PROGRAM, 2'ND STRING\n");
- movel #.L80,a7@-
- jbsr _printf
- | printf ("\n");
- movel #.L81,a7@-
- jbsr _printf
- movel _End_Time,d5
- subl _Begin_Time,d5
- |
- | User_Time = End_Time - Begin_Time;
- movel d5,_User_Time
- |
- | if (User_Time < Too_Small_Time)
- lea a7@(356),a7
- cmpl #128,d5
- jge .L90
- | {
- | printf ("Measured time too small to obtain meaningful results\n");
- movel #.L82,a7@-
- jbsr _printf
- | printf ("Please increase number of runs\n");
- movel #.L83,a7@-
- jbsr _printf
- | printf ("\n");
- movel #.L84,a7@-
- jbsr _printf
- lea a7@(12),a7
- jra .L1
- .L90:
- fmovel d3,fp1
- fmull #64,fp1
- | }
- | else
- | {
- | #ifdef TIME
- | Microseconds = (float) User_Time * Mic_secs_Per_Second
- | / (float) Number_Of_Runs;
- | Dhrystones_Per_Second = (float) Number_Of_Runs / (float) User_Time;
- | #else
- | Microseconds = (float) User_Time * Mic_secs_Per_Second
- | / ((float) HZ * ((float) Number_Of_Runs));
- fmovel d5,fp0
- fmull #1000000,fp0
- fdivx fp1,fp0
- fmoves fp0,_Microseconds
- | Dhrystones_Per_Second = ((float) HZ * (float) Number_Of_Runs)
- | / (float) User_Time;
- fmovex fp1,fp0
- fdivl d5,fp0
- fmoves fp0,_Dhrystones_Per_Second
- | #endif
- | printf ("Microseconds for one run through Dhrystone: ");
- movel #.L85,a7@-
- jbsr _printf
- | printf ("%6.1f \n", Microseconds);
- fmoves _Microseconds,fp0
- fmoved fp0,a7@-
- movel #.L86,a7@-
- jbsr _printf
- | printf ("Dhrystones per Second: ");
- movel #.L87,a7@-
- jbsr _printf
- | printf ("%6.1f \n", Dhrystones_Per_Second);
- fmoves _Dhrystones_Per_Second,fp0
- fmoved fp0,a7@-
- movel #.L88,a7@-
- jbsr _printf
- | printf ("\n");
- movel #.L89,a7@-
- jbsr _printf
- lea a7@(36),a7
- .L1:
- | }
- |
- | }
- movel a7@+,d3
- movel a7@+,d5
- movel a7@+,d6
- movel a7@+,a5
- unlk a6
- rts
-
- | Allocations for _main
- .data
- | a6@(-4) Int_1_Loc
- | d5 Int_2_Loc
- | a6@(-8) Int_3_Loc
- | d7 Ch_Index
- | a6@(-12) Enum_Loc
- | a6@(-44) Str_1_Loc
- | a6@(-76) Str_2_Loc
- | d6 Run_Index
- | d3 Number_Of_Runs
- | fp1 $$1
- | a5 $$2
- | a5 $$3
- | d5 $$4
- | d4 $$5
- | d7 $$6
- | d7 $$7
- | a6@(-80) n
- |
- |
- | Proc_1 (Ptr_Val_Par)
- | /******************/
- |
- | REG Rec_Pointer Ptr_Val_Par;
- | /* executed once */
- | {
-
- .text
- .globl _Proc_1
- _Proc_1:
- |$$v0
- movel a5,a7@-
- movel a4,a7@-
- movel a7@(12),a4
- movel a4@,a5
- | REG Rec_Pointer Next_Record = Ptr_Val_Par->Ptr_Comp;
- | /* == Ptr_Glob_Next */
- | /* Local variable, initialized with Ptr_Val_Par->Ptr_Comp, */
- | /* corresponds to "rename" in Ada, "with" in Pascal */
- |
- | structassign (*Ptr_Val_Par->Ptr_Comp, *Ptr_Glob);
- movel a5,a0
- movel _Ptr_Glob,a1
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- moveq #5,d0
- | Ptr_Val_Par->variant.var_1.Int_Comp = 5;
- movel d0,a4@(12)
- | Next_Record->variant.var_1.Int_Comp
- | = Ptr_Val_Par->variant.var_1.Int_Comp;
- movel d0,a5@(12)
- | Next_Record->Ptr_Comp = Ptr_Val_Par->Ptr_Comp;
- movel a4@,a5@
- | Proc_3 (&Next_Record->Ptr_Comp);
- movel a5,a7@-
- jbsr _Proc_3
- | /* Ptr_Val_Par->Ptr_Comp->Ptr_Comp
- | == Ptr_Glob->Ptr_Comp */
- | if (Next_Record->Discr == Ident_1)
- addql #4,a7
- tstl a5@(4)
- jne .L95
- | /* then, executed */
- | {
- | Next_Record->variant.var_1.Int_Comp = 6;
- moveq #6,d0
- movel d0,a5@(12)
- | Proc_6 (Ptr_Val_Par->variant.var_1.Enum_Comp,
- pea a5@(8)
- movel a4@(8),a7@-
- jbsr _Proc_6
- | &Next_Record->variant.var_1.Enum_Comp);
- | Next_Record->Ptr_Comp = Ptr_Glob->Ptr_Comp;
- movel _Ptr_Glob,a0
- movel a0@,a5@
- | Proc_7 (Next_Record->variant.var_1.Int_Comp, 10,
- pea a5@(12)
- pea 10:w
- movel a5@(12),a7@-
- jbsr _Proc_7
- lea a7@(20),a7
- jra .L94
- .L95:
- | &Next_Record->variant.var_1.Int_Comp);
- | }
- | else /* not executed */
- | structassign (*Ptr_Val_Par, *Ptr_Val_Par->Ptr_Comp);
- movel a4,a0
- movel a4@,a1
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- movel a1@+,a0@+
- .L94:
- | } /* Proc_1 */
- movel a7@+,a4
- movel a7@+,a5
- rts
-
- | Allocations for _Proc_1
- .data
- | a4 Ptr_Val_Par
- | not allocated Next_Record
- | d0 $$8
- | a5 $$9
- |
- |
- | Proc_2 (Int_Par_Ref)
- | /******************/
- | /* executed once */
- | /* *Int_Par_Ref == 1, becomes 4 */
- |
- | One_Fifty *Int_Par_Ref;
- | {
-
- .text
- .globl _Proc_2
- _Proc_2:
- |$$v0
- | One_Fifty Int_Loc;
- | Enumeration Enum_Loc;
- |
- | Int_Loc = *Int_Par_Ref + 10;
- movel a7@(4),a0
- moveq #10,d1
- addl a0@,d1
- | do /* executed once */
- | if (Ch_1_Glob == 'A')
- cmpb #65,_Ch_1_Glob
- jne .L99
- | /* then, executed */
- | {
- | Int_Loc -= 1;
- subql #1,d1
- | *Int_Par_Ref = Int_Loc - Int_Glob;
- movel a7@(4),a0
- movel d1,d0
- subl _Int_Glob,d0
- movel d0,a0@
- .L99:
- | Enum_Loc = Ident_1;
- | } /* if */
- | while (Enum_Loc != Ident_1); /* true */
- | } /* Proc_2 */
- rts
-
- | Allocations for _Proc_2
- .data
- | a6@(8) Int_Par_Ref
- | d1 Int_Loc
- | not allocated Enum_Loc
- |
- |
- | Proc_3 (Ptr_Ref_Par)
- | /******************/
- | /* executed once */
- | /* Ptr_Ref_Par becomes Ptr_Glob */
- |
- | Rec_Pointer *Ptr_Ref_Par;
- |
- | {
-
- .text
- .globl _Proc_3
- _Proc_3:
- |$$v0
- movel a7@(4),a0
- movel _Ptr_Glob,a1
- | if (Ptr_Glob != Null)
- tstl a1
- jeq .L103
- | /* then, executed */
- | *Ptr_Ref_Par = Ptr_Glob->Ptr_Comp;
- movel a1@,a0@
- .L103:
- | Proc_7 (10, Int_Glob, &Ptr_Glob->variant.var_1.Int_Comp);
- movel _Ptr_Glob,a0
- pea a0@(12)
- movel _Int_Glob,a7@-
- pea 10:w
- jbsr _Proc_7
- lea a7@(12),a7
- | } /* Proc_3 */
- rts
-
- | Allocations for _Proc_3
- .data
- | a0 Ptr_Ref_Par
- | a1 $$10
- |
- |
- | Proc_4 () /* without parameters */
- | /*******/
- | /* executed once */
- | {
-
- .text
- .globl _Proc_4
- _Proc_4:
- |$$v0
- | Boolean Bool_Loc;
- |
- | Bool_Loc = Ch_1_Glob == 'A';
- moveq #0,d1
- cmpb #65,_Ch_1_Glob
- seq d1
- negb d1
- | Bool_Glob = Bool_Loc | Bool_Glob;
- movel _Bool_Glob,d0
- orl d1,d0
- movel d0,_Bool_Glob
- | Ch_2_Glob = 'B';
- moveb #66,_Ch_2_Glob
- | } /* Proc_4 */
- rts
-
- | Allocations for _Proc_4
- .data
- | d1 Bool_Loc
- |
- |
- | Proc_5 () /* without parameters */
- | /*******/
- | /* executed once */
- | {
-
- .text
- .globl _Proc_5
- _Proc_5:
- |$$v0
- | Ch_1_Glob = 'A';
- moveb #65,_Ch_1_Glob
- | Bool_Glob = false;
- clrl _Bool_Glob
- | } /* Proc_5 */
- rts
-
- | Allocations for _Proc_5
- .data
-
- | Allocations for module
- .data
- .comm _Ptr_Glob,4
- .comm _Next_Ptr_Glob,4
- .comm _Int_Glob,4
- .comm _Bool_Glob,4
- .comm _Ch_1_Glob,1
- .comm _Ch_2_Glob,1
- .comm _Arr_1_Glob,200
- .comm _Arr_2_Glob,10000
- .align 4
- .globl _Reg
- _Reg:
- .long 0
- .comm _time_info,16
- .comm _Begin_Time,4
- .comm _End_Time,4
- .comm _User_Time,4
- .comm _Microseconds,4
- .comm _Dhrystones_Per_Second,4
- .align 4
- .L2:
- .ascii "DHRYSTONE PROGRAM, SOME STRING"
- .byte 0
- .align 4
- .L3:
- .ascii "DHRYSTONE PROGRAM, 1'ST STRING"
- .byte 0
- .align 4
- .L4:
- .ascii "\n"
- .byte 0
- .align 4
- .L5:
- .ascii "Dhrystone Benchmark, Version 2.1 (Language: C)\n"
- .byte 0
- .align 4
- .L6:
- .ascii "\n"
- .byte 0
- .align 4
- .L7:
- .ascii "Program compiled with 'register' attribute\n"
- .byte 0
- .align 4
- .L8:
- .ascii "\n"
- .byte 0
- .align 4
- .L9:
- .ascii "Program compiled without 'register' attribute\n"
- .byte 0
- .align 4
- .L10:
- .ascii "\n"
- .byte 0
- .align 4
- .L13:
- .ascii "Please give the number of runs through the benchmark: "
- .byte 0
- .align 4
- .L14:
- .ascii "%d"
- .byte 0
- .align 4
- .L15:
- .ascii "\n"
- .byte 0
- .align 4
- .L16:
- .ascii "Execution starts, %d runs through Dhrystone\n"
- .byte 0
- .align 4
- .L19:
- .ascii "DHRYSTONE PROGRAM, 2'ND STRING"
- .byte 0
- .align 4
- .L25:
- .ascii "DHRYSTONE PROGRAM, 3'RD STRING"
- .byte 0
- .align 4
- .L31:
- .ascii "Execution ends\n"
- .byte 0
- .align 4
- .L32:
- .ascii "\n"
- .byte 0
- .align 4
- .L33:
- .ascii "Final values of the variables used in the benchmark:\n"
- .byte 0
- .align 4
- .L34:
- .ascii "\n"
- .byte 0
- .align 4
- .L35:
- .ascii "Int_Glob: %d\n"
- .byte 0
- .align 4
- .L36:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L37:
- .ascii "Bool_Glob: %d\n"
- .byte 0
- .align 4
- .L38:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L39:
- .ascii "Ch_1_Glob: %c\n"
- .byte 0
- .align 4
- .L40:
- .ascii " should be: %c\n"
- .byte 0
- .align 4
- .L41:
- .ascii "Ch_2_Glob: %c\n"
- .byte 0
- .align 4
- .L42:
- .ascii " should be: %c\n"
- .byte 0
- .align 4
- .L43:
- .ascii "Arr_1_Glob[8]: %d\n"
- .byte 0
- .align 4
- .L44:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L45:
- .ascii "Arr_2_Glob[8][7]: %d\n"
- .byte 0
- .align 4
- .L46:
- .ascii " should be: Number_Of_Runs + 10\n"
- .byte 0
- .align 4
- .L47:
- .ascii "Ptr_Glob->\n"
- .byte 0
- .align 4
- .L48:
- .ascii " Ptr_Comp: %d\n"
- .byte 0
- .align 4
- .L49:
- .ascii " should be: (implementation-dependent)\n"
- .byte 0
- .align 4
- .L50:
- .ascii " Discr: %d\n"
- .byte 0
- .align 4
- .L51:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L52:
- .ascii " Enum_Comp: %d\n"
- .byte 0
- .align 4
- .L53:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L54:
- .ascii " Int_Comp: %d\n"
- .byte 0
- .align 4
- .L55:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L56:
- .ascii " Str_Comp: %s\n"
- .byte 0
- .align 4
- .L57:
- .ascii " should be: DHRYSTONE PROGRAM, SOME STRING\n"
- .byte 0
- .align 4
- .L58:
- .ascii "Next_Ptr_Glob->\n"
- .byte 0
- .align 4
- .L59:
- .ascii " Ptr_Comp: %d\n"
- .byte 0
- .align 4
- .L60:
- .ascii " should be: (implementation-dependent), same as abo"
- .ascii "ve\n"
- .byte 0
- .align 4
- .L61:
- .ascii " Discr: %d\n"
- .byte 0
- .align 4
- .L62:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L63:
- .ascii " Enum_Comp: %d\n"
- .byte 0
- .align 4
- .L64:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L65:
- .ascii " Int_Comp: %d\n"
- .byte 0
- .align 4
- .L66:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L67:
- .ascii " Str_Comp: %s\n"
- .byte 0
- .align 4
- .L68:
- .ascii " should be: DHRYSTONE PROGRAM, SOME STRING\n"
- .byte 0
- .align 4
- .L69:
- .ascii "Int_1_Loc: %d\n"
- .byte 0
- .align 4
- .L70:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L71:
- .ascii "Int_2_Loc: %d\n"
- .byte 0
- .align 4
- .L72:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L73:
- .ascii "Int_3_Loc: %d\n"
- .byte 0
- .align 4
- .L74:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L75:
- .ascii "Enum_Loc: %d\n"
- .byte 0
- .align 4
- .L76:
- .ascii " should be: %d\n"
- .byte 0
- .align 4
- .L77:
- .ascii "Str_1_Loc: %s\n"
- .byte 0
- .align 4
- .L78:
- .ascii " should be: DHRYSTONE PROGRAM, 1'ST STRING\n"
- .byte 0
- .align 4
- .L79:
- .ascii "Str_2_Loc: %s\n"
- .byte 0
- .align 4
- .L80:
- .ascii " should be: DHRYSTONE PROGRAM, 2'ND STRING\n"
- .byte 0
- .align 4
- .L81:
- .ascii "\n"
- .byte 0
- .align 4
- .L82:
- .ascii "Measured time too small to obtain meaningful results\n"
- .byte 0
- .align 4
- .L83:
- .ascii "Please increase number of runs\n"
- .byte 0
- .align 4
- .L84:
- .ascii "\n"
- .byte 0
- .align 4
- .L85:
- .ascii "Microseconds for one run through Dhrystone: "
- .byte 0
- .align 4
- .L86:
- .ascii "%6.1f \n"
- .byte 0
- .align 4
- .L87:
- .ascii "Dhrystones per Second: "
- .byte 0
- .align 4
- .L88:
- .ascii "%6.1f \n"
- .byte 0
- .align 4
- .L89:
- .ascii "\n"
- .byte 0
- .text
- SHAR_EOF
- fi # end of overwriting check
- if test -f 'dhry_2.s'
- then
- echo shar: will not over-write existing file "'dhry_2.s'"
- else
- cat > 'dhry_2.s' << \SHAR_EOF
- |$$p68020 - MC68020/30 CPU
- |$$m0 - MIT mnemonics
- |$$k0 - Reorder info
- | /*
- | ****************************************************************************
- | *
- | * "DHRYSTONE" Benchmark Program
- | * -----------------------------
- | *
- | * Version: C, Version 2.1
- | *
- | * File: dhry_2.c (part 3 of 3)
- | *
- | * Date: May 17, 1988
- | *
- | * Author: Reinhold P. Weicker
- | *
- | ****************************************************************************
- | */
- |
- | #include "dhry.h"
- |
- | #ifndef REG
- | #define REG
- | /* REG becomes defined as empty */
- | /* i.e. no register variables */
- | #endif
- |
- | extern int Int_Glob;
- | extern char Ch_1_Glob;
- |
- |
- | Proc_6 (Enum_Val_Par, Enum_Ref_Par)
- | /*********************************/
- | /* executed once */
- | /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
- |
- | Enumeration Enum_Val_Par;
- | Enumeration *Enum_Ref_Par;
- | {
-
- .text
- .globl _Proc_6
- _Proc_6:
- |$$v0
- movel a5,a7@-
- movel d7,a7@-
- movel a7@(12),d7
- movel a7@(16),a5
- | *Enum_Ref_Par = Enum_Val_Par;
- movel d7,a5@
- | if (! Func_3 (Enum_Val_Par))
- movel d7,a7@-
- jbsr _Func_3
- addql #4,a7
- tstl d0
- jne .L2
- | /* then, not executed */
- | *Enum_Ref_Par = Ident_4;
- moveq #3,d0
- movel d0,a5@
- .L2:
- | switch (Enum_Val_Par)
- movel d7,d0
- moveq #4,d1
- cmpl d1,d0
- jhi .L1
- .long 0x303B0A06 | movew pc@(6,d0:l*2),d0
- .long 0x4EFB0002 | jmp pc@(2,d0:w)
- .L11:
- .word .L4-.L11
- .word .L5-.L11
- .word .L8-.L11
- .word .L1-.L11
- .word .L10-.L11
- .L4:
- | {
- | case Ident_1:
- | *Enum_Ref_Par = Ident_1;
- clrl a5@
- jra .L1
- .L5:
- | break;
- | case Ident_2:
- | if (Int_Glob > 100)
- moveq #100,d0
- cmpl _Int_Glob,d0
- jge .L6
- | /* then */
- | *Enum_Ref_Par = Ident_1;
- clrl a5@
- jra .L1
- .L6:
- | else *Enum_Ref_Par = Ident_4;
- moveq #3,d0
- movel d0,a5@
- jra .L1
- .L8:
- | break;
- | case Ident_3: /* executed */
- | *Enum_Ref_Par = Ident_2;
- moveq #1,d0
- movel d0,a5@
- jra .L1
- .L10:
- | break;
- | case Ident_4: break;
- | case Ident_5:
- | *Enum_Ref_Par = Ident_3;
- moveq #2,d0
- movel d0,a5@
- .L1:
- | break;
- | } /* switch */
- | } /* Proc_6 */
- movel a7@+,d7
- movel a7@+,a5
- rts
-
- | Allocations for _Proc_6
- .data
- | d7 Enum_Val_Par
- | a5 Enum_Ref_Par
- |
- |
- | Proc_7 (Int_1_Par_Val, Int_2_Par_Val, Int_Par_Ref)
- | /**********************************************/
- | /* executed three times */
- | /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
- | /* Int_Par_Ref becomes 7 */
- | /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
- | /* Int_Par_Ref becomes 17 */
- | /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
- | /* Int_Par_Ref becomes 18 */
- | One_Fifty Int_1_Par_Val;
- | One_Fifty Int_2_Par_Val;
- | One_Fifty *Int_Par_Ref;
- | {
-
- .text
- .globl _Proc_7
- _Proc_7:
- |$$v0
- movel a7@(4),d1
- | One_Fifty Int_Loc;
- |
- | Int_Loc = Int_1_Par_Val + 2;
- addql #2,d1
- | *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
- movel a7@(12),a0
- movel d1,d0
- addl a7@(8),d0
- movel d0,a0@
- | } /* Proc_7 */
- rts
-
- | Allocations for _Proc_7
- .data
- | d1 Int_1_Par_Val
- | a6@(12) Int_2_Par_Val
- | a6@(16) Int_Par_Ref
- | d1 Int_Loc
- |
- |
- | Proc_8 (Arr_1_Par_Ref, Arr_2_Par_Ref, Int_1_Par_Val, Int_2_Par_Val)
- | /*********************************************************************/
- | /* executed once */
- | /* Int_Par_Val_1 == 3 */
- | /* Int_Par_Val_2 == 7 */
- | Arr_1_Dim Arr_1_Par_Ref;
- | Arr_2_Dim Arr_2_Par_Ref;
- | int Int_1_Par_Val;
- | int Int_2_Par_Val;
- | {
-
- .text
- .globl _Proc_8
- _Proc_8:
- |$$v0
- movel a5,a7@-
- movel d7,a7@-
- movel a7@(12),a1
- movel a7@(16),a5
- movel a7@(20),d7
- movel a7@(24),d0
- | REG One_Fifty Int_Index;
- | REG One_Fifty Int_Loc;
- |
- | Int_Loc = Int_1_Par_Val + 5;
- addql #5,d7
- | Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
- |*** movel d0,a1@(d7:l*4)
- .long 0x23807d10
- | Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
- |*** movel d0,a1@(4,d7:l*4)
- .long 0x23807c04
- | Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
- |*** movel d7,a1@(120,d7:l*4)
- .long 0x23877c78
- movel d7,d0
- lsll #3,d0
- movel d0,d1
- lsll #3,d0
- addl d0,d1
- addl d0,d0
- addl d0,d1
- addl d1,a5
- |*** lea a5@(d7:l*4),a0
- .long 0x41f57d10
- | for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
- | Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
- movel d7,a0@
- movel d7,a0@(4)
- |*** lea a5@(d7:l*4),a5
- .long 0x4bf57d10
- | Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
- addql #1,a5@(-4)
- | Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
- |*** movel a1@(d7:l*4),a5@(4000)
- .long 0x2b717d10
- .word 0x0fa0
- | Int_Glob = 5;
- moveq #5,d0
- movel d0,_Int_Glob
- | } /* Proc_8 */
- movel a7@+,d7
- movel a7@+,a5
- rts
-
- | Allocations for _Proc_8
- .data
- | a1 Arr_1_Par_Ref
- | a5 Arr_2_Par_Ref
- | d7 Int_1_Par_Val
- | d0 Int_2_Par_Val
- | not allocated Int_Index
- | d7 Int_Loc
- | a0 $$1
- | a5 $$2
- | d0 $$3
- | a5 $$4
- |
- |
- | Enumeration Func_1 (Ch_1_Par_Val, Ch_2_Par_Val)
- | /*************************************************/
- | /* executed three times */
- | /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */
- | /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */
- | /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */
- |
- | Capital_Letter Ch_1_Par_Val;
- | Capital_Letter Ch_2_Par_Val;
- | {
-
- .text
- .globl _Func_1
- _Func_1:
- |$$v0
- | Capital_Letter Ch_1_Loc;
- | Capital_Letter Ch_2_Loc;
- |
- | Ch_1_Loc = Ch_1_Par_Val;
- | Ch_2_Loc = Ch_1_Loc;
- | if (Ch_2_Loc != Ch_2_Par_Val)
- moveb a7@(11),d0
- cmpb a7@(7),d0
- jeq .L19
- | /* then, executed */
- | return (Ident_1);
- moveq #0,d0
- rts
- .L19:
- | else /* not executed */
- | {
- | Ch_1_Glob = Ch_1_Loc;
- moveb a7@(7),_Ch_1_Glob
- | return (Ident_2);
- moveq #1,d0
- .L18:
- | }
- | } /* Func_1 */
- rts
-
- | Allocations for _Func_1
- .data
- | a6@(11) Ch_1_Par_Val
- | a6@(15) Ch_2_Par_Val
- | not allocated Ch_1_Loc
- | not allocated Ch_2_Loc
- |
- |
- | Boolean Func_2 (Str_1_Par_Ref, Str_2_Par_Ref)
- | /*************************************************/
- | /* executed once */
- | /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
- | /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
- |
- | Str_30 Str_1_Par_Ref;
- | Str_30 Str_2_Par_Ref;
- | {
-
- .text
- .globl _Func_2
- _Func_2:
- |$$v0
- movel d7,a7@-
- movel a7@(8),a1
- movel a7@(12),a0
- | REG One_Thirty Int_Loc;
- | Capital_Letter Ch_Loc;
- |
- | Int_Loc = 2;
- moveq #2,d7
- .L25:
- | while (Int_Loc <= 2) /* loop body executed once */
- | if (Func_1 (Str_1_Par_Ref[Int_Loc],
- | Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
- moveb a0@(1,d7),d0
- movel d0,a7@-
- moveb a1@(d7),d0
- movel d0,a7@-
- jbsr _Func_1
- addql #8,a7
- tstl d0
- jne .L23
- | /* then, executed */
- | {
- | Ch_Loc = 'A';
- | Int_Loc += 1;
- addql #1,d7
- .L23:
- moveq #2,d0
- cmpl d7,d0
- jge .L25
- | } /* if, while */
- | if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
- | /* then, not executed */
- | Int_Loc = 7;
- | if (Ch_Loc == 'R')
- | /* then, not executed */
- | return (true);
- | else /* executed */
- | {
- | if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
- movel a0,a7@-
- movel a1,a7@-
- jbsr _strcmp
- addql #8,a7
- tstl d0
- jle .L27
- | /* then, not executed */
- | {
- | Int_Loc += 7;
- addql #7,d7
- | Int_Glob = Int_Loc;
- movel d7,_Int_Glob
- | return (true);
- moveq #1,d0
- jra .L21
- .L27:
- | }
- | else /* executed */
- | return (false);
- moveq #0,d0
- .L21:
- | } /* if Ch_Loc */
- | } /* Func_2 */
- movel a7@+,d7
- rts
-
- | Allocations for _Func_2
- .data
- | a1 Str_1_Par_Ref
- | a0 Str_2_Par_Ref
- | d7 Int_Loc
- | not allocated Ch_Loc
- |
- |
- | Boolean Func_3 (Enum_Par_Val)
- | /***************************/
- | /* executed once */
- | /* Enum_Par_Val == Ident_3 */
- | Enumeration Enum_Par_Val;
- | {
-
- .text
- .globl _Func_3
- _Func_3:
- |$$v0
- | Enumeration Enum_Loc;
- |
- | Enum_Loc = Enum_Par_Val;
- | if (Enum_Loc == Ident_3)
- | /* then, executed */
- | return (true);
- moveq #0,d0
- cmpl #2,a7@(4)
- seq d0
- negb d0
- | else /* not executed */
- | return (false);
- | } /* Func_3 */
- rts
-
- | Allocations for _Func_3
- .data
- | a6@(8) Enum_Par_Val
- | not allocated Enum_Loc
-
- | Allocations for module
- .data
- .text
- SHAR_EOF
- fi # end of overwriting check
- #
- # End of shell archive
- #
- exit 0
- --
- +----------------+
- ! II CCCCCC ! Jim Cathey
- ! II SSSSCC ! ISC-Bunker Ramo
- ! II CC ! TAF-C8; Spokane, WA 99220
- ! IISSSS CC ! UUCP: uunet!isc-br!jimc (jimc@isc-br.isc-br.com)
- ! II CCCCCC ! (509) 927-5757
- +----------------+
- "PC's --- the junk bonds of the computer industry"
-