<HTML>
<div><style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style>I mention intrinsics because, according to Florian, someone is already developing support for them, although I can't remember the SVN repository off-hand.</div><div><br>
</div><div>P.S. If such generics were to be supported with my code, it would have to be akin to:<br>
<br>
generic function ShufPS<const N: Byte>(aArg: TM128): TM128; vectorcall; assembler; nostackframe; inline; { I know, that's a lot of directives! }<br>
asm<br>
  SHUFPS XMM0, XMM0, N<br>
end;<br>
</div><br>
<div>That may get messy in the compiler source very quickly, but depending on how well-liked my inline assembler code is, it might be something to look into and experiment with.  One step at a time though.<br>
</div><div><br>
</div><div>There is an example of an intrinsic in one of the regression tests actually... tests/test/cg/tvectorcall3.pp contains a function that just calls ADDPS and has the "inline" directive - until now, "inline" was ignored with a compiler hint, but with my additions, now actually inlines the instruction.<br>
</div><div><br>
</div><div>Gareth aka. Kit<br>
</div> <br>
<br>
<span style="font-weight: bold;">On Fri 15/03/19 13:37 , "Sven Barth" pascaldragon@googlemail.com sent:<br>
</span><blockquote style="BORDER-LEFT: #F5F5F5 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT:0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"><div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">J. Gareth Moreton <<a href="javascript:top.opencompose('gareth@moreton-family.com','','','')">gareth@moreton-family.com</a>> schrieb am Fr., 15. März 2019, 12:33:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>P.S. Though this feature can be used for implementing intrinsics, it is not a direct replacement for them because instructions like SHUFPS cannot be flexibly encoded due to its immediate operand (i.e. it has to be a raw number... it can't take its value from a parameter).</div>
</blockquote></div></div><div dir="auto"><br>
</div><div dir="auto">That could maybe be managed once the support for constants as parameter for generics is added (note: I don't know right now how SHUFPS works, so take the following as pseudo code):</div><div dir="auto"><br>
</div><div dir="auto">=== code begin ===</div><div dir="auto"><br>
</div><div dir="auto">generic function ShufPS<const n:="" integer=""><const N: Integer>(aArg: Whatever): Whatever; inline;</const></div><div dir="auto">begin</div><div dir="auto">  asm</div>
<div dir="auto">    SHUFPS %xmm1, %xmm2, N</div><div dir="auto">  end;</div><div dir="auto">end;</div><div dir="auto"><br>
</div><div dir="auto">=== code end ===</div><div dir="auto"><br>
</div><div dir="auto">As long as the assembler reader correctly handles constants for those parameters this could work as for each N the compiler creates a new function... </div><div dir="auto"><br>
</div><div dir="auto">Regards,</div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 
</blockquote></div></div></div> 
 

</blockquote></HTML>