Sign in Join

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

Mailing lists / fpc-devel / 2005-08

Re: (no subject)

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

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

Florian Klaempfl
Ростислав Окулов wrote 18 lines
>Ростислав Окулов wrote: > >>How I can aligh data in FPC like in C? >> >>struct __declspec(align(16)) VECTOR4F >>{ >> float x; >> float y; >> float z; >> float w; >>}; > >FPC can align local data only up to 4 byte boundaries. Aligning to 16 byte >boundaries done by the compiler requires too much extra code because at every >procedure entry the stack must be realigned so causing often a slow down. > Ok. By when you use SSE2 or SSE3 data *MUST* be alligned to 16 bytes..

Only vector data. The compiler doesn't generate vector instruction so you need it for assembler only and in assembler procedures you can align the stack yourself.

and if it is? we can use movups or movaps instead movss(FPC use this instruction, but It's more sloly than use mov*ps)

Clock cycle count of mov*ps might be lower but: movups/movaps move 16 bytes while movss moves only 4 bytes: higher memory traffic. Further, if you load a single, using mov*ps is dangerous because you could access data outside valid memory which can cause segmentation faults, if the segment limits aren't aligned to 16 byte boundaries.

Reply by email