Noticed the following in 200.sixtrack benchmark from CPU2000.

          SUBROUTINE          DFACT(N,A,IDIN,IR,IFAIL,DET,JFAIL)
          IMPLICIT REAL*8 (A-H,O-Z)
          INTEGER             IR(9),    IPAIRF
      REAL*8    A(IDIN,9),DET,      ZERO,     ONE,X,Y,TF
          DO 144    J  =  1, N
             K = IR(5)
 123         DO 124    L  =  1, N
                TF      =  A(J,L)
                A(J,L)  =  A(K,L)
                A(K,L)  =  TF
 124            CONTINUE
 144         CONTINUE
          RETURN
          END

Compiling with -O2 -m64 results in poor code for the outer loop exit test (-m32
is fine, as are 4.3 and earlier versions).

4.3:
        ...
        bdnz .L4     #inner loop exit
        cmpw 7,7,3
        addi 11,11,1
        beqlr 7


mainline:
        ...
        bdnz .L4       #inner loop exit
        addi 11,8,-1
        addi 3,3,1
        rldicl 11,11,0,32
        addi 11,11,2
        add 11,12,11
        add 11,11,0
        cmpd 7,3,11
        bne 7,.L5


-- 
           Summary: IV-opts creating poor code for loop exit test
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pthaugen at gcc dot gnu dot org
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38258

Reply via email to