public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeffrey A Law <law@cygnus.com>
To: Toon Moene <toon@moene.indiv.nluug.nl>
Cc: Jim Wilson <wilson@cygnus.com>, egcs@cygnus.com
Subject: Re: my EGCS status (really Fortran patches)
Date: Wed, 22 Oct 1997 21:33:00 -0000	[thread overview]
Message-ID: <4712.877581304@hurl.cygnus.com> (raw)
In-Reply-To: <9710211752.AA19479@moene.indiv.nluug.nl>

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

       reply	other threads:[~1997-10-22 21:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9710211752.AA19479@moene.indiv.nluug.nl>
1997-10-22 21:33 ` Jeffrey A Law [this message]
1997-10-22 22:55   ` Toon Moene
1997-10-22 23:26     ` Jeffrey A Law
1997-10-23  0:47     ` Jeffrey A Law
1997-10-23 10:45       ` Toon Moene
1997-10-23 11:04         ` Jeffrey A Law
1997-10-23 12:18           ` Joe Buck
1997-10-24 22:37     ` -frerun-loop Jeffrey A Law
1997-10-22 22:33 ` my EGCS status (really Fortran patches) Jeffrey A Law
1997-10-26  9:18 ` Jeffrey A Law
1997-10-27 16:30   ` Jim Wilson
1997-10-27 15:54     ` Jeffrey A Law
1997-10-27 17:21       ` Jim Wilson
1997-10-28 12:35         ` Jeffrey A Law
1997-10-28 12:35           ` Toon Moene

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4712.877581304@hurl.cygnus.com \
    --to=law@cygnus.com \
    --cc=egcs@cygnus.com \
    --cc=toon@moene.indiv.nluug.nl \
    --cc=wilson@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).