Xref: utzoo comp.lang.c:19989 comp.unix.cray:13 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!apple!malcolm From: malcolm@Apple.COM (Malcolm Slaney) Newsgroups: comp.lang.c,comp.unix.cray Subject: Re: Vectorizing C compilers Summary: Cray C vectorizes sqrt loops Keywords: Cray, C, vectorizing Message-ID: <33264@apple.Apple.COM> Date: 18 Jul 89 18:28:21 GMT References: <15388@ut-emx.UUCP> Organization: Apple Computer Inc, Cupertino, CA Lines: 47 In article <15388@ut-emx.UUCP> eric@chaos.utexas.edu () writes: > >What is the state of the art regarding vectorizing C compilers >for Crays and other "minisuper" machines like Alliant, Convex, etc.? >.....but never a C compiler that can vectorize something like > > for(j = 0; j < n; j++) > y[j] = sqrt(x[j]); Vectorizes fine on our Cray. Summary attached to the end of this note. I really have to hand it to the SCC compiler people at Cray. When I ran my ear model through the brand spanking new beta test version of scc it ran ** 10 ** times faster!!!! Without any changes to the code. (OK, there were some ANSI C syntax problems in my code but those were errors in my coding style.) The biggest problem with vectorizing C is making sure that array references are not aliased. Fortran has the same problems but it is much harder to overlap arrays since you must try really hard with common blocks. Cheers. Malcolm Slaney Apple Speech and Hearing Script started on Tue Jul 18 11:19:02 1989 % cat j.c #include float y[100], x[100]; foo(n) int n; { register int j; for(j = 0; j < n; j++) y[j] = sqrt(x[j]); } % scc -h vreport -c j.c % cat j.V V E C T O R I Z A T I O N I N F O R M A T I O N ------------------------------------------------- *** *** Loop starting at line 10 was vectorized % Script done on Tue Jul 18 11:19:22 1989