loop patches mark 11a

Jeffrey A Law law@cygnus.com
Fri Jun 19 00:05:00 GMT 1998


Previously I mentioned that they were still mis-compiling some of the
spec92 suite on the PA.  I finally got around to looking at this a little
closer and have something you might be able to investigate.

Compile the attached file on a PA with -O2.


Do a search for minus:DF and head to the 4th occurence.  It should be
in a series of insns like this which appear in a relatively large loop:

(jump_insn 179 178 209 (set (pc)
        (if_then_else (ne (reg:CCFP 0 %r0)
                (const_int 0))
            (label_ref 559)
            (pc))) -1 (nil)
    (nil))

(insn 209 179 211 (set (reg:DF 202)
        (mem/s:DF (reg:SI 193))) -1 (nil)
    (nil))

(insn 211 209 212 (set (reg:DF 203)
        (mem/s:DF (reg:SI 475))) -1 (nil)
    (nil))

(insn 212 211 219 (set (reg/v:DF 98)
        (minus:DF (reg:DF 202)
            (reg:DF 203))) -1 (nil)
    (nil))


Let's look at (reg 475) which appears as a memory address in insn 211.



Searching backwards we find:

(insn 781 764 785 (set (reg:SI 475)
        (reg:SI 449)) -1 (nil)
    (nil))

Searching backwards for (reg 449) we find:

(insn 704 703 738 (set (reg:SI 449)
        (plus:SI (reg:SI 452)
            (reg:SI 185))) -1 (nil)
    (nil))


Searching backwards for (reg 185) we find nothing -- ie it's not set
before being used.  In fact, it's not set anywhere.  This (of course)
leads to problems...


This is from mdljdp2; I suspect doduc is the same problem (has the
same symptomps).  I didn't look at wave5.

C
C changes for spec
C
C 11/8/90 mg fix possible close on unit 0 (sun issue)
C 11/8/90 mg fix cdc real*4 dependencies and use generic functions
C
      SUBROUTINE JLOOPB (I,JBEG,JEND)
      INTEGER I, JBEG, JEND
C---------------------------------------------------------------
C
C      J-loop portion of force evaluation.
C
C      This version of the routine build that section of a new
C      neighbour list relevant to particle I.
C
C---------------------------------------------------------------
C This is the beginning of an included INCLUDE     a.w.
      REAL*8 X0, Y0, Z0
      REAL*8 X1, Y1, Z1
      REAL*8 X2, Y2, Z2
      REAL*8 X3, Y3, Z3
      COMMON /VCOM0/ X0(500), Y0(500), Z0(500)
      COMMON /VCOM1/ X1(500), Y1(500), Z1(500)
      COMMON /VCOM2/ X2(500), Y2(500), Z2(500)
      COMMON /VCOM3/ X3(500), Y3(500), Z3(500)
      REAL*8 XFORCE, YFORCE, ZFORCE
      COMMON /VFORCE/ XFORCE(500), YFORCE(500), ZFORCE(500)
      REAL*8 XDISP, YDISP, ZDISP
      COMMON /VDISP/ XDISP(500), YDISP(500), ZDISP(500)
      INTEGER                  LSTUSE, LSTBLD
      INTEGER                  LUPDS, LISTEL, LSTEP
      INTEGER                  NBINDX(500)
      INTEGER                  NBTABL(25000)
      REAL*8      XLISTD(500)
      REAL*8      YLISTD(500)
      REAL*8      ZLISTD(500)
      REAL*8      RLISTD, RLISTU
      REAL*8      RLISTI, RLIST2
      REAL*8      RLIST, PLISTU
      COMMON /VLST0/      LSTUSE,LSTBLD,LUPDS,LISTEL,LSTEP
      COMMON /VLST1/      RLISTD,RLISTU,RLISTI,RLIST2,RLIST,PLISTU
      COMMON /VLST2/      NBINDX,NBTABL
      COMMON /VLST3/      XLISTD,YLISTD,ZLISTD
      REAL*8      S1TEMP, S2TEMP
      REAL*8      S1UCNF, S2UCNF
      REAL*8      S1ENER, S2ENER
      REAL*8      S1PRES, S2PRES
      COMMON /VAVER1/      S1TEMP, S2TEMP, S1UCNF, S2UCNF,
     1                     S1PRES, S2PRES, S1ENER, S2ENER
      REAL*8      ULEN
      COMMON /VBOX1/  ULEN
      REAL*8      UCONF, VIRIAL, PRESS
      COMMON /VCONF/       UCONF, VIRIAL, PRESS
      REAL*8 DELTT, DELTT2, TSTEP
      COMMON /VDELT/ DELTT, DELTT2, TSTEP
      LOGICAL                  CNFOPN
      CHARACTER*255            INPFIL
      CHARACTER*255            CTLOUT
      CHARACTER*255            DMPFIL
      CHARACTER*255            STTFIL
      CHARACTER*255            CNFFIL
      COMMON /VFILE1/ CNFOPN
      COMMON /VFILE2/ INPFIL, CTLOUT, DMPFIL, STTFIL, CNFFIL
      REAL*8 DSUMV2
      COMMON /VHEAT/ DSUMV2
      INTEGER  NSTR
      COMMON /VJOB/ NSTR
      INTEGER LPP, LLTP
      COMMON /VLINE/ LPP, LLTP
      REAL*8 SIGINT, SIGMA6, CUTOFF
      REAL*8 RCUTOF, RCUTSQ
      REAL*8 ULJCUT
      REAL*8 UTAIL, PTAIL
      REAL*8 S1NPRS, S2NPRS
      INTEGER NUMPRS
      COMMON /VPARM1/ NUMPRS
      COMMON /VPARM2/ SIGINT,SIGMA6,
     1                CUTOFF,RCUTOF,RCUTSQ,
     1                ULJCUT,UTAIL,PTAIL,
     1                S1NPRS, S2NPRS
      REAL*8 TOTEN, TEMP
      COMMON /VPROP/   TOTEN, TEMP
      INTEGER     NSTEPS, LENEQ,MAXSTP,
     1            IVCONF,IVPRIN,IVAVGS,
     1            IVDMP
      REAL*8      REQDIS
      COMMON /VSTEP1/ NSTEPS,LENEQ,MAXSTP,
     1                IVCONF,IVPRIN,IVAVGS,
     1                IVDMP
      COMMON /VSTEP2/      REQDIS
      REAL*8      TSTAR
      REAL*8      RHOST
      INTEGER            STFLAG
      COMMON /VSTPT2/      RHOST, TSTAR
      COMMON /VSTPT3/      STFLAG
      REAL*8      S1XVEL,S1YVEL,S1ZVEL,S2VEL
      COMMON /VSUMV/       S1XVEL,S1YVEL,S1ZVEL,S2VEL
      CHARACTER*72      RTITL, PRTITL
      COMMON /VTTL0/       RTITL
      COMMON /VTTL1/       PRTITL
      INTEGER      KDUMP,KGDATA,KCNFIG
      COMMON /VUNIT/      KDUMP,KGDATA,KCNFIG
      INTEGER      LSTEPS, LTENER, LUCONF, LRTEMP, LRDISP
      INTEGER      LPAIRS
      INTEGER      LFMELT, LPRESS
      INTEGER      LLSMEM, LLSUPD
      COMMON /VPLST1/      LSTEPS, LTENER, LUCONF, LRTEMP, LRDISP,
     1            LPAIRS
      COMMON /VPLST2/ LFMELT, LPRESS
      COMMON /VPLST3/ LLSMEM, LLSUPD
C End of included INCLUDE           a.w.

      REAL*8 SP0, SPP5, SP1, SP3, SP2, SP4, SPP1,
     +       SPCTRAN0, SPCTRAN1, SPCTRAN3, SP24
      COMMON /DPCDATA/ SP0,    SPP5, SP1, SP3, SP2, SP4, SPP1,
     +                 SPCTRAN0, SPCTRAN1, SPCTRAN3, SP24
C
C  Local variables.
C
      INTEGER            J
      REAL*8      XDIFF, YDIFF, ZDIFF
      REAL*8      RSQ, RECIR2
      REAL*8      RPOW06, RPOW12
      REAL*8      FOVERR
      REAL*8      FIJX, FIJY, FIJZ
C
C  Loop over J particles.
C
      DO 20 J = JBEG, JEND
C
C  Apply minimum-image convention in X, Y and Z.
C
         ZDIFF    = Z0(I) - Z0(J)
         IF (ZDIFF.LT.-SP1) THEN
            ZDIFF = ZDIFF + SP2
         ELSE IF (ZDIFF.GT.SP1) THEN
            ZDIFF = ZDIFF - SP2
         END IF
         RSQ = ZDIFF*ZDIFF
 
         XDIFF    = X0(I) - X0(J)
         IF (XDIFF.LT.-SP1) THEN
            XDIFF = XDIFF + SP2
         ELSE IF (XDIFF.GT.SP1) THEN
            XDIFF = XDIFF - SP2
         END IF
         RSQ = RSQ + XDIFF*XDIFF
         IF (RSQ.GT.RLIST2) GO TO 20
 
         YDIFF    = Y0(I) - Y0(J)
         IF (YDIFF.LT.-SP1) THEN
            YDIFF = YDIFF + SP2
         ELSE IF (YDIFF.GT.SP1) THEN
            YDIFF = YDIFF - SP2
         END IF
         RSQ = RSQ + YDIFF*YDIFF
         IF (RSQ.GT.RLIST2) GO TO 20
C
C  Neighbour list update.
C
 
         LISTEL = LISTEL + 1
         NBTABL(LISTEL) = J
C
C  Enforce potential cutoff.
C
         IF (RSQ.GT.RCUTSQ) GO TO 20
C
C  Update number of pairs within cutoff.
C
         NUMPRS = NUMPRS + 1
C
C  Calculate LJ part of interaction. FOVERR is -(du(r)/dr)/r.
C
         RECIR2 = SP1/RSQ
         RPOW06 = SIGMA6*RECIR2*RECIR2*RECIR2
         RPOW12 = RPOW06*RPOW06
         UCONF = UCONF + (RPOW12 - RPOW06 - ULJCUT)
         FOVERR = RECIR2*(RPOW12 + RPOW12 - RPOW06)
C
C  Update force accumulators.
C
         FIJX  = XDIFF*FOVERR
         FIJY  = YDIFF*FOVERR
         FIJZ  = ZDIFF*FOVERR
 
         XFORCE(I) = XFORCE(I) + FIJX
         YFORCE(I) = YFORCE(I) + FIJY
         ZFORCE(I) = ZFORCE(I) + FIJZ
 
         XFORCE(J) = XFORCE(J) - FIJX
         YFORCE(J) = YFORCE(J) - FIJY
         ZFORCE(J) = ZFORCE(J) - FIJZ
C
C  Update the virial.
C
         VIRIAL = VIRIAL + RSQ*FOVERR
C
C  Loop for next J.
C
20    CONTINUE
C
C  End of JLOOPB routine.
C
40    RETURN
      END



More information about the Gcc-patches mailing list