• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -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  long long int test5[1024];
10  // CHECK-DAG: @test5 = common global [1024 x i64] zeroinitializer, align 8
11  
12  // PR5279 - Reduced alignment on typedef.
13  typedef int myint __attribute__((aligned(1)));
14  
test1(myint * p)15  void test1(myint *p) {
16    *p = 0;
17  }
18  // CHECK: @test1(
19  // CHECK: store i32 0, i32* {{.*}}, align 1
20  // CHECK: ret void
21  
test1a(myint * p)22  int test1a(myint *p) {
23    return *p;
24  }
25  // CHECK: @test1a(
26  // CHECK: load i32, i32* {{.*}}, align 1
27  // CHECK: ret i32
28  
29  
30  // PR5279 - Reduced alignment on typedef.
31  typedef float __attribute__((vector_size(16), aligned(4))) packedfloat4;
32  
test2(packedfloat4 * p)33  void 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.
42  typedef float __attribute__((ext_vector_type(3), aligned(4))) packedfloat3;
test3(packedfloat3 * p)43  void 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  
53  typedef float __attribute__((vector_size(16), aligned(64))) float4align64;
54  
55  // rdar://10639962 - Typedef alignment lost in p[]-style dereferencing
test4(float4align64 * p)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> {{.*}}, <4 x float>* {{.*}}, 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;
test6(float4align64 * p)65  void test6(float4align64 *p) {
66      float4align64 vec = *(float4align2*) p;
67  }
68  // CHECK-LABEL: @test6
69  // CHECK:       load <4 x float>, <4 x float>* {{.*}}, align 2
70