[fpc-devel] Difficulty in specifying record alignment... and more compiler optimisation shenanigans!

J. Gareth Moreton gareth at moreton-family.com
Wed Oct 23 22:36:33 CEST 2019


So I did a bit of reading after finding the "mpx-linux64-abi.pdf" 
document.  As I suspected, the System V ABI is like vectorcall when it 
comes to using the XMM registers... only the types __m128, __float128 
and __Decimal128 use the "SSEUP" class and hence use the entire 
register.  The types are opaque, but both their size and alignment are 
16 bytes, so I think anything that abides by those rules can be 
considered equivalent.

If the complex type is unaligned, the two fields get their own XMM 
register.  If aligned, they both go into %xmm0.  At least that is what I 
gathered from reading the document - it's a little unclear sometimes.

Gareth aka. Kit

On 23/10/2019 06:59, Florian Klämpfl wrote:
> Am 23. Oktober 2019 01:14:03 schrieb "J. Gareth Moreton" <gareth at moreton-family.com>:
>
>> That's definitely a marked improvement.  Under the System V ABI and
>> vectorcall, both fields of a complex type would be passed through xmm0.
>> Splitting it up into two separate registers would require something like:
>>
>>
>> shufpd    %xmm0,%xmm1,3 { Copy the high-order Double into the low-order
>> position - an immediate operand of "1" will also work, since we're not
>> concerned with the upper 64 bits of %xmm1 }
>>
>>
>> After which your complied code will work correctly (since it looks like
>> %xmm1 was undefined before):
> The code is correct, on x86_64-linux vectorcall is ignored. Supporting vectorcall with my approach would be more difficult.
>
>
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>

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



More information about the fpc-devel mailing list