Re: Preventing gcc from aligning stack???

From: Horst von Brand (vonbrand@sleipnir.valparaiso.cl)
Date: Tue Jan 25 2000 - 21:57:03 EST


Tuukka Toivonen <tutoivon@mail.student.oulu.fi> said:
> Horst von Brand said:
> > Yes it is. New gcc's (try to) keep the stack aligned at 16 bytes. The
> > kernel stack is 8Kb on ia32; the 16byte alignment is mostly for floating
> > point performance on Pentium and up, and floating point is forbidden in the

> I'd like to ask, why? Even double is only 8 bytes. Does this mean that 12
> bytes is wasted each argumentless call and -fno-omit-frame-pointer, for
> saving ebp?

No, only 8 (you are forgetting the 4 bytes return address :). 8 bytes is not
much for a call, you'll have perhaps 20 tops in a chain (160 bytes or so)
out of a few Mb worth of space for stack. For _noticeable_ performance
increase in floating point arithmetic. Kernel is a different animal.

The "right" way would be to ensure just that all doubles on the stack are
16-aligned, but that is extremely hairy and won't give you much (except
headaches).

-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viņa del Mar, Chile                               +56 32 672616

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:16 EST