public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/39315]  New: Unaligned move used on aligned stack variable
@ 2009-02-26 16:57 hjl dot tools at gmail dot com
  2009-02-26 17:00 ` [Bug middle-end/39315] " hjl dot tools at gmail dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: hjl dot tools at gmail dot com @ 2009-02-26 16:57 UTC (permalink / raw)
  To: gcc-bugs

[hjl@gnu-6 pr]$ cat x.c
typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
extern void bar (__m128 *);
void
foo (__m128 *x)
{
  __m128 b = *x;
  bar (&b);
}
[hjl@gnu-6 pr]$ make x.s
/export/build/gnu/gcc-work/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-work/build-x86_64-linux/gcc/ -S -o x.s -O2
-fno-asynchronous-unwind-tables x.c
[hjl@gnu-6 pr]$ cat x.s
        .file   "x.c"
        .text
        .p2align 4,,15
.globl foo
        .type   foo, @function
foo:
        subq    $24, %rsp
        movaps  (%rdi), %xmm0
        movq    %rsp, %rdi
        movlps  %xmm0, (%rsp)
        movhps  %xmm0, 8(%rsp)
        call    bar
        addq    $24, %rsp
        ret

expand_one_stack_var_at has

  /* Set alignment we actually gave this decl.  */
  offset -= frame_phase;
  align = offset & -offset;
  align *= BITS_PER_UNIT;
  if (align > STACK_BOUNDARY || align == 0)
    align = STACK_BOUNDARY;
  DECL_ALIGN (decl) = align;
  DECL_USER_ALIGN (decl) = 0;

  set_mem_attributes (x, decl, true);

That is we always set alignment attribute of a stack variable
to <= STACK_BOUNDARY even if we can align it properly.  One
consequence is unaligned move is used on aligned memory.


-- 
           Summary: Unaligned move used on aligned stack variable
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com


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


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

end of thread, other threads:[~2010-02-20 14:09 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-26 16:57 [Bug middle-end/39315] New: Unaligned move used on aligned stack variable hjl dot tools at gmail dot com
2009-02-26 17:00 ` [Bug middle-end/39315] " hjl dot tools at gmail dot com
2009-02-26 17:01 ` hjl dot tools at gmail dot com
2009-02-26 17:13 ` hjl dot tools at gmail dot com
2009-02-27  2:53 ` Joey dot ye at intel dot com
2009-02-27  3:37 ` hjl dot tools at gmail dot com
2009-02-28  0:03 ` hjl dot tools at gmail dot com
2009-02-28  2:04 ` hjl dot tools at gmail dot com
2009-02-28 18:41 ` hjl dot tools at gmail dot com
2009-02-28 18:55 ` hjl at gcc dot gnu dot org
2009-03-27 22:38 ` hjl at gcc dot gnu dot org
2009-04-16 18:33 ` pinskia at gcc dot gnu dot org
2009-07-23 13:43 ` hjl dot tools at gmail dot com
2009-10-31 16:58 ` hjl at gcc dot gnu dot org
2010-02-20  1:06 ` hjl dot tools at gmail dot com
2010-02-20 14:09 ` rguenth at gcc dot gnu dot 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).