<div class="gmail_quote">On 6 January 2012 14:54, bearophile <span dir="ltr"><<a href="mailto:bearophileHUGS@lycos.com">bearophileHUGS@lycos.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Walter:<br>
<div class="im"><br>
> One caveat is it is typeless; a __v128 could be used as 4 packed ints or 2<br>
> packed doubles. One problem with making it typed is it'll add 10 more types to<br>
> the base compiler, instead of one. Maybe we should just bite the bullet and do<br>
> the types:<br>
<br>
</div>What are the disadvantages of making it typeless?<br>
If it is typeless how do you tell it to perform a 4 float sum instead of a 2 double sum?<br>
Is this low level layer able to support AVX and AVX2 3-way comparison instructions too, and the fused multiplication-add instruction?<br></blockquote><div><br></div><div>I don't believe there are any. I can see only advantages to implementing the typed versions in libraries.</div>
<div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div>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.</div></div>