Vectorizing C compilers

Michael J. Yamasaki yamo at ew02..nas.nasa.gov
Wed Jul 19 02:46:07 AEST 1989


In article <15388 at ut-emx.UUCP> eric at 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).



More information about the Comp.unix.cray mailing list