[fpc-devel] "Homogeneous Float Aggregate"

J. Gareth Moreton gareth at moreton-family.com
Sun Feb 4 20:57:15 CET 2018


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).

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.

Gareth aka. Kit



More information about the fpc-devel mailing list