SIMD support...

Manu turkeyman at gmail.com
Fri Jan 6 05:01:21 PST 2012


On 6 January 2012 14:54, bearophile <bearophileHUGS at lycos.com> wrote:

> Walter:
>
> > 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:
>
> What are the disadvantages of making it typeless?
> If it is typeless how do you tell it to perform a 4 float sum instead of a
> 2 double sum?
> Is this low level layer able to support AVX and AVX2 3-way comparison
> instructions too, and the fused multiplication-add instruction?
>

I don't believe there are any. I can see only advantages to implementing
the typed versions in libraries.

To make it perform float4 math, or double2 match, you either write the
pseudo assembly you want directly, but more realistically, you use the
__float4 type supplied in the standard library, which will already
associate all the float4 related functionality, and try and map it across
various architectures as efficiently as possible.

AVX needs a __v256 type in addition to the __v128 type already discussed.
This should be trivial to add in addition to __v128. Again, the libraries
take care of presenting a nice API to the users.
The comparisons and m-sum you mention are just opcodes like any other that
may be used on the raw type, and will be wrapped up nicely in the strongly
typed libraries.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120106/ded073bd/attachment.html>


More information about the Digitalmars-d mailing list