blob: 49e69977fffdc7f28103fd769002fe872ecc7bae [file] [log] [blame]
Matt Beaumont-Gaybce35a22012-03-22 23:15:04 +00001// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
2
3typedef float float4 __attribute__((ext_vector_type(4)));
4
5struct __attribute__((packed, aligned(4))) struct1 {
6 float4 position;
7};
8int x = __alignof(struct struct1);
9
10float4 f(struct struct1* x) { return x->position; }
11
12void func(struct struct1* p, float *a, float *b, float c) {
13 p->position.x = c;
14 *a = p->position.y;
15 *b = p->position[0];
16 p->position[2] = c;
17 // FIXME: We should be able to come up with a more aggressive alignment
18 // estimate.
19 // CHECK: @func
20 // CHECK: load <4 x float>* {{%.*}}, align 1
21 // CHECK: store <4 x float> {{%.*}}, <4 x float>* {{%.*}}, align 1
22 // CHECK: load <4 x float>* {{%.*}}, align 1
23 // CHECK: load <4 x float>* {{%.*}}, align 1
24 // CHECK: load <4 x float>* {{%.*}}, align 1
25 // CHECK: store <4 x float> {{%.*}}, <4 x float>* {{%.*}}, align 1
26 // CHECK: ret void
27}