[fpc-devel] Successful implementation of inline support for pure assembler routines on x86

Sven Barth pascaldragon at googlemail.com
Fri Mar 15 14:37:48 CET 2019


J. Gareth Moreton <gareth at moreton-family.com> schrieb am Fr., 15. März
2019, 12:33:

> 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).
>

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):

=== code begin ===

generic function ShufPS<const N: Integer>(aArg: Whatever): Whatever; inline;
begin
  asm
    SHUFPS %xmm1, %xmm2, N
  end;
end;

=== code end ===

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...

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190315/272ffbef/attachment.html>


More information about the fpc-devel mailing list