SIMD benchmark

Walter Bright newshound2 at digitalmars.com
Tue Jan 17 15:34:41 PST 2012


On 1/17/2012 3:23 PM, Peter Alexander wrote:
> On 17/01/12 10:55 PM, Walter Bright wrote:
>> On 1/17/2012 1:47 PM, Peter Alexander wrote:
>>> On 17/01/12 9:24 PM, Walter Bright wrote:
>>>> On 1/17/2012 1:20 PM, Peter Alexander wrote:
>>>>> As Manu said, you need something like __restrict (or a linear type
>>>>> system) to
>>>>> solve this problem.
>>>>
>>>> No, you don't. It can be done with a runtime check, like array bounds
>>>> checking is done.
>>>
>>> So you'd change it to this, even in release builds?
>>
>> No. Like array bounds, if they overlap, an exception is thrown.
>>
>> Remember, the D spec says that overlapping arrays are illegal.
>
> The D spec says that overlapping arrays are illegal for vector ops. The
> foo(int[], int[], int[]) function does not use vector ops.
>
> Or am I missing something really major?
>
> For example, is this legal code?
>
> int[100] a;
> int[] b = a[0..100];
> int[] c = a[10..90]; // Illegal? b and c overlap...

No, not illegal.

>
> foreach (i; 0..80)
> c[i] = b[i]; // Illegal?

No, not illegal.

> I know that b[] = c[] would be illegal, but that has nothing to do with the
> prior discussion.

Yes, b[]=c[] is illegal.


More information about the Digitalmars-d mailing list