Xref: utzoo comp.lang.misc:4074 comp.sys.mips:471 Path: 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 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