------- Comment #16 from mikulas at artax dot karlin dot mff dot cuni dot cz  
2009-07-31 15:22 -------
H.J. Lu: No, you only have to align the stack in functions that do 16-byte SSE.

I mean this:

there are two possible reasons for aligning the stack
1) improved performance (double, long double, MMX, 8-byte SSE)
2) avoid crashes (16-byte SSE)

To solve the case 1), it is perfectly reasonable to not align the stack and
simply make sure that every function subtracts the stack by multiple of
16-bytes. If, by chance, the code is called from some other code with unaligned
stack (like in that obstack example), the user will only suffer lower
performance, not crashes.

It is legal to make floating point calculations from obstack allocation
callback --- but it is not common. So we don't have to care about performance
in this case.

To solve the case 2), you need to manually realign the stack at function
prologue. But there are few functions that use SSE in typical desktop/server
environment, that's why I'm saying that it won't have big impact on
performance.

Anyway, if some scientist needs high 16-bit SSE performance, we can make a flag
for him that avoids stack realign --- but don't compile typical desktop/server
distribution with this flag, because there ARE cases where the stack is
misaligned.

That's what I'm proposing in comment #3: that every type has two alignments,
preferred alignment and enforced alignment. Only "enforced alignment" will
force stack realign.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838

Reply via email to