diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-07-13 23:57:43 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-07-13 23:57:43 +0000 |
commit | f9e9af7df0cea6e997ac04131c7af6ca4384b0cc (patch) | |
tree | e465c3d01b6954e3ae02b85003f2e1135a0fd47e /test/CodeGen/vector-alignment.c | |
parent | 558e8872b364b43ab9f201dd6b2df9a5b74b0542 (diff) |
Add a per target max vector alignment field (e.g., 32-byte alignment for x86 due to
AVX). Currently, if no aligned attribute is specified the alignment of a vector is
inferred from its size. Thus, very large vectors will be over-aligned with no
benefit. Target owners should set this target max.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160209 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/vector-alignment.c')
-rw-r--r-- | test/CodeGen/vector-alignment.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/CodeGen/vector-alignment.c b/test/CodeGen/vector-alignment.c new file mode 100644 index 0000000000..92d1ae73f9 --- /dev/null +++ b/test/CodeGen/vector-alignment.c @@ -0,0 +1,38 @@ +// RUN: %clang_cc1 -w -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// rdar://11759609 + +// At or below target max alignment with no aligned attribute should align based +// on the size of vector. +double __attribute__((vector_size(16))) v1; +// CHECK: @v1 {{.*}}, align 16 +double __attribute__((vector_size(32))) v2; +// CHECK: @v2 {{.*}}, align 32 + +// Alignment above target max alignment with no aligned attribute should align +// based on the target max. +double __attribute__((vector_size(64))) v3; +// CHECK: @v3 {{.*}}, align 32 +double __attribute__((vector_size(1024))) v4; +// CHECK: @v4 {{.*}}, align 32 + +// Aliged attribute should always override. +double __attribute__((vector_size(16), aligned(16))) v5; +// CHECK: @v5 {{.*}}, align 16 +double __attribute__((vector_size(16), aligned(64))) v6; +// CHECK: @v6 {{.*}}, align 64 +double __attribute__((vector_size(32), aligned(16))) v7; +// CHECK: @v7 {{.*}}, align 16 +double __attribute__((vector_size(32), aligned(64))) v8; +// CHECK: @v8 {{.*}}, align 64 + +// Check non-power of 2 widths. +double __attribute__((vector_size(24))) v9; +// CHECK: @v9 {{.*}}, align 32 +double __attribute__((vector_size(40))) v10; +// CHECK: @v10 {{.*}}, align 32 + +// Check non-power of 2 widths with aligned attribute. +double __attribute__((vector_size(24), aligned(64))) v11; +// CHECK: @v11 {{.*}}, align 64 +double __attribute__((vector_size(80), aligned(16))) v12; +// CHECK: @v12 {{.*}}, align 16 |