[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


http://llvm.org/bugs/show_bug.cgi?id=11044

           Summary: clang ignores 'aligned' attribute with 'vector_size'
                    attribute
           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.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper
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"
    .text
    .globl    mov_v4
    .align    16, 0x90
    .type    mov_v4, at function
mov_v4:                                 # @mov_v4
.Ltmp0:
    .cfi_startproc
# BB#0:                                 # %entry
    movq    %rdi, -8(%rsp)
    movq    %rsi, -16(%rsp)
    movq    -8(%rsp), %rdi
    movaps    (%rsi), %xmm0
    movaps    %xmm0, (%rdi)
    ret
.Ltmp1:
    .size    mov_v4, .Ltmp1-mov_v4
.Ltmp2:
    .cfi_endproc
.Leh_func_end0:


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

==> test-gcc.s <==
    .file    "test.c"
    .text
.globl mov_v4
    .type    mov_v4, @function
mov_v4:
.LFB0:
    .cfi_startproc
    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)
    leave
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc
.LFE0:
    .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