🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.cray
Article #224

Structure assignments break vectorization

#224
From: D.C. Witte
Date: Fri, 11 Jan 1991 17:48
32 lines
1509 bytes
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
--------------------------------------------------------------------------
Technical Details
Message-ID: <698@lhdsy1.chevron.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!lhdsy1!jdcwi

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!lhdsy1!jdcwi
From: jdcwi@lhdsy1.chevron.com (D.C. Witte)
Newsgroups: comp.unix.cray
Subject: Structure assignments break vectorization
Summary: why?
Keywords: vectorization, C, scc
Message-ID: <698@lhdsy1.chevron.com>
Date: 11 Jan 91 17:48:02 GMT
Reply-To: jdcwi@chevron.com (D.C. Witte)
Organization: Chevron Oil Field Research, La Habra, CA.
Lines: 32