[fpc-devel] "Homogeneous Float Aggregate"

Florian Klämpfl florian at freepascal.org
Sun Feb 4 21:44:32 CET 2018

Am 04.02.2018 um 20:57 schrieb J. Gareth Moreton:
> Hi everyone,
> So I've almost finished implementing Microsoft's 'vectorcall' calling convention into Free Pascal - the final 
> sticking point are Homogeneous Float Aggregates (HFA's), since the documentation isn't tremendously clear on 
> their internal alignment - vectorcall allows the passing and returning of a record type that contains between 1 
> and 4 fields (or an array) of the same type out of float (Single), Double, or an aligned vector (M128, M256 or 
> M512).
> I'm not certain if my definition of 'aggregate' is correct, but must the fields be packed like an array to be a 
> valid HFA? I'm not certain if they should be packed or each field aligned to a 16-byte boundary like with 
> Homogeneous Vector Aggregates (with M128 fields).  Since the examples given on the Microsoft pages have array-
> like fields, I'm assuming packed (and naturally aligned to 4-byte boundaries for Singles and 8 bytes for 
> Doubles).

Well, naturally aligned I think. packed means the whole hfa may be 1 byte aligned.

> Can anyone confirm this? I don't want to end up programming the implementation incorrectly, as this will cause 
> compatibility problems with any external libraries that use vectorcall.

More information about the fpc-devel mailing list