This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Doloop transform resulting in extra code
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Pat Haugen <pthaugen at us dot ibm dot com>
- Cc: gcc at gcc dot gnu dot org, Andrew Pinski <pinskia at physics dot uc dot edu>, rakdver at atrey dot karlin dot mff dot cuni dot cz
- Date: Tue, 11 May 2004 16:12:57 -0400
- Subject: Re: Doloop transform resulting in extra code
- References: <OF60E4BFCA.04A22218-ON86256E91.006C909D-86256E91.006E62F6@us.ibm.com>
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