🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6700

Re: optimizations, funny results

#6700
From: Preston Briggs
Date: Sat, 10 Feb 1990 19:31
35 lines
1321 bytes
In article <1990Feb10.160605.25254@ux1.cso.uiuc.edu> mcdonald@aries.scs.uiuc.edu (Doug McDonald) writes:

>	subroutine mm(A, B, C, n)
>        double precision a(n,n), b(n,n), c(n,n), t
>	do 1 i = 1, n
>	  do 2 j = 1, n
>	    t = 0.0
>	    do 3 k = 1, n
>	      t = t + B(i, k) * C(k, j)
>              A(i,j) = t
>3           continue 
>2         continue
>1       continue
>	end

>Surprised? I sure am. Why should the MIPS Fortran results be so slow?

The Fortran source is incorrect.  Correct is:

	subroutine mm(A, B, C, n)
        double precision a(n,n), b(n,n), c(n,n), t
	do 1 i = 1, n
	  do 2 j = 1, n
	    t = 0.0
	    do 3 k = 1, n
	      t = t + B(i, k) * C(k, j)
3           continue 
            A(i,j) = t
2         continue
1       continue
	end

Note the interchange of the store to A(i,j) and the continue.

Preston
Technical Details
Message-ID: <4895@brazos.Rice.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!rice!titan!preston
References: <1990Feb10.160605.25254@ux1.cso.uiuc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!rice!titan!preston
From: preston@titan.rice.edu (Preston Briggs)
Newsgroups: comp.lang.misc,comp.sys.mips
Subject: Re: optimizations, funny results
Message-ID: <4895@brazos.Rice.edu>
Date: 10 Feb 90 19:31:49 GMT
References: <1990Feb10.160605.25254@ux1.cso.uiuc.edu>
Sender: root@rice.edu
Followup-To: comp.lang.misc
Organization: Rice University, Houston
Lines: 35