public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/40838]  New: gcc shouldn't assume that the stack is aligned
@ 2009-07-23 12:53 mikulas at artax dot karlin dot mff dot cuni dot cz
  2009-07-23 12:56 ` [Bug rtl-optimization/40838] " jakub at gcc dot gnu dot org
                   ` (83 more replies)
  0 siblings, 84 replies; 89+ messages in thread
From: mikulas at artax dot karlin dot mff dot cuni dot cz @ 2009-07-23 12:53 UTC (permalink / raw)
  To: gcc-bugs

typedef int v4si __attribute__ ((vector_size (16)));

v4si y(v4si *s3)
{
        return *s3;
}

extern v4si s1, s2;

v4si x(void)
{
        v4si s3 = s1 + s2;
        return y(&s3);
}

And compile it with -O2 -fno-inline -msse2 -fomit-frame-pointer

The variable s3 is stored using unaligned store (movdqu) and loaded using
aligned load (movdqa). -mpreferred-stack-boundary=4 doesn't guarantee stack
alignment, it only advises that there is stack alignment (the function may be
called from OS callback, signal, another library compiled with lesser
alignment, etc... --- and i386 mandates only 4-byte stack alignment), so use of
movdqa is incorrect. (does GCC ABI mandate that all vector types must be
aligned? If so, then movdqa is correct, but storing it on the stack, relying on
alignment -mpreferred-stack-boundary=4 is not correct).

Now, if you compile it with -mpreferred-stack-boundary=2, function "x" aligns
the stack but uses movdqu to store on the aligned stack, so it generates
suboptimal code.


-- 
           Summary: gcc shouldn't assume that the stack is aligned
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mikulas at artax dot karlin dot mff dot cuni dot cz
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


^ permalink raw reply	[flat|nested] 89+ messages in thread
[parent not found: <bug-40838-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2014-02-16 10:01 UTC | newest]

Thread overview: 89+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-23 12:53 [Bug rtl-optimization/40838] New: gcc shouldn't assume that the stack is aligned mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-23 12:56 ` [Bug rtl-optimization/40838] " jakub at gcc dot gnu dot org
2009-07-23 13:14 ` jakub at gcc dot gnu dot org
2009-07-23 13:15 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-23 13:19 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-23 13:24 ` jakub at gcc dot gnu dot org
2009-07-23 13:43 ` hjl dot tools at gmail dot com
2009-07-23 13:49 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-23 13:54 ` jakub at gcc dot gnu dot org
2009-07-23 13:56 ` hjl dot tools at gmail dot com
2009-07-23 14:36 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-31  1:00 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-31  1:04 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-31  7:12 ` jakub at gcc dot gnu dot org
2009-07-31 13:54 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-31 14:27 ` hjl dot tools at gmail dot com
2009-07-31 15:22 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-31 15:31 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-07-31 15:52 ` hjl dot tools at gmail dot com
2009-07-31 16:17 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-08-06 16:48 ` hjl dot tools at gmail dot com
2009-08-06 21:05 ` hjl dot tools at gmail dot com
2009-08-06 21:43 ` hjl dot tools at gmail dot com
2009-08-08 17:31 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-08-16 17:37 ` hjl dot tools at gmail dot com
2009-08-18  4:43 ` hjl dot tools at gmail dot com
2009-08-18  4:50 ` hjl dot tools at gmail dot com
2009-08-18 11:28 ` mahatma at eu dot by
2009-08-18 14:01 ` hjl dot tools at gmail dot com
2009-08-19 19:08 ` mahatma at eu dot by
2009-08-23 19:28 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-08-27 19:18 ` mahatma at eu dot by
2009-09-13 13:58 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-09-13 13:59 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-09-13 14:07 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-09-19 21:37 ` hjl dot tools at gmail dot com
2009-09-19 21:38 ` hjl dot tools at gmail dot com
2009-09-19 21:39 ` hjl dot tools at gmail dot com
2009-09-19 21:40 ` hjl dot tools at gmail dot com
2009-09-20  6:31 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-09-20 18:43 ` hjl dot tools at gmail dot com
2009-09-20 18:44 ` hjl dot tools at gmail dot com
2009-09-20 18:45 ` hjl dot tools at gmail dot com
2009-09-23 16:28 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-09-23 16:34 ` hjl dot tools at gmail dot com
2009-09-23 18:37 ` mahatma at eu dot by
2009-09-25  0:57 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-09-25  2:31 ` hjl dot tools at gmail dot com
2009-09-26  4:25 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-09-26 14:06 ` hjl dot tools at gmail dot com
2009-09-26 15:44 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-09-26 16:15 ` hjl dot tools at gmail dot com
2009-09-26 16:55 ` hjl dot tools at gmail dot com
2009-09-26 16:58 ` hjl dot tools at gmail dot com
2009-09-27  9:03 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-09-27  9:07 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-09-27  9:36 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-10-15 14:29 ` mahatma at eu dot by
2009-10-15 20:24 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-10-15 20:54 ` hjl dot tools at gmail dot com
2009-10-16  0:56 ` hjl dot tools at gmail dot com
2009-10-16  2:11 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2009-10-16  2:48 ` hjl dot tools at gmail dot com
2009-10-30 14:32 ` hjl at gcc dot gnu dot org
2009-10-30 15:45 ` hjl at gcc dot gnu dot org
2009-10-31 16:47 ` hjl dot tools at gmail dot com
2009-12-26 22:19 ` hjl dot tools at gmail dot com
2010-04-17 14:29 ` t dot artem at mailcity dot com
2010-04-20  7:48 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2010-04-29  2:12 ` t dot artem at mailcity dot com
2010-04-29  6:29 ` ubizjak at gmail dot com
2010-04-29  7:24 ` t dot artem at mailcity dot com
2010-04-29  7:33 ` jakub at gcc dot gnu dot org
2010-04-29  7:51 ` ubizjak at gmail dot com
2010-04-29  8:29 ` t dot artem at mailcity dot com
2010-04-29 22:58 ` dirtyepic at gentoo dot org
2010-05-12 13:01 ` jcea at hispasec dot com
2010-05-12 13:15 ` jcea at hispasec dot com
2010-08-09  1:56 ` jasmin at revisionfx dot com
2010-08-11 21:26 ` jasmin at revisionfx dot com
2010-08-17 20:17 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2010-08-17 21:03 ` jasmin at revisionfx dot com
2010-08-17 21:17 ` mikulas at artax dot karlin dot mff dot cuni dot cz
2010-08-24 22:10 ` jasmin at revisionfx dot com
2010-08-25 21:27 ` mikulas at artax dot karlin dot mff dot cuni dot cz
     [not found] <bug-40838-4@http.gcc.gnu.org/bugzilla/>
2011-01-18 21:11 ` t.artem at mailcity dot com
2011-01-18 21:18 ` hjl.tools at gmail dot com
2011-03-13 16:56 ` mahatma at eu dot by
2014-02-16 10:01 ` jackie.rosen at hushmail dot com

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