On Monday, 4 September 2017 at 18:03:51 UTC, Johan Engelen wrote:

It's need for auto-vectorization, for example.

I would support an LDC PR for adding a magic UDA to be able to attach 'restrict' with C-semantics to function parameters. E.g.
```
 // add restrict to parameters 1 and 2
void foo(int, int*, int*) @restrict(1,2)
```

That probably explains it in case of c. But I still think that D might be able to do this better without language changes. This way (not compiler-checked for errors):
```
for(int i = 0; i < a.length; i+=8)
{   int[8] aVec = a[i .. i+8], bVec = b[i .. i+8], cVec;
    foreach(j; 0 .. 8) cVec[j] = aVec[j].foo(bVec[j]);
    c[i .. i+8] = cVec[];
}
```

Of course, if we want to support this we should construct a high-level library template that chooses the correct vector size for the platform, eliminates that outer for loop and handles uneven array lenghts.

Reply via email to