[fpc-devel] The new XMM intrinsics

J. Gareth Moreton gareth at moreton-family.com
Sat Jan 18 19:29:52 CET 2020


I personally would have thought the compiler would be smart enough to 
promote a 128-bit array to an XMM register when among intrinstics or 
just passing the structure as a whole from one place to another, but 
utilise memory movement or the scalar SSE commands when modifying 
individual fields.  I guess it's easier said than done though and 
probably something for me to research later on.

At the very least though, there should be a way to cleanly align a 
structure to a 16-byte granularity in memory, since many of the SSE 
instructions require this.  I don't consider pre-processor directives to 
be particularly clean and easy to use.  True, one can use the "Move" 
instruction to move data from your customised structure to an __m128, 
and back again when you're finished, but this feels like an unnecessary 
degree of overhead.

Gareth aka. Kit

On 18/01/2020 18:17, Florian Klämpfl wrote:

> Am 18.01.20 um 18:52 schrieb J. Gareth Moreton:
>> I think more than anything I would like to see a degree of "ease of 
>> use" for the SIMD intrinsics, since modifying __m128 data in C/C++ is 
>> not that straightforward. 
>
> ... because there exist in general no instructions to do so, e.g. you 
> cannot access a xmm register indexed with sse. Those intrinsics 
> provide only what the CPU can do directly.
>
>> Just as a straightforward example, what might be the best way to 
>> ensure these following record types are compatible with the __m128 
>> data types?
>>
>> *type *TVector4 = *record*
>>    X, Y, Z, W: Single;
>> *end*; // compatible with __m128f
>>
>> *type *TComplex = *record*
>>    Re, Im: Double;
>> *end*; // compatible with __m128d
>>
>> Programmers on their own projects, whether it be a game or a 
>> mathematical program, would much rather work with those constructs if 
>> it can be helped... or at least I would.
>
> This is another level of abstraction, the intrinsics aim really at a 
> direct usage of the sse/avx instructions. No more, no less.
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>


More information about the fpc-devel mailing list