primitive vector types

Fawzi Mohamed fmohamed at mac.com
Fri Feb 27 08:55:15 PST 2009


On 2009-02-23 14:48:50 +0100, Chad J <gamerchad at __spam.is.bad__gmail.com> said:

> Don wrote:
>> 
>> So it looks to me as though with the minimal language changes, we could
>> get almost complete SIMD support, with excellent syntax.
>> 
> 
> enum { x=0, y=1, z=2, w=3 }
> float[4] foo;
> foo[x] = 42;
> foo[y] = foo[x];
> // etc
> foo[] = [foo[y],foo[x],foo[y],foo[x]];
> 
> *grin*

Sorry to bump up this discussion, but I was away and then busy with 
other stuff... and coming back I had lot of piled up work... (also make 
tango work wit the brand new dmd on mac ;) so I had missed it.

I think that an aligned vector would be very useful to have for small vectors.
Intrinsic functions could be useful, but I agree with the "joke" done by Chad.
What I really want to see is that the compiler uses them when it should 
(as I think downs did with his autovectorization patch for gdc).
Not too much cluttering for special notation, but the normal one that 
is done efficiently when possible.
A special type is probably needed (for alignment reasons), but then 
that's about it from the language point of view (even that might be 
avoided with align, or maybe sometime even without, but maybe that is 
to expect too much from the compiler).

I also would like to stress again that there are also doubles (but 
indeed the gain in that case is much smaller).

Fawzi




More information about the Digitalmars-d mailing list