public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/53383] New: Allow -mpreferred-stack-boundary=3 on x86-64
@ 2012-05-17  0:19 hpa at zytor dot com
  2012-05-17 14:12 ` [Bug target/53383] " hjl.tools at gmail dot com
                   ` (24 more replies)
  0 siblings, 25 replies; 27+ messages in thread
From: hpa at zytor dot com @ 2012-05-17  0:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383

             Bug #: 53383
           Summary: Allow -mpreferred-stack-boundary=3 on x86-64
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hpa@zytor.com


In the Linux kernel, we do not use SSE or floating-point of any kind (except in
very particular highly controlled places); furthermore, stack space is at an
extreme premium.  As such, it makes absolutely no sense to align the stack to
16 bytes in x86-64.

gcc, however, refuses to allow setting the stack alignment to 8 bytes:

: anacreon 105 ; gcc -mpreferred-stack-boundary=3 -mincoming-stack-boundary=3
-O2 -mno-sse -c /tmp/foo.c
/tmp/foo.c:1:0: error: -mpreferred-stack-boundary=3 is not between 4 and 12
/tmp/foo.c:1:0: error: -mincoming-stack-boundary=3 is not between 4 and 12

This is particularly ironic since we have found out that, in fact, ALL kernel
stacks are actually 16-byte misaligned on x86-64 as the entry code pushes a
total of 88 bytes onto the stack.  As such, gcc trying to keep a 16-byte
alignment actually makes the code do worse, not better.


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2015-07-06 11:51 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-17  0:19 [Bug c/53383] New: Allow -mpreferred-stack-boundary=3 on x86-64 hpa at zytor dot com
2012-05-17 14:12 ` [Bug target/53383] " hjl.tools at gmail dot com
2012-05-17 14:29 ` hpa at zytor dot com
2012-05-17 15:44 ` hjl.tools at gmail dot com
2012-05-17 16:00 ` hpa at zytor dot com
2012-05-17 16:28 ` hpa at zytor dot com
2012-05-18 11:41 ` rguenth at gcc dot gnu.org
2012-05-18 12:02 ` hubicka at gcc dot gnu.org
2012-05-18 17:29 ` hpa at zytor dot com
2012-05-19 19:22 ` hubicka at ucw dot cz
2012-05-19 21:28 ` hjl.tools at gmail dot com
2012-05-19 21:54 ` hubicka at ucw dot cz
2012-05-20  4:45 ` hjl.tools at gmail dot com
2012-05-20 11:15 ` hubicka at ucw dot cz
2012-05-20 11:35   ` Jan Hubicka
2012-05-20 13:56 ` hubicka at ucw dot cz
2012-05-20 15:36 ` hjl.tools at gmail dot com
2012-05-20 15:39 ` hjl.tools at gmail dot com
2012-06-22 17:11 ` hjl at gcc dot gnu.org
2012-06-22 17:12 ` hjl.tools at gmail dot com
2012-06-22 17:13 ` hjl at gcc dot gnu.org
2013-02-27 10:22 ` paolo.carlini at oracle dot com
2015-07-05 19:56 ` luto at mit dot edu
2015-07-05 20:36 ` hjl.tools at gmail dot com
2015-07-05 20:49 ` luto at mit dot edu
2015-07-05 21:04 ` hjl.tools at gmail dot com
2015-07-06 11:51 ` hjl at gcc dot gnu.org

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).