[comp.unix.cray] Structure assignments break vectorization

jdcwi@lhdsy1.chevron.com (D.C. Witte) (01/12/91)

Can anyone explain to me why references to whole structures (in Cray/ansi C)
inhibit vectorization?  From the manual:

struct	xyz	{int x; int y; int z;};
struct	xyz	p1[100];
struct	xyz	p2[100];
. . .
/* this loop does not vectorize, compiler generates SC-1053 message */
for (i= 0; i < 100; ++i)
{
	p1[i]= p2[i];
}
. . .
/* this loop does vectorize */
for (i= 0; i < 100; ++i)
{
	p1[i].x= p2[i].x;
	p1[i].y= p2[i].y;
	p1[i].z= p2[i].z;
}

I understand that the compiler treats the former as an embedded short loop;
unrolling permits vectorization.  My question is:  Why doesn't the compiler
do the unrolling automatically?  Seems safe enough to me, unless the RHS is
actually a (inlined) function.  Anyone out there know the answer?

--------------------------------------------------------------------------
Dean Witte
Chevron Oil Field Research Co.            phone: 213 694 7334
P.O. Box 446                              uunet: jdcwi@chevron.com
La Habra, CA 90633
--------------------------------------------------------------------------