my EGCS status (really Fortran patches)
Jeffrey A Law
law@cygnus.com
Wed Oct 22 21:33:00 GMT 1997
Note I've moved this discussion to the egcs list.
In message <9710211752.AA19479@moene.indiv.nluug.nl>you write:
> > The simplify_giv_expr change makes sense. I haven't
> > tried building a PA compiler to see why it sometimes
> > gives worse code.
>
> I must confess that I only tested code with perfectly nested loops
> (i.e. no code in the outer loop, like above). I don't know if that
> would make a difference.
It might. I really don't know.
Here's a relatively small example of the code explosion problem I
mentioned for the PA.
With the USE patch we eliminate 4 integer insns in the inner loop, but
we end up with 15 more integer insns in the outer loop.
Worse yet, the inner loop is so FP dominated that removing the
4 integer insns probably doesn't actually make the inner loop go any
faster since they're probably just filling bubbles in the pipeline
anyway.
PARAMETER ( N = 257 )
IMPLICIT REAL*8 (A-H,O-Z)
DIMENSION AA(N,N), RX(N,N),RY(N,N),D(N,N)
DO 501 J = 2,M
K = M-J+1
DO 501 I = I1P,I2M
RX(I,K) = (RX(I,K)-AA(I,K)*RX(I,K+1))*D(I,K)
RY(I,K) = (RY(I,K)-AA(I,K)*RY(I,K+1))*D(I,K)
501 CONTINUE
END
Without the use patch the loops look like:
L$0005
sub %r4,%r31,%r21
copy %r5,%r24
sub %r6,%r24,%r23
comib,> 0,%r23,L$0004
ldo 1(%r21),%r22
zdep %r21,23,24,%r19
addl %r19,%r21,%r19
zdep %r22,23,24,%r20
zdep %r19,28,29,%r28
addl %r20,%r22,%r20
zdep %r24,28,29,%r19
addil LR'ry___2-$global$,%r27
zdep %r20,28,29,%r26
ldo -8(%r19),%r22
ldo RR'ry___2-$global$(%r1),%r24
L$0009
addl %r22,%r28,%r20
addl %r22,%r26,%r19
flddx %r19(0,%r24),%fr25
flddx %r20(0,%r3),%fr24
flddx %r19(0,%r29),%fr22
fmpy,dbl %fr24,%fr25,%fr25
addl %r20,%r29,%r19
fmpy,dbl %fr24,%fr22,%fr24
addl %r20,%r24,%r21
fldds 0(0,%r19),%fr22
fldds 0(0,%r21),%fr23
fsub,dbl %fr22,%fr24,%fr22
ldo 8(%r22),%r22
flddx %r20(0,%r2),%fr24
fmpysub,dbl %fr22,%fr24,%fr22,%fr25,%fr23
fmpy,dbl %fr23,%fr24,%fr23
fstds %fr22,0(0,%r19)
addib,>= -1,%r23,L$0009
fstds %fr23,0(0,%r21)
L$0004
addib,>= -1,%r25,L$0005
ldo 1(%r31),%r31
With the use patch the loops look like:
L$0005
copy %r6,%r23
sub %r7,%r23,%r28
comib,> 0,%r28,L$0004
zdep %r31,23,24,%r21
addl %r21,%r31,%r21
addil LR'd___3-$global$,%r27
zdep %r2,23,24,%r22
copy %r1,%r3
zdep %r21,28,29,%r21
ldo -8(%r4),%r19
addl %r22,%r2,%r22
addil LR'ry___2-$global$,%r27
addl %r21,%r19,%r19
zdep %r23,28,29,%r23
copy %r1,%r8
zdep %r22,28,29,%r22
ldo -8(%r5),%r20
addl %r23,%r19,%r26
addl %r22,%r20,%r24
ldo RR'ry___2-$global$-8(%r8),%r19
addl %r21,%r20,%r20
addl %r22,%r19,%r22
addl %r23,%r20,%r25
addl %r21,%r19,%r19
addl %r23,%r19,%r20
ldo RR'd___3-$global$-8(%r3),%r19
addl %r23,%r24,%r24
addl %r23,%r22,%r22
addl %r21,%r19,%r21
addl %r23,%r21,%r23
L$0009
fldds,ma 8(0,%r26),%fr24
fldds,ma 8(0,%r24),%fr23
fldds 0(0,%r25),%fr22
fmpy,dbl %fr24,%fr23,%fr23
fldds,ma 8(0,%r23),%fr25
fsub,dbl %fr22,%fr23,%fr22
fmpy,dbl %fr22,%fr25,%fr22
fstds,ma %fr22,8(0,%r25)
fldds,ma 8(0,%r22),%fr23
fldds 0(0,%r20),%fr22
fmpy,dbl %fr24,%fr23,%fr24
fsub,dbl %fr22,%fr24,%fr22
fmpy,dbl %fr22,%fr25,%fr22
addib,>= -1,%r28,L$0009
fstds,ma %fr22,8(0,%r20)
L$0004
ldo -1(%r31),%r31
addib,>= -1,%r29,L$0005
ldo -1(%r2),%r2
Now, I don't actually know if one version executes any faster than
the other -- this is just something I noticed when looking for why
tomcatv ran 10% slower with the USE patch.
jeff
More information about the Gcc
mailing list