[...@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); } [...@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 [...@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