Hi Jakob, On Mon, Apr 30, 2012 at 05:38:35PM +0200, Jakob Eriksson wrote: > http://developer.amd.com/documentation/articles/pages/ImplementingAMDcache-optimalcodingtechniques.aspx > > explains how a pretty large alignment can actually increase speed in the end.
No doubt I agree with the necessity to align _data_structures_ to their proper boundaries, to optimize the cache usage etc. What I don't agree with is aligning the _whole_stack_, from top down through the whole function hierarchy. It is a waste of space and processing time. Very few functions in a typical environment will actually call 16-byte SSE instructions, and even fewer ones will operate on the stack instead of allocated heap memory. For example, a function call without stacked arguments (e.g. because all arguments fit into registers, i.e. they are 6 or less), or with an even number of stacked arguments, always needs a do-nothing stack manipulation instruction (i.e. create a dummy stack frame) to align the stack. Instead, it would be very easy to do a simple alignment operation just there where it is needed. In 2009, I found this discussion: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838 My impression is that back then the major opinion was that it isn't a good idea. Anyway, it doesn't help to complain ;-) Cheers, - Alex -- UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe
