From: | lindahl@pbm.com (Greg Lindahl) |
Newsgroups: | comp.compilers |
Date: | 12 Jan 2000 03:40:08 -0500 |
Organization: | a guest of Shadow Island Games |
References: | 00-01-017 |
Keywords: | architecture, optimize |
bcombee@metrowerks.com (Ben Combee) writes:
> There are limitations... I used global arrays on purpose here -- we do
> not yet support the ISO C 1999 keyword "restrict" that would let you
> give the compiler enough information to know that the b and c arrays
> did not alias with array a, so if you passed the arrays in as
> parameters, we would not attempt the vectorization.
You also didn't mention the alignment restrictions. Isn't it the case
that the inputs need to be 128-bit aligned? So if you don't know the
alignment at compile-time, or the alignment happens to be unfortunate,
you're out of luck. Consider:
short int a1[50], a2[50], b[50], c[50];
void foo(void)
{
int i;
for (i = 0; i < 50; i++) a1[i] = b[i] + c[i];
for (i = 0; i < 49; i++) a2[i] = b[i+1] + c[i];
}
In this example, I don't think you can vectorize both loops.
-- g
Return to the
comp.compilers page.
Search the
comp.compilers archives again.