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]

Re: Doloop transform resulting in extra code



On May 11, 2004, at 16:05, Pat Haugen wrote:


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.

I think the reason why nobody pointed it out is because it works correctly
already on the tree-ssa (which should be merged in tomorrow into the mainline)
so this will be magically fixed.


Thanks,
Andrew Pinski
someone who does look at code gen on PPC

For an example with your code on the tree-ssa on powerpc-apple-darwin:
_hbAssignCodes:
        mr. r0,r5
        mtctr r0
        blelr- cr0
        li r2,0
L4:
        slwi r0,r2,2
        addi r2,r2,1
        stwx r4,r3,r0
        bdnz L4
        blr


and on the mainline: _hbAssignCodes: li r2,0 cmpw cr7,r2,r5 bgelr- cr7 cmpwi cr7,r5,0 mtctr r5 ble- cr7,L13 L8: slwi r0,r2,2 addi r2,r2,1 stwx r4,r3,r0 bdnz L8 blr L13: li r0,1 mtctr r0 b L8


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