This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: __builtin_expect


I wrote:

> Richard Henderson wrote:

> > This is a method to add branch prediction information to source code.

> Fantastic !  I'll start to work on adding the FREQUENCY statement to g77
> right away !

> See: http://www.fortran.com/ibm3.jpg

One might wonder how much of this 44 year old language survived today. 
Well, this is what g77 compiles as of the upcoming 2.95.3 release:

$ cat primordial.f
C     PROGRAM FOR FINDING THE LARGEST VALUE
C    X     ATTAINED BY A SET OF NUMBERS
      DIMENSION A(999)
C     FREQUENCY 30(2,1,10), 5(100)
      READ 1, N, (A(I), I = 1,N)
    1 FORMAT (I3/(12F6.2))
      BIGA = A(1)
    5 DO 20 I = 2,N
   30 IF (BIGA-A(I)) 10,20,20
   10 BIGA = A(I)
   20 CONTINUE
      PRINT 2, N, BIGA
    2 FORMAT (22H1THE LARGEST OF THESE I3, 12H NUMBERS IS F7.2)
      STOP 77777
      END

[ Note that I commented out the FREQUENCY statement and added an END
  statement ]

$ g77 -v primordial.f
g77 version 2.95.3 19991030 (prerelease) (from FSF-g77 version 0.5.25
19991030 (prerelease))
Driving: g77 -v primordial.f -lg2c -lm
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs
gcc version 2.95.3 19991030 (prerelease)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/f771 primordial.f
-quiet -dumpbase primordial.f -version -fversion -o /tmp/ccpXUL2g.s
GNU F77 version 2.95.3 19991030 (prerelease) (i686-pc-linux-gnu)
compiled by GNU C version 2.95.3 19991030 (prerelease).
GNU Fortran Front End version 0.5.25 19991030 (prerelease)
primordial.f: In program `MAIN__':
primordial.f:13: warning:
       2 FORMAT (22H1THE LARGEST OF THESE I3, 12H NUMBERS IS F7.2)
                                          ^
Missing comma in FORMAT statement at (^)
primordial.f:13: warning:
       2 FORMAT (22H1THE LARGEST OF THESE I3, 12H NUMBERS IS F7.2)
                                                             ^
Missing comma in FORMAT statement at (^)
 as -V -Qy -o /tmp/ccCthNOp.o /tmp/ccpXUL2g.s
GNU assembler version 2.9.1 (i486-linux), using BFD version 2.9.1.0.19
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/collect2 -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/crtbegin.o
-L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3 -L/usr/local/lib
/tmp/ccCthNOp.o -lg2c -lm -lgcc -lc -lgcc
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/crtend.o /usr/lib/crtn.o

[ Executing ... ]

$ ./a.out
2
34.32 398.8    
1THE LARGEST OF THESE   2 NUMBERS IS  398.80
STOP 77777 statement executed

[ For the under-40's in the audience: the `1' in the first column of
  the output line was meant to cause a page eject on the line printer.
  The `STOP ...' output was meant to go to the operator console to
  indicate the program had finished. ]

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://xena.eas.asu.edu/~andy (under construction)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]