CompuServe Thread

Forum unknown · C Chest

#"C" users read Pascal?

3 messages in this thread
#6401From: john stanleySep 7, 1986 9:17 PM
Here are two more. First, VAX-11C: double a1[100],a2[100],a3[100]; swert() { swert: .entry swert,^m<r2> subl2 #4,sp register int i; for (i=0; i<100; i++) a1[i] = a2[i] + a3[i]; clrl ap movaq A1,r2 movaq A2,r1 movaq A3,r0 sym.1: addd3 (r1)+,(r0)+,(r2)+ aobleq #99,ap,sym.1 return; ret And, Ultrix C: _swert: .word L15 clrl r11 L01: addd3 _a3[r11],_a2[r11],_a1[r11] aoblss $100,r11,L01 ret The source for both is the same. It helps the Ultrix C compiler to make i a register variable, but not VAX C. VAX C always tries to make things register when it can, anyway.
#6433From: Tom CattrallSep 8, 1986 11:52 PM
Jhon– Thanks for the numbers, and what a surprise! I was sure that the 4/2 count from VAX Fortran was the best possible but Ultrix C does it in 3 total, 2 in the loop. Amazing! I've updated the VAX list to include the new best counts and include the current list here. The 8086 people aren't coming through with any results. I would have expected a large mass of 808x C compiler results if nothing else. Tom code is: n:= 100; FOR i:= 1 TO n DO a[i]i]:= b[i] + c[i]; The counts are only for the FOR loop and are # machine instructions used. Results shown as fraction: (actual achieved by compiler) / (best possible) . CPU Total Code Loop Code Compiler 68000 27 / 6 = 450% 20 / 4 = 500% TDI MOSYS Modula-2 68000 27 / 6 = 450% 20 / 4 = 500% TDI Amiga Modula-2 68000 13 / 6 = 217% 9 / 4 = 225% Green Hills optimize on 68000 22 / 6 = 367% 21 / 4 = 525% Green Hills optimize off 68000 26 / 6 = 433% 24 / 4 = 600% UCSD Pascal Native code VAX 4 / 3 = 133% 2 / 2 = 100% VAX VMS Fortran 4.3 VAX 6 / 3 = 200% 2 / 2 = 100% VAX VMS ePascal v2.1 VAX 6 / 3 = 200% 3 / 2 = 150% Ultrix Fortran VAX 6 / 3 = 200% 2 / 2 = 100% VAX 11 C VAX 3 / 3 = 100% 2 / 2 = 100% Ultrix C HP A900 21 / 12 = 175% 14 / 7 = 200% HP Fortran 77 8086 25 / 9 = 278% 19 / 4 = 475% Logitech Modula-2 v2.00 8086 13 / 9 = 144% 10 / 4 = 250% Aztec C 8086 10 / 9 = 111% 9 / 4 = 225% Microsoft C optimize on 8086 13 / 9 = 144% 12 / 4 = 300% Microsoft C optimize off Prime 13 / ? = ? 10 / ? = ? Prime Fortran Z80 64 / ? = ? 48 / ? = ? Turbo Pascal
#6433From: Tom CattrallSep 8, 1986 11:52 PM
Jhon– Thanks for the numbers, and what a surprise! I was sure that the 4/2 count from VAX Fortran was the best possible but Ultrix C does it in 3 total, 2 in the loop. Amazing! I've updated the VAX list to include the new best counts and include the current list here. The 8086 people aren't coming through with any results. I would have expected a large mass of 808x C compiler results if nothing else. Tom code is: n:= 100; FOR i:= 1 TO n DO a[i]i]:= b[i] + c[i]; The counts are only for the FOR loop and are # machine instructions used. Results shown as fraction: (actual achieved by compiler) / (best possible) . CPU Total Code Loop Code Compiler 68000 27 / 6 = 450% 20 / 4 = 500% TDI MOSYS Modula-2 68000 27 / 6 = 450% 20 / 4 = 500% TDI Amiga Modula-2 68000 13 / 6 = 217% 9 / 4 = 225% Green Hills optimize on 68000 22 / 6 = 367% 21 / 4 = 525% Green Hills optimize off 68000 26 / 6 = 433% 24 / 4 = 600% UCSD Pascal Native code VAX 4 / 3 = 133% 2 / 2 = 100% VAX VMS Fortran 4.3 VAX 6 / 3 = 200% 2 / 2 = 100% VAX VMS ePascal v2.1 VAX 6 / 3 = 200% 3 / 2 = 150% Ultrix Fortran VAX 6 / 3 = 200% 2 / 2 = 100% VAX 11 C VAX 3 / 3 = 100% 2 / 2 = 100% Ultrix C HP A900 21 / 12 = 175% 14 / 7 = 200% HP Fortran 77 8086 25 / 9 = 278% 19 / 4 = 475% Logitech Modula-2 v2.00 8086 13 / 9 = 144% 10 / 4 = 250% Aztec C 8086 10 / 9 = 111% 9 / 4 = 225% Microsoft C optimize on 8086 13 / 9 = 144% 12 / 4 = 300% Microsoft C optimize off Prime 13 / ? = ? 10 / ? = ? Prime Fortran Z80 64 / ? = ? 48 / ? = ? Turbo Pascal