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