SIMD benchmark
Simen Kjærås
simen.kjaras at gmail.com
Mon Jan 16 14:25:40 PST 2012
On Mon, 16 Jan 2012 23:22:21 +0100, Simen Kjærås <simen.kjaras at gmail.com>
wrote:
> On Mon, 16 Jan 2012 23:06:12 +0100, Manu <turkeyman at gmail.com> wrote:
>
>> On 17 January 2012 00:03, Walter Bright <newshound2 at digitalmars.com>
>> wrote:
>>
>>> On 1/16/2012 1:54 PM, Manu wrote:
>>>
>>>> Unfortunately, if the function was this:
>>>>
>>>> void foo(int[] a, int[] b, int[] c) {
>>>>
>>>> for (int i=0; i<256; i++)
>>>> a[i] = b[i] + c[i];
>>>> }
>>>>
>>>> Then it can't vectorize due to aliasing.
>>>>
>>>>
>>>> This is why D needs a __restrict attribute! ;)
>>>>
>>>
>>> That's why D has:
>>>
>>> a[] = b[] + c[];
>>>
>>> because the language requires the arrays to be distinct.
>>>
>>
>> Surely it would be possible for them to be overlapping slices?
>
> If they are, that's your fault and your problem.
>
> "The lvalue slice and any rvalue slices must not overlap."
Sorry, forgot the link:
http://www.d-programming-language.org/arrays.html#array-operations
More information about the Digitalmars-d
mailing list