This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: patch to handle i386 stack alignment using PREFERRED_STACK_BOUNDARY

  In message <199901270647.BAA16923@jwlab.FEITH.COM>you write:
  > This patch causes gcc to maintain the i386 PREFERRED_STACK_BOUNDARY
  > alignment. It works by adjusting the amount of local storage allocated by
  > the prologue.
  > Notes:
  >   1) The patch doesn't actually define PREFERRED_STACK_BOUNDARY.  However
  >      if you do define it then this patch is necessary for it to work on
  >      the i386.
  >   2) In order to be useful "recommended alignment for local i386 FP
  >      variables  patch (version 2)" should be installed.
  >   3) The performance results need to be taken with a grain of salt since
  >      there appears to be a problem will how calls.c maintains the
  >      alignment when faced with nested calls.  Also I don't known if the
  >      startup code on the platform used aligns the stack on a 64 bit
  >      boundary.
  >   4) There are no regressions with the testsuite on FreeBSD 3.0.
Thanks.  I played around with this a little.  Specifically I installed this
patch along with a patch of my own to define PREFERRED_STACK_BOUNDARY.

The results were generally quite negative.  A ~8% drop in spec92fp with
the majority of tests getting slower and very few improving.

I suspect somewhere we get an unaligned stack, and it just propagates
through all the code and we lose badly.

I've also done some reading on the subject (Intel, AMD and other docs) and
they generally recommend using the other method (align the stack via the
prologue and burn the extra register as needed).

So the PREFERRED_STACK_BOUNDARY may be a dead end.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]