1// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
2
3__attribute((aligned(16))) float a[128];
4union {int a[4]; __attribute((aligned(16))) float b[4];} b;
5
6// CHECK: @a = {{.*}}zeroinitializer, align 16
7// CHECK: @b = {{.*}}zeroinitializer, align 16
8
9long long int test5[1024];
10// CHECK-DAG: @test5 = common global [1024 x i64] zeroinitializer, align 8
11
12// PR5279 - Reduced alignment on typedef.
13typedef int myint __attribute__((aligned(1)));
14
15void test1(myint *p) {
16  *p = 0;
17}
18// CHECK: @test1(
19// CHECK: store i32 0, i32* {{.*}}, align 1
20// CHECK: ret void
21
22int test1a(myint *p) {
23  return *p;
24}
25// CHECK: @test1a(
26// CHECK: load i32* {{.*}}, align 1
27// CHECK: ret i32
28
29
30// PR5279 - Reduced alignment on typedef.
31typedef float __attribute__((vector_size(16), aligned(4))) packedfloat4;
32
33void test2(packedfloat4 *p) {
34  *p = (packedfloat4) { 3.2f, 2.3f, 0.1f, 0.0f };
35}
36// CHECK: @test2(
37// CHECK: store <4 x float> {{.*}}, align 4
38// CHECK: ret void
39
40
41// PR5279 - Reduced alignment on typedef.
42typedef float __attribute__((ext_vector_type(3), aligned(4))) packedfloat3;
43void test3(packedfloat3 *p) {
44  *p = (packedfloat3) { 3.2f, 2.3f, 0.1f };
45}
46// CHECK: @test3(
47// CHECK: %{{.*}} = bitcast <3 x float>* %{{.*}} to <4 x float>*
48// CHECK: store <4 x float> {{.*}}, align 4
49// CHECK: ret void
50
51
52
53typedef float __attribute__((vector_size(16), aligned(64))) float4align64;
54
55// rdar://10639962 - Typedef alignment lost in p[]-style dereferencing
56void test4(float4align64 *p) {
57  p[0] = (float4align64){ 3.2f, 2.3f, 0.1f, 0.0f };
58}
59// CHECK: @test4(
60// CHECK: store <4 x float> {{.*}}, <4 x float>* {{.*}}, align 64
61
62