diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-03-22 22:36:39 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-03-22 22:36:39 +0000 |
commit | e5a8aeb4ad762b9383f9e9544c619dc386951e18 (patch) | |
tree | 77f3a7d98f82917926e91073bda0edddd500782d /test/CodeGen | |
parent | 5aac0b6ae95f137b1783f3e6227241fb457b8f8b (diff) |
Make sure we correctly set the alignment for vector loads and stores associated with vector element lvalues. Patch by Kevin Schoedel (with some minor modifications by me).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153285 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r-- | test/CodeGen/ext-vector-member-alignment.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/CodeGen/ext-vector-member-alignment.c b/test/CodeGen/ext-vector-member-alignment.c new file mode 100644 index 0000000000..73a6d6cf85 --- /dev/null +++ b/test/CodeGen/ext-vector-member-alignment.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+typedef float float4 __attribute__((ext_vector_type(4)));
+
+struct __attribute__((packed, aligned(4))) struct1 {
+ float4 position;
+};
+int x = __alignof(struct struct1);
+
+float4 f(struct struct1* x) { return x->position; }
+
+void func(struct struct1* p, float *a, float *b, float c) {
+ p->position.x = c;
+ *a = p->position.y;
+ *b = p->position[0];
+ p->position[2] = c;
+ // FIXME: We should be able to come up with a more aggressive alignment
+ // estimate.
+ // CHECK: @func
+ // CHECK: load <4 x float>* {{%.*}}, align 1
+ // CHECK: store <4 x float> {{%.*}}, <4 x float>* {{%.*}}, align 1
+ // CHECK: load <4 x float>* {{%.*}}, align 1
+ // CHECK: load <4 x float>* {{%.*}}, align 1
+ // CHECK: load <4 x float>* {{%.*}}, align 1
+ // CHECK: store <4 x float> {{%.*}}, <4 x float>* {{%.*}}, align 1
+ // CHECK: ret void
+}
|