Gcc extra alignment..
Jamie Lokier
egcs@tantalophile.demon.co.uk
Thu Nov 2 08:38:00 GMT 2000
John Wehle wrote:
> > The stack is aligned to 16 bytes for some reason I don't entirely see
> > the point in. (Like, why can't the few functions that use 128-bit SIMD
> > use `and' to align their stack instead?)
>
> Keeping the stack always aligned is felt to be cheaper than burning another
> register in order to still access the arguments when using 'and' to align
> the stack.
It's also possible to copy the arguments to the aligned stack area, so
you don't need two stack registers.
> I didn't have any benchmark numbers which clearly indicated the best
> approach when I supplied the patches for both approaches in late 1998
> / early 1999 (in fact there may not be one best approach).
Well the most obvious thing is that _most_ programs don't need 16-byte
alignment at all, and relatively small parts of relatively few programs
need 8-byte alignment either.
That means alignments in code which _doesn't_ use floating point, MMX or
SSE are pure overhead. The Linux kernel is one such program.
Is that accounted for in your benchmark?
> Of course both the stack and frame pointer are normally present unless
> -fomit-frame-pointer is in use so really no additional registers are
> needed to support using 'and' to align the stack. I don't believe that
> there's any reason it can't be supported as an option if someone was to
> update the my original patch and supply convincing benchmark numbers.
-- Jamie
More information about the Gcc
mailing list