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

J. Gareth Moreton gareth at moreton-family.com
Wed Apr 6 21:24:15 CEST 2022

Pascal simply is a strongly typed language. Vector intrinsics are no 
reason to weaken this. Thus you need to declare operator overloads that 
hide the nitty, gritty details of assigning a TVector4 to a __m128, e.g.:
> type
>   TVector4 = packed record
>     X, Y, Z, W: Single;
>     class operator := (const aArg: TVector4): __m128;
>     class operator := (const aArg: __m128): TVector4;
>   end;
> Regards,
> Sven

That's true - I'm still learning when an implicit typecast is valid and 
when it isn't.  In the above example, __m128(some_TVector4_type), is 
usually valid because the alignments and memory are the same.  
Internally though, the __m128 types are broken in a few places.

Gareth aka. Kit

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

More information about the fpc-devel mailing list