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