[fpc-devel] State of SSE/AVX intrinsics

denisgolovan denisgolovan at yandex.ru
Tue Apr 21 10:29:46 CEST 2020


> From tests/test/cg/tvectorcall1.pp
> 
> {$PUSH}
> {$CODEALIGN RECORDMIN=16}
> {$PACKRECORDS C}
> type
> TM128 = record
> case Byte of
> 0: (M128_F32: array[0..3] of Single);
> 1: (M128_F64: array[0..1] of Double);
> end;
> {$POP}
> 
> (This declaration mimics how __m128 is defined in Microsoft Visual C++)
> 
> Gareth aka. Kit

And even this solution does not support dynamic arrays with scalars, right?

{$PUSH}
{$CODEALIGN RECORDMIN=32}
{$PACKRECORDS C}
type
   TIntArray = array of Integer;
   {$POP}

var v:TIntArray;

begin
   SetLength(v,100);
   Writeln(NativeInt(Pointer(v)) and 31); // writes 16 instead of 0
end.


-- Regards,
Denis Golovan


More information about the fpc-devel mailing list