public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marc Lehmann <pcg@goof.com>
To: egcs@cygnus.com
Subject: Re: x86 stack alignment redux
Date: Fri, 12 Dec 1997 13:04:00 -0000	[thread overview]
Message-ID: <19971212171051.08257@cerebro.laendle> (raw)
In-Reply-To: <m0xgPgQ-0004ecC@ocean.lucon.org>

> I don't think it is a good idea. Please check out Marc's patch.

defining STACK_BOUNDARY should not affect compatibility issues, but
(in pgcc), I found a bug (which I couldn't track down yet), which is
affect by STACK_BOUNDARY==64.. sometimes, combine will optimize

lea 16(%esp),%ebx
addl $4,%ebx

into

lea 16(%esp),%ebx
orb $4,%ebx

when another push is added in the prologue (to save registers), the orb is
no longer valid.

I have no idea wether this is a pgcc.only bug or not, it's still on my list ;)

another problem is that, on machines that have push_insns, gcc/egcs/pgcc will
effectively ignore the bvalue that FUNCTION_BOUNDARY returns on calls, i.e.
a double argument is aligned properly when generating the function body, but
when the function is called, gcc just push'es some integers without aligning
the double that follows.

> There are several alignments. We should enable those which won't
> break old binaries by default. We only enable those which are not
> compatible with old binaries when asked for. Please check the egcs
> mail archive. I have forwarded Marc's patch to egcs at the beginning.

-mstack-align-double (STACK_BOUNDARY) is safe (apart from the above bug)
-marg-align-double (aligning doubles in argument slots)  totally breaks the abi
                   (totally = much more often than -malign-double), and doesn't work
                   yet.
-malign-double (structures) breaks the abi, but often works in practise (libjpeg
               is a prominent exception).

this is really very bad, since misalignment often causes runtime
differences of 30% and *more*. I often get letters from people
that ask my why static variables seem to be faster than auto variables
(or vice versa), which is caused by random alignment.

      -----==-                                              |
      ----==-- _                                            |
      ---==---(_)__  __ ____  __       Marc Lehmann       +--
      --==---/ / _ \/ // /\ \/ /       pcg@goof.com       |e|
      -=====/_/_//_/\_,_/ /_/\_\                          --+
    The choice of a GNU generation                        |
                                                          |

  parent reply	other threads:[~1997-12-12 13:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-13  9:28 Dave Love
1997-12-11 23:10 ` Jeffrey A Law
1997-12-11 23:40   ` H.J. Lu
1997-12-12  0:18     ` Jeffrey A Law
1997-12-12  7:28       ` H.J. Lu
1997-12-12 10:18       ` Marc Lehmann
1997-12-12 13:04       ` Dave Love
1997-12-14 22:36         ` Jeffrey A Law
1997-12-12 13:04     ` Marc Lehmann [this message]
1997-12-14 22:41       ` Jeffrey A Law
1997-12-12 13:04 Mike Stump

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19971212171051.08257@cerebro.laendle \
    --to=pcg@goof.com \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).