On 01/18/2012 02:04 AM, Walter Bright wrote:
On 1/17/2012 4:19 PM, Peter Alexander wrote:
So, my original point still stands, you can't vectorise this function:

void foo(int[] a, int[] b, int[] c)
{
foreach (i; 0..256)
a[i] = b[i] + c[i];
}

Those slices are allowed to overlap, so this cannot be automatically
vectorised
(without inlining to get better context about those arrays).

Without inlining, you need something along the lines of __restrict or
uniqueness
typing.

No, you can rewrite it as:

a[] = b[] + c[];

and you don't need __restrict or uniqueness. That's what the vector
operations are for.

Are they really a general solution? How do you use vector ops to implement an efficient matrix multiply, for instance?

Reply via email to