This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Useless assembly
- From: "Dave Korn" <dk at artimi dot com>
- To: "'Robert Dewar'" <dewar at gnat dot com>,"'Sam Lauber'" <sam124 at operamail dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Tue, 30 Nov 2004 13:41:51 -0000
- Subject: RE: Useless assembly
> -----Original Message-----
> From: gcc-owner On Behalf Of Robert Dewar
> Sent: 30 November 2004 04:24
> Sam Lauber wrote:
> > What's the stack have to do with it? I thought I had a 32-bit i686.
> > Why would we have to align the stack to a 16-bit boundry?
>
> It's 16-byte alignment, and the code you eliminated was
> performing many critical
> functions including this alignment, which is required for
> maximum efficiency.
Not just efficiency but correctness also, when using vector instructions.
Throw away the stack alignment code in main and everything down the call
hierarchy will not have the alignment it expects from the stack, meaning it
will place local variables at unaligned addresses. I don't know whether the
mmx/sse unit would trap or just round the unaligned addresses (thereby
causing locals to stomp all over each other) but the resulting mess would
_not_ be a pretty sight.
> > And why would there have to be a stack at all?
>
> That's a peculiar question, the stack is fundamental to the calling
> sequence and the call instruction.
I guess now would not be a good time to mention stackless python ? :-)
cheers,
DaveK
--
Can't think of a witty .sigline today....