This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug rtl-optimization/18942] New: [4.0 Regression] Do loop is not as optimizationed as 3.3.2


Take the following code:
int main1 (int n)
{
  int ivtmp51;
  int D1360 = n/2 - 1;
  ivtmp51 = 1;
  do {
    ivtmp51++;
  }  while (D1360 > ivtmp51);
  return 0;
}

With 3.3.2 I got:
_main1:
        srawi r4,r3,1
        addze r4,r4
        addi r2,r4,-1
        cmpwi cr0,r2,1
        addi r0,r2,-1
        mtctr r0
        ble- cr0,L8
L6:
        bdnz L6
        li r3,0
        blr
L8:
        li r3,1
        mtctr r3
        b L6

With the mainline I get:
_main1:
        srawi r3,r3,1
        addze r3,r3
        addi r2,r3,-1
        cmpwi cr7,r2,2
        addi r3,r3,-2
        mtctr r3
        blt- cr7,L6
        lis r0,0x8000  <-- why is this here?
        cmpw cr7,r2,r0<-- likewise
        beq- cr7,L6<-- likewise
L2:
        bdnz L2
L10:
        li r3,0
        blr
L6:
        li r0,1
        mtctr r0
        bdnz L2
        b L10

-- 
           Summary: [4.0 Regression] Do loop is not as optimizationed as
                    3.3.2
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: powerpc-darwin


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


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