SIMD support...
Manu
turkeyman at gmail.com
Sat Jan 7 17:32:00 PST 2012
On 8 January 2012 02:54, Peter Alexander <peter.alexander.au at gmail.com>wrote:
> I agree with Manu that we should just have a single type like __m128 in
> MSVC. The other types and their conversions should be solvable in a library
> with something like strong typedefs.
>
Walter put in a reasonable effort to sway me to his side of the fence last
night. I'm still not entirely sold that implementation inside the language
is necessary to achieve these details, but I don't have enough background
into to argue, and I'm not the one that has to maintain the code :)
Here are some points we discussed... how do we do these (efficiently) in a
library?
** Literal syntax.. and constant folding:
Constants and literals also need to be aligned. If we use array syntax to
express literals, this will be a problem.
int4 v = [ 1,2,3,4 ] + [ 5,6,7,8 ];
Any constant expressions need to be simplified at compile time: int4 vec =
[ 6,8,10,12 ];
Perhaps this is possible with CTFE? Or will it be automatic if you express
literals as if they were arrays?
** Expression interpretation/simplification:
float4 v = -b + a;
Obviously, this should be simplified to 'a - b'.
float4 v = a*b + c;
This should use a multiply-accumulate opcode on most architectures: FMADDPS
v, a, b, c
** Typed debug info
In a debugger it's nice to inspect variables in their supposed type.
Can probably use unions to do this... probably wouldn't be as nice though.
** God knows what other optimisations
float4 v = [ 0,0,0,0 ]; // XOR v
etc...
I don't know what amount of this is achievable with libraries, but Walter
seems to think this will all work much better in the language... I'm
inclined to trust his judgement.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120108/b8a6fbdb/attachment-0001.html>
More information about the Digitalmars-d
mailing list