Vectorizing C compilers
Malcolm Slaney
malcolm at Apple.COM
Wed Jul 19 04:28:21 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
>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 <math.h>
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
% <EOF>
Script done on Tue Jul 18 11:19:22 1989
More information about the Comp.lang.c
mailing list