1
1
// RUN: %clang_cc1 -triple armv7-apple-darwin -target-abi aapcs -emit-llvm -o - %s | FileCheck %s
2
2
// RUN: %clang_cc1 -triple armv7-apple-darwin -target-abi apcs-gnu -emit-llvm -o - %s | FileCheck -check-prefix=APCS-GNU %s
3
+ // RUN: %clang_cc1 -triple arm-linux-androideabi -emit-llvm -o - %s | FileCheck -check-prefix=ANDROID %s
3
4
4
5
#include <stdarg.h>
5
6
@@ -28,6 +29,14 @@ double varargs_vec_2i(int fixed, ...) {
28
29
// APCS-GNU: [[AP_CAST:%.*]] = bitcast i8* [[AP]] to <2 x i32>*
29
30
// APCS-GNU: [[VEC:%.*]] = load <2 x i32>, <2 x i32>* [[AP_CAST]], align 4
30
31
// APCS-GNU: store <2 x i32> [[VEC]], <2 x i32>* [[VAR]], align 8
32
+ // ANDROID: varargs_vec_2i
33
+ // ANDROID: [[VAR:%.*]] = alloca <2 x i32>, align 8
34
+ // ANDROID: [[ALIGN:%.*]] = and i32 {{%.*}}, -8
35
+ // ANDROID: [[AP_ALIGN:%.*]] = inttoptr i32 [[ALIGN]] to i8*
36
+ // ANDROID: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP_ALIGN]], i32 8
37
+ // ANDROID: [[AP_CAST:%.*]] = bitcast i8* [[AP_ALIGN]] to <2 x i32>*
38
+ // ANDROID: [[VEC:%.*]] = load <2 x i32>, <2 x i32>* [[AP_CAST]], align 8
39
+ // ANDROID: store <2 x i32> [[VEC]], <2 x i32>* [[VAR]], align 8
31
40
va_list ap ;
32
41
double sum = fixed ;
33
42
va_start (ap , fixed );
@@ -42,6 +51,8 @@ double test_2i(__int2 *in) {
42
51
// CHECK: call arm_aapcscc double (i32, ...) @varargs_vec_2i(i32 3, <2 x i32> {{%.*}})
43
52
// APCS-GNU: test_2i
44
53
// APCS-GNU: call double (i32, ...) @varargs_vec_2i(i32 3, <2 x i32> {{%.*}})
54
+ // ANDROID: test_2i
55
+ // ANDROID: call double (i32, ...) @varargs_vec_2i(i32 3, <2 x i32> {{%.*}})
45
56
return varargs_vec_2i (3 , * in );
46
57
}
47
58
@@ -54,6 +65,10 @@ double varargs_vec_3c(int fixed, ...) {
54
65
// APCS-GNU: alloca <3 x i8>, align 4
55
66
// APCS-GNU: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP:%.*]], i32 4
56
67
// APCS-GNU: bitcast i8* [[AP]] to <3 x i8>*
68
+ // ANDROID: varargs_vec_3c
69
+ // ANDROID: alloca <3 x i8>, align 4
70
+ // ANDROID: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP:%.*]], i32 4
71
+ // ANDROID: bitcast i8* [[AP]] to <3 x i8>*
57
72
va_list ap ;
58
73
double sum = fixed ;
59
74
va_start (ap , fixed );
@@ -68,6 +83,8 @@ double test_3c(__char3 *in) {
68
83
// CHECK: call arm_aapcscc double (i32, ...) @varargs_vec_3c(i32 3, i32 {{%.*}})
69
84
// APCS-GNU: test_3c
70
85
// APCS-GNU: call double (i32, ...) @varargs_vec_3c(i32 3, i32 {{%.*}})
86
+ // ANDROID: test_3c
87
+ // ANDROID: call double (i32, ...) @varargs_vec_3c(i32 3, <3 x i8> {{%.*}})
71
88
return varargs_vec_3c (3 , * in );
72
89
}
73
90
@@ -87,6 +104,14 @@ double varargs_vec_5c(int fixed, ...) {
87
104
// APCS-GNU: [[AP_CAST:%.*]] = bitcast i8* [[AP]] to <5 x i8>*
88
105
// APCS-GNU: [[VEC:%.*]] = load <5 x i8>, <5 x i8>* [[AP_CAST]], align 4
89
106
// APCS-GNU: store <5 x i8> [[VEC]], <5 x i8>* [[VAR]], align 8
107
+ // ANDROID: varargs_vec_5c
108
+ // ANDROID: [[VAR:%.*]] = alloca <5 x i8>, align 8
109
+ // ANDROID: [[ALIGN:%.*]] = and i32 {{%.*}}, -8
110
+ // ANDROID: [[AP_ALIGN:%.*]] = inttoptr i32 [[ALIGN]] to i8*
111
+ // ANDROID: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP_ALIGN]], i32 8
112
+ // ANDROID: [[AP_CAST:%.*]] = bitcast i8* [[AP_ALIGN]] to <5 x i8>*
113
+ // ANDROID: [[VEC:%.*]] = load <5 x i8>, <5 x i8>* [[AP_CAST]], align 8
114
+ // ANDROID: store <5 x i8> [[VEC]], <5 x i8>* [[VAR]], align 8
90
115
va_list ap ;
91
116
double sum = fixed ;
92
117
va_start (ap , fixed );
@@ -101,6 +126,8 @@ double test_5c(__char5 *in) {
101
126
// CHECK: call arm_aapcscc double (i32, ...) @varargs_vec_5c(i32 5, <2 x i32> {{%.*}})
102
127
// APCS-GNU: test_5c
103
128
// APCS-GNU: call double (i32, ...) @varargs_vec_5c(i32 5, <2 x i32> {{%.*}})
129
+ // ANDROID: test_5c
130
+ // ANDROID: call double (i32, ...) @varargs_vec_5c(i32 5, <2 x i32> {{%.*}})
104
131
return varargs_vec_5c (5 , * in );
105
132
}
106
133
@@ -120,6 +147,14 @@ double varargs_vec_9c(int fixed, ...) {
120
147
// APCS-GNU: [[AP_CAST:%.*]] = bitcast i8* [[AP]] to <9 x i8>*
121
148
// APCS-GNU: [[VEC:%.*]] = load <9 x i8>, <9 x i8>* [[AP_CAST]], align 4
122
149
// APCS-GNU: store <9 x i8> [[VEC]], <9 x i8>* [[VAR]], align 16
150
+ // ANDROID: varargs_vec_9c
151
+ // ANDROID: [[VAR:%.*]] = alloca <9 x i8>, align 16
152
+ // ANDROID: [[ALIGN:%.*]] = and i32 {{%.*}}, -8
153
+ // ANDROID: [[AP_ALIGN:%.*]] = inttoptr i32 [[ALIGN]] to i8*
154
+ // ANDROID: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP_ALIGN]], i32 16
155
+ // ANDROID: [[AP_CAST:%.*]] = bitcast i8* [[AP_ALIGN]] to <9 x i8>*
156
+ // ANDROID: [[T0:%.*]] = load <9 x i8>, <9 x i8>* [[AP_CAST]], align 8
157
+ // ANDROID: store <9 x i8> [[T0]], <9 x i8>* [[VAR]], align 16
123
158
va_list ap ;
124
159
double sum = fixed ;
125
160
va_start (ap , fixed );
@@ -134,6 +169,8 @@ double test_9c(__char9 *in) {
134
169
// CHECK: call arm_aapcscc double (i32, ...) @varargs_vec_9c(i32 9, <4 x i32> {{%.*}})
135
170
// APCS-GNU: test_9c
136
171
// APCS-GNU: call double (i32, ...) @varargs_vec_9c(i32 9, <4 x i32> {{%.*}})
172
+ // ANDROID: test_9c
173
+ // ANDROID: call double (i32, ...) @varargs_vec_9c(i32 9, <4 x i32> {{%.*}})
137
174
return varargs_vec_9c (9 , * in );
138
175
}
139
176
@@ -146,6 +183,10 @@ double varargs_vec_19c(int fixed, ...) {
146
183
// APCS-GNU: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP:%.*]], i32 4
147
184
// APCS-GNU: [[VAR:%.*]] = bitcast i8* [[AP]] to <19 x i8>**
148
185
// APCS-GNU: [[VAR2:%.*]] = load <19 x i8>*, <19 x i8>** [[VAR]]
186
+ // ANDROID: varargs_vec_19c
187
+ // ANDROID: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP:%.*]], i32 4
188
+ // ANDROID: [[VAR:%.*]] = bitcast i8* [[AP]] to <19 x i8>**
189
+ // ANDROID: [[VAR2:%.*]] = load <19 x i8>*, <19 x i8>** [[VAR]]
149
190
va_list ap ;
150
191
double sum = fixed ;
151
192
va_start (ap , fixed );
@@ -160,6 +201,8 @@ double test_19c(__char19 *in) {
160
201
// CHECK: call arm_aapcscc double (i32, ...) @varargs_vec_19c(i32 19, <19 x i8>* {{%.*}})
161
202
// APCS-GNU: test_19c
162
203
// APCS-GNU: call double (i32, ...) @varargs_vec_19c(i32 19, <19 x i8>* {{%.*}})
204
+ // ANDROID: test_19c
205
+ // ANDROID: call double (i32, ...) @varargs_vec_19c(i32 19, <19 x i8>* {{%.*}})
163
206
return varargs_vec_19c (19 , * in );
164
207
}
165
208
@@ -176,6 +219,12 @@ double varargs_vec_3s(int fixed, ...) {
176
219
// APCS-GNU: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP]], i32 8
177
220
// APCS-GNU: [[AP_CAST:%.*]] = bitcast i8* [[AP]] to <3 x i16>*
178
221
// APCS-GNU: [[VEC:%.*]] = load <3 x i16>, <3 x i16>* [[AP_CAST]], align 4
222
+ // ANDROID: varargs_vec_3s
223
+ // ANDROID: alloca <3 x i16>, align 8
224
+ // ANDROID: [[ALIGN:%.*]] = and i32 {{%.*}}, -8
225
+ // ANDROID: [[AP_ALIGN:%.*]] = inttoptr i32 [[ALIGN]] to i8*
226
+ // ANDROID: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP_ALIGN]], i32 8
227
+ // ANDROID: bitcast i8* [[AP_ALIGN]] to <3 x i16>*
179
228
va_list ap ;
180
229
double sum = fixed ;
181
230
va_start (ap , fixed );
@@ -190,6 +239,8 @@ double test_3s(__short3 *in) {
190
239
// CHECK: call arm_aapcscc double (i32, ...) @varargs_vec_3s(i32 3, <2 x i32> {{%.*}})
191
240
// APCS-GNU: test_3s
192
241
// APCS-GNU: call double (i32, ...) @varargs_vec_3s(i32 3, <2 x i32> {{%.*}})
242
+ // ANDROID: test_3s
243
+ // ANDROID: call double (i32, ...) @varargs_vec_3s(i32 3, <3 x i16> {{%.*}})
193
244
return varargs_vec_3s (3 , * in );
194
245
}
195
246
@@ -208,6 +259,14 @@ double varargs_vec_5s(int fixed, ...) {
208
259
// APCS-GNU: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP]], i32 16
209
260
// APCS-GNU: [[AP_CAST:%.*]] = bitcast i8* [[AP]] to <5 x i16>*
210
261
// APCS-GNU: [[VEC:%.*]] = load <5 x i16>, <5 x i16>* [[AP_CAST]], align 4
262
+ // ANDROID: varargs_vec_5s
263
+ // ANDROID: [[VAR_ALIGN:%.*]] = alloca <5 x i16>, align 16
264
+ // ANDROID: [[ALIGN:%.*]] = and i32 {{%.*}}, -8
265
+ // ANDROID: [[AP_ALIGN:%.*]] = inttoptr i32 [[ALIGN]] to i8*
266
+ // ANDROID: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP_ALIGN]], i32 16
267
+ // ANDROID: [[AP_CAST:%.*]] = bitcast i8* [[AP_ALIGN]] to <5 x i16>*
268
+ // ANDROID: [[VEC:%.*]] = load <5 x i16>, <5 x i16>* [[AP_CAST]], align 8
269
+ // ANDROID: store <5 x i16> [[VEC]], <5 x i16>* [[VAR_ALIGN]], align 16
211
270
va_list ap ;
212
271
double sum = fixed ;
213
272
va_start (ap , fixed );
@@ -222,6 +281,8 @@ double test_5s(__short5 *in) {
222
281
// CHECK: call arm_aapcscc double (i32, ...) @varargs_vec_5s(i32 5, <4 x i32> {{%.*}})
223
282
// APCS-GNU: test_5s
224
283
// APCS-GNU: call double (i32, ...) @varargs_vec_5s(i32 5, <4 x i32> {{%.*}})
284
+ // ANDROID: test_5s
285
+ // ANDROID: call double (i32, ...) @varargs_vec_5s(i32 5, <4 x i32> {{%.*}})
225
286
return varargs_vec_5s (5 , * in );
226
287
}
227
288
@@ -243,6 +304,11 @@ double varargs_struct(int fixed, ...) {
243
304
// APCS-GNU: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* {{%.*}}, i32 16
244
305
// APCS-GNU: bitcast %struct.StructWithVec* [[VAR_ALIGN]] to i8*
245
306
// APCS-GNU: call void @llvm.memcpy
307
+ // ANDROID: varargs_struct
308
+ // ANDROID: [[ALIGN:%.*]] = and i32 {{%.*}}, -8
309
+ // ANDROID: [[AP_ALIGN:%.*]] = inttoptr i32 [[ALIGN]] to i8*
310
+ // ANDROID: [[AP_NEXT:%.*]] = getelementptr inbounds i8, i8* [[AP_ALIGN]], i32 16
311
+ // ANDROID: bitcast i8* [[AP_ALIGN]] to %struct.StructWithVec*
246
312
va_list ap ;
247
313
double sum = fixed ;
248
314
va_start (ap , fixed );
@@ -257,5 +323,7 @@ double test_struct(StructWithVec* d) {
257
323
// CHECK: call arm_aapcscc double (i32, ...) @varargs_struct(i32 3, [2 x i64] {{%.*}})
258
324
// APCS-GNU: test_struct
259
325
// APCS-GNU: call double (i32, ...) @varargs_struct(i32 3, [2 x i64] {{%.*}})
326
+ // ANDROID: test_struct
327
+ // ANDROID: call double (i32, ...) @varargs_struct(i32 3, [2 x i64] {{%.*}})
260
328
return varargs_struct (3 , * d );
261
329
}
0 commit comments