SIMD support...

a a at a.com
Fri Jan 6 02:16:46 PST 2012


Walter Bright Wrote:

> which provides two functions:
> 
>     __v128 simdop(operator, __v128 op1);
>     __v128 simdop(operator, __v128 op1, __v128 op2);

You would also need functions that take an immediate too to support instructions such as shufps. 

> One caveat is it is typeless; a __v128 could be used as 4 packed ints or 2 
> packed doubles. One problem with making it typed is it'll add 10 more types to 
> the base compiler, instead of one. Maybe we should just bite the bullet and do 
> the types:
> 
>      __vdouble2
>      __vfloat4
>      __vlong2
>      __vulong2
>      __vint4
>      __vuint4
>      __vshort8
>      __vushort8
>      __vbyte16
>      __vubyte16

I don't see it being typeless as a problem. The purpose of this is to expose hardware capabilities to D code and the vector registers are typeless, so why shouldn't vector type be "typeless" too? Types such as vfloat4 can be implemented in a library (which could also be made portable and have a nice API).


More information about the Digitalmars-d mailing list