Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2018-02

"Homogeneous Float Aggregate"

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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

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

Reply by email

Florian Klämpfl
to J. Gareth Moreton
J. Gareth Moreton wrote 13 lines
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.

Reply by email

Jonas Maebe
to Florian Klämpfl
Florian Klämpfl wrote 8 lines
Am 04.02.2018 um 20:57 schrieb J. Gareth Moreton: > 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.

The is_hfa() function from aarch64/cpupara.pas could probably be generalised (so it gets the maximum size/number of elements as parameter) and be moved to parabase (or to paramgr).

Jonas

Reply by email