1 // RUN: %clang_cc1 -no-opaque-pointers -triple i386-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,NONCOFF 2 // RUN: %clang_cc1 -no-opaque-pointers -triple i386-unknown-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,COFF 3 4 __attribute((aligned(16))) float a[128]; 5 union {int a[4]; __attribute((aligned(16))) float b[4];} b; 6 7 // CHECK: @a = {{.*}}zeroinitializer, align 16 8 // CHECK: @b = {{.*}}zeroinitializer, align 16 9 10 long long int test5[1024]; 11 // CHECK-DAG: @test5 = {{.*}}global [1024 x i64] zeroinitializer, align 8 12 13 // PR5279 - Reduced alignment on typedef. 14 typedef int myint __attribute__((aligned(1))); 15 16 void test1(myint *p) { 17 *p = 0; 18 } 19 // CHECK: @test1( 20 // CHECK: store i32 0, i32* {{.*}}, align 1 21 // CHECK: ret void 22 23 int test1a(myint *p) { 24 return *p; 25 } 26 // CHECK: @test1a( 27 // CHECK: load i32, i32* {{.*}}, align 1 28 // CHECK: ret i32 29 30 31 // PR5279 - Reduced alignment on typedef. 32 typedef float __attribute__((vector_size(16), aligned(4))) packedfloat4; 33 34 void test2(packedfloat4 *p) { 35 *p = (packedfloat4) { 3.2f, 2.3f, 0.1f, 0.0f }; 36 } 37 // CHECK: @test2( 38 // CHECK: store <4 x float> {{.*}}, align 4 39 // CHECK: ret void 40 41 42 // PR5279 - Reduced alignment on typedef. 43 typedef float __attribute__((ext_vector_type(3), aligned(4))) packedfloat3; 44 void test3(packedfloat3 *p) { 45 *p = (packedfloat3) { 3.2f, 2.3f, 0.1f }; 46 } 47 // CHECK: @test3( 48 // CHECK: %{{.*}} = bitcast <3 x float>* %{{.*}} to <4 x float>* 49 // CHECK: store <4 x float> {{.*}}, align 4 50 // CHECK: ret void 51 52 53 54 typedef float __attribute__((vector_size(16), aligned(64))) float4align64; 55 56 // rdar://10639962 - Typedef alignment lost in p[]-style dereferencing 57 void test4(float4align64 *p) { 58 p[0] = (float4align64){ 3.2f, 2.3f, 0.1f, 0.0f }; 59 } 60 // CHECK: @test4( 61 // CHECK: store <4 x float> {{.*}}, <4 x float>* {{.*}}, align 64 62 63 // PR24944 - Typedef alignment not honored on no-op cast. 64 typedef float __attribute__((vector_size(16), aligned(16))) float4align16; 65 typedef float __attribute__((vector_size(16), aligned(2))) float4align2; 66 void test6(float4align64 *p) { 67 float4align64 vec = *(float4align2*) p; 68 } 69 // CHECK-LABEL: @test6 70 // CHECK: load <4 x float>, <4 x float>* {{.*}}, align 2 71 72 typedef int __attribute__((ext_vector_type(200 * 16))) BigVecTy; 73 void test7(void) { 74 BigVecTy V; 75 } 76 // CHECK-LABEL: @test7 77 // NONCOFF: alloca <3200 x i32>, align 16384 78 // COFF: alloca <3200 x i32>, align 8192 79