Xref: utzoo comp.lang.c:19984 comp.unix.cray:11 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!ig!ames!amelia!ew02!yamo From: yamo@ew02..nas.nasa.gov (Michael J. Yamasaki) Newsgroups: comp.lang.c,comp.unix.cray Subject: Re: Vectorizing C compilers Summary: Mixing C & fortran not so bad Message-ID: <2550@amelia.nas.nasa.gov> Date: 18 Jul 89 16:46:07 GMT References: <15388@ut-emx.UUCP> Sender: news@amelia.nas.nasa.gov Reply-To: yamo@ew02.nas.nasa.gov (Michael J. Yamasaki) Followup-To: comp.unix.cray Organization: NASA Ames Research Center Lines: 26 In article <15388@ut-emx.UUCP> eric@chaos.utexas.edu () writes: > >What is the state of the art regarding vectorizing C compilers >... >but never a C compiler that can vectorize something like > > for(j = 0; j < n; j++) > y[j] = sqrt(x[j]); > >even where a suitable Fortran mathematical library is available. >... >hardware efficiently. I prefer to write the program in C rather than >a mixture of C and Fortran. > >--Eric Kostelich You might try for grins SQRT(&x[j]) and link it with cf77 instead of cc. I don't know off hand whether this will vectorize, but it will get the Fortran routine. I'm also not sure whether what you will get will be the intrinsic routine or not. Anyway... The problem that I have with vectorizing C compilers is that (at least on the Crays) they can only vectorize statically allocated arrays. Pointers, memory cast as arrays, parameter passing casts, etc. have all failed to vectorize. It's a problem if you want to dynamically allocate memory (or in my case need to).