[LLVMbugs] [Bug 11044] New: clang ignores 'aligned' attribute with 'vector_size' attribute

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 30 04:18:47 PDT 2011


           Summary: clang ignores 'aligned' attribute with 'vector_size'
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: steven at uplinklabs.net
                CC: llvmbugs at cs.uiuc.edu

Below is a simple test case to show what I mean. Note the 'movaps', which is an
aligned move, when the 'aligned(1)' clearly says to do unaligned moves (which
GCC respects). The effect of 'movaps' in this case is a fatal fault.

Extra newlines added before each prompt for clarity.

snoonan at loki ~ $ cat test.c
#include <stdint.h>
typedef uint32_t v4 __attribute__ ((vector_size(16), aligned(1)));
void mov_v4(v4 *x, v4 *y)
    *x = *y;

snoonan at loki ~ $ clang -v
clang version 3.0 (ssh://orcus.local/scm/git/tycho/mirrors/llvm/clang.git
http://llvm.org/git/clang.git a891a32d3762ee641a29c091d286f2a7432671a5)
Target: x86_64-unknown-linux-gnu
Thread model: posix

snoonan at loki ~ $ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.5 --enable-shared --enable-multiarch
--with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu
--enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default
--with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)

snoonan at loki ~ $ gcc -o test-gcc.s -S test.c

snoonan at loki ~ $ clang -o test-clang.s -S test.c

snoonan at loki ~ $ head -n 50 test-*.s
==> test-clang.s <==
    .file    "test.c"
    .globl    mov_v4
    .align    16, 0x90
    .type    mov_v4, at function
mov_v4:                                 # @mov_v4
# BB#0:                                 # %entry
    movq    %rdi, -8(%rsp)
    movq    %rsi, -16(%rsp)
    movq    -8(%rsp), %rdi
    movaps    (%rsi), %xmm0
    movaps    %xmm0, (%rdi)
    .size    mov_v4, .Ltmp1-mov_v4

    .section    ".note.GNU-stack","", at progbits

==> test-gcc.s <==
    .file    "test.c"
.globl mov_v4
    .type    mov_v4, @function
    pushq    %rbp
    .cfi_def_cfa_offset 16
    movq    %rsp, %rbp
    .cfi_offset 6, -16
    .cfi_def_cfa_register 6
    movq    %rdi, -8(%rbp)
    movq    %rsi, -16(%rbp)
    movq    -16(%rbp), %rax
    movdqu    (%rax), %xmm0
    movq    -8(%rbp), %rax
    movdqu    %xmm0, (%rax)
    .cfi_def_cfa 7, 8
    .size    mov_v4, .-mov_v4
    .ident    "GCC: (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2"
    .section    .note.GNU-stack,"", at progbits

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list