This is the mail archive of the gcc@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]

Doloop transform resulting in extra code


Zdenek,

Has anyone pointed out to you that the doloop transform in mainline results
in extra code when compared to the 3.4 branch?  Actually, that's not true
for the -m64 case since 3.4 didn't generate a doloop for -m64 but I've
included it anyway since it suffers from the same problem.

Following is example source (trimmed down from bzip2.c) and generated code
for PowerPC target.  The extra tests (one for -m32, two for -m64) will
never be true since the first test guarantees the loop count is > 0.


void hbAssignCodes (int *code,
                    int n,
                    int alphaSize )
{
  int  i;

  for (i = 0; i < alphaSize; i++)
    code[i] = n;
}



-m32

hbAssignCodes:
      li 9,0
      cmpw 7,9,5
      bgelr- 7
      cmpwi 7,5,1
      mtctr 5
      blt- 7,.L13 *** r5 can't be < 1 here
.L8:
      slwi 0,9,2
      addi 9,9,1
      stwx 4,3,0
      bdnz .L8
      blr
.L13:
      li 0,1
      mtctr 0
      b .L8



-m64

.hbAssignCodes:
      li 11,0
      cmpw 7,11,5
      bgelr- 7
      cmpwi 7,5,1
      rldicl 0,5,0,32
      mtctr 0
      blt- 7,.L10 *** r5 can't be < 1 here
      lis 0,0x8000
      cmpw 7,5,0
      beq- 7,.L10 *** r5 can't be MIN(int) here
.L8:
      sldi 0,11,2
      addi 9,11,1
      stwx 4,3,0
      extsw 11,9
      bdnz .L8
      blr
.L10:
      li 0,1
      mtctr 0
      b .L8




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