| 1 |
// RUN: %clang_cc1 -triple i386-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,NONCOFF |
| 2 |
// RUN: %clang_cc1 -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, ptr {{.*}}, align 1 |
| 21 |
// CHECK: ret void |
| 22 |
|
| 23 |
int test1a(myint *p) { |
| 24 |
return *p; |
| 25 |
} |
| 26 |
// CHECK: @test1a( |
| 27 |
// CHECK: load i32, ptr {{.*}}, 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: store <4 x float> {{.*}}, align 4 |
| 49 |
// CHECK: ret void |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
typedef float __attribute__((vector_size(16), aligned(64))) float4align64; |
| 54 |
|
| 55 |
// Typedef alignment lost in p[]-style dereferencing |
| 56 |
void 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> {{.*}}, ptr {{.*}}, align 64 |
| 61 |
|
| 62 |
// PR24944 - Typedef alignment not honored on no-op cast. |
| 63 |
typedef float __attribute__((vector_size(16), aligned(16))) float4align16; |
| 64 |
typedef float __attribute__((vector_size(16), aligned(2))) float4align2; |
| 65 |
void test6(float4align64 *p) { |
| 66 |
float4align64 vec = *(float4align2*) p; |
| 67 |
} |
| 68 |
// CHECK-LABEL: @test6 |
| 69 |
// CHECK: load <4 x float>, ptr {{.*}}, align 2 |
| 70 |
|
| 71 |
typedef int __attribute__((ext_vector_type(200 * 16))) BigVecTy; |
| 72 |
void test7(void) { |
| 73 |
BigVecTy V; |
| 74 |
} |
| 75 |
// CHECK-LABEL: @test7 |
| 76 |
// NONCOFF: alloca <3200 x i32>, align 16384 |
| 77 |
// COFF: alloca <3200 x i32>, align 8192 |