[LV] Add test showing debug output for loops with uncountable BTCs.
[llvm-project.git] / clang / test / CodeGen / aapcs64-align.cpp
blob7a8151022852ea873beee1c3dbe4853e4e2304f9
1 // REQUIRES: arm-registered-target
2 // RUN: %clang_cc1 -triple aarch64-none-elf \
3 // RUN: -O2 \
4 // RUN: -emit-llvm -fexperimental-max-bitint-width=1024 -o - %s | FileCheck %s
6 extern "C" {
8 // Base case, nothing interesting.
9 struct S {
10 long x, y;
13 void f0(long, S);
14 void f0m(long, long, long, long, long, S);
15 void g0() {
16 S s = {6, 7};
17 f0(1, s);
18 f0m(1, 2, 3, 4, 5, s);
20 // CHECK: define{{.*}} void @g0
21 // CHECK: call void @f0(i64 noundef 1, [2 x i64] [i64 6, i64 7]
22 // CHECK: call void @f0m{{.*}}[2 x i64] [i64 6, i64 7]
23 // CHECK: declare void @f0(i64 noundef, [2 x i64])
24 // CHECK: declare void @f0m(i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, [2 x i64])
26 // Aligned struct, passed according to its natural alignment.
27 struct __attribute__((aligned(16))) S16 {
28 long x, y;
29 } s16;
31 void f1(long, S16);
32 void f1m(long, long, long, long, long, S16);
33 void g1() {
34 S16 s = {6, 7};
35 f1(1, s);
36 f1m(1, 2, 3, 4, 5, s);
38 // CHECK: define{{.*}} void @g1
39 // CHECK: call void @f1{{.*}}[2 x i64] [i64 6, i64 7]
40 // CHECK: call void @f1m{{.*}}[2 x i64] [i64 6, i64 7]
41 // CHECK: declare void @f1(i64 noundef, [2 x i64])
42 // CHECK: declare void @f1m(i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, [2 x i64])
44 // Increased natural alignment.
45 struct SF16 {
46 long x __attribute__((aligned(16)));
47 long y;
50 void f3(long, SF16);
51 void f3m(long, long, long, long, long, SF16);
52 void g3() {
53 SF16 s = {6, 7};
54 f3(1, s);
55 f3m(1, 2, 3, 4, 5, s);
57 // CHECK: define{{.*}} void @g3
58 // CHECK: call void @f3(i64 noundef 1, i128 129127208515966861318)
59 // CHECK: call void @f3m(i64 noundef 1, i64 noundef 2, i64 noundef 3, i64 noundef 4, i64 noundef 5, i128 129127208515966861318)
60 // CHECK: declare void @f3(i64 noundef, i128)
61 // CHECK: declare void @f3m(i64 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef, i128)
64 // Packed structure.
65 struct __attribute__((packed)) P {
66 int x;
67 long u;
70 void f4(int, P);
71 void f4m(int, int, int, int, int, P);
72 void g4() {
73 P s = {6, 7};
74 f4(1, s);
75 f4m(1, 2, 3, 4, 5, s);
77 // CHECK: define{{.*}} void @g4()
78 // CHECK: call void @f4(i32 noundef 1, [2 x i64] [i64 30064771078, i64 0])
79 // CHECK: void @f4m(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, [2 x i64] [i64 30064771078, i64 0])
80 // CHECK: declare void @f4(i32 noundef, [2 x i64])
81 // CHECK: declare void @f4m(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, [2 x i64])
84 // Packed structure, overaligned, same as above.
85 struct __attribute__((packed, aligned(16))) P16 {
86 int x;
87 long y;
90 void f5(int, P16);
91 void f5m(int, int, int, int, int, P16);
92 void g5() {
93 P16 s = {6, 7};
94 f5(1, s);
95 f5m(1, 2, 3, 4, 5, s);
97 // CHECK: define{{.*}} void @g5()
98 // CHECK: call void @f5(i32 noundef 1, [2 x i64] [i64 30064771078, i64 0])
99 // CHECK: void @f5m(i32 noundef 1, i32 noundef 2, i32 noundef 3, i32 noundef 4, i32 noundef 5, [2 x i64] [i64 30064771078, i64 0])
100 // CHECK: declare void @f5(i32 noundef, [2 x i64])
101 // CHECK: declare void @f5m(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, [2 x i64])
103 //BitInt alignment
104 struct BITINT129 {
105 char ch;
106 unsigned _BitInt(129) v;
109 int test_bitint129(){
110 return __builtin_offsetof(struct BITINT129, v);
112 // CHECK: ret i32 16
114 struct BITINT127 {
115 char ch;
116 _BitInt(127) v;
119 int test_bitint127(){
120 return __builtin_offsetof(struct BITINT127, v);
122 // CHECK: ret i32 16
124 struct BITINT63 {
125 char ch;
126 _BitInt(63) v;
129 int test_bitint63(){
130 return __builtin_offsetof(struct BITINT63, v);
132 // CHECK: ret i32 8
134 struct BITINT32 {
135 char ch;
136 unsigned _BitInt(32) v;
139 int test_bitint32(){
140 return __builtin_offsetof(struct BITINT32, v);
142 // CHECK: ret i32 4
144 struct BITINT9 {
145 char ch;
146 unsigned _BitInt(9) v;
149 int test_bitint9(){
150 return __builtin_offsetof(struct BITINT9, v);
152 // CHECK: ret i32 2
154 struct BITINT8 {
155 char ch;
156 unsigned _BitInt(8) v;
159 int test_bitint8(){
160 return __builtin_offsetof(struct BITINT8, v);
162 // CHECK: ret i32 1