From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24779 invoked by alias); 26 Feb 2009 16:57:02 -0000 Received: (qmail 24754 invoked by uid 48); 26 Feb 2009 16:56:52 -0000 Date: Thu, 26 Feb 2009 16:57:00 -0000 Subject: [Bug middle-end/39315] New: Unaligned move used on aligned stack variable X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "hjl dot tools at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-02/txt/msg02264.txt.bz2 [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