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

J. Gareth Moreton gareth at moreton-family.com
Wed Apr 6 20:32:34 CEST 2022


Another problem... I've tried to declare an ADDPD intrinsic as follows:

function x86_addpd(r0, r1: __m128d): __m128d; [INTERNPROC: 
fpc_in_x86_addpd];

I thought using __m128d instead of __m128 was fairly logical since ADDPD 
works with Doubles, not Singles, but this can cause problems.  For 
example, with the following setup:

     function Special(z1, z2 : __m128d): __m128d; vectorcall;
       begin
         Special := x86_addpd(z1, z2);
       end;

I get the following: Error: Incompatible types: got "__m128" expected 
"__m128d" (the file location is between the closing bracket and the 
semicolon of "Special := x86_addpd(z1, z2);" - it seems that it's 
hard-coded to expect __m128 (error occurs even if vectorcall is not 
specified).

I know there's still some work to do and things to work out with the 
vector types and intrinsics.  I will admit that personally I don't like 
Microsoft Visual C++'s approach of forcing the use of the MM types 
because it feels inflexible and unfriendly, especially as you might, for 
example, want to declare and use something like the following?

type TVector4 = packed record
   X, Y, Z, W: Single;
end align 16;

Gareth aka. Kit


-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the fpc-devel mailing list