[fpc-devel] Alignment question

Sergei Gorelkin sergei_gorelkin at mail.ru
Sat Nov 19 14:04:01 CET 2011


19.11.2011 14:14, Jonas Maebe пишет:
>
> On 19 Nov 2011, at 11:31, Sergei Gorelkin wrote:
>
>> Is it possible to declare a (SSE friendly) record or array type, so that local variables of this type get aligned to e.g. 16 bytes?
>
> I don't think so. For this, we'd probably need a separate vector type (possibly using a modifier for array types, or with a new keyword). All ABIs for architectures supporting vector processing also treat vectors as distinct types. Such functionality is also required to finish the high level code generator in the JVM branch for native targets (it has to be to distinguish vectors from arrays at the tdef level).
>
Hm, that looks like two separate tasks: one is distinct vector type for ABIs, another one is 
alignment of arbitrary types. The issue I've stumbled into is the TContext record (CPU context), 
which contains only word and qword members, but has to be 16 byte aligned because it is used by SSE 
instructions. In SDK it has a __declspec(align(16)) attribute, I guess we need something like that too.

Sergei




More information about the fpc-devel mailing list