[fpc-devel] Problems with MM types (__m128 etc).

J. Gareth Moreton gareth at moreton-family.com
Fri Apr 8 20:13:34 CEST 2022

Also I just raised an internal error on the trunk:

program m128test;

   UnalignedArray = array[0..1] of Double;

function Test3(V1, V2: UnalignedArray): UnalignedArray; vectorcall;
   Test3[1] := V1[1] + V2[1];


Compiler fails with "m128.pp(7,1) Fatal: Internal error 200410108" under 
x86_64-win64 (location (7,1) is the "begin" keyword).  I'll be making a 
bug report of this as a reminder that I need to fix it.  In this 
situation, the error does not occur if 'vectorcall' is omitted, and the 
correct behaviour is that the result and parameters aren't vectorised 
because they aren't aligned to a 16-byte boundary.

(On a side note, I'd ask if it's permissible to add support for "align 
16" and the like for regular types and not just records. For example, 
"type UnalignedArray = array[0..1] of Double align 16;", which is 
essentially __m128d).

Gareth aka. Kit

On 08/04/2022 18:57, J. Gareth Moreton via fpc-devel wrote:
> It looks like support for writing to arrays that are wholly stored in 
> registers is a little limited and buggy - while it writes to temporary 
> memory when modifying an individual element, the compiler sometimes 
> doesn't write back the final result into the original register.  I'm 
> seeing if I can fix it.
> Gareth aka. Kit

This email has been checked for viruses by Avast antivirus software.

More information about the fpc-devel mailing list