forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc_layout.sil
321 lines (288 loc) · 20.3 KB
/
c_layout.sil
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
// RUN: %target-swift-frontend -assume-parsing-unqualified-ownership-sil -I %S/Inputs/abi %s -emit-ir | %FileCheck %s --check-prefix=CHECK-%target-cpu
sil_stage canonical
import c_layout
import Builtin
import Swift
// TODO: Provide tests for other architectures
// CHECK-x86_64: %TSC11BitfieldOneV = type <{ %Ts6UInt32V, %TSC6NestedV, [4 x i8], [4 x i8], %TSf, [1 x i8], [7 x i8], %Ts6UInt64V, %Ts6UInt32V, [4 x i8] }>
// CHECK-x86_64: %TSC6NestedV = type <{ %TSf, [3 x i8], [1 x i8] }>
// CHECK-x86_64: %TSC26BitfieldSeparatorReferenceV = type [[BITFIELD_SEP_TYPE:<{ %Ts5UInt8V, \[3 x i8\], %Ts5UInt8V }>]]
// CHECK-x86_64: %TSC25BitfieldSeparatorSameNameV = type [[BITFIELD_SEP_TYPE]]
// CHECK-x86_64: %TSC36BitfieldSeparatorDifferentNameStructV = type [[BITFIELD_SEP_TYPE]]
// CHECK-x86_64: %TSC21BitfieldSeparatorAnonV = type [[BITFIELD_SEP_TYPE]]
sil public_external @createBitfieldOne : $@convention(c) () -> BitfieldOne
sil public_external @consumeBitfieldOne : $@convention(c) (BitfieldOne) -> ()
sil @test0 : $() -> () {
bb0:
%0 = function_ref @createBitfieldOne : $@convention(c) () -> BitfieldOne
%1 = apply %0() : $@convention(c) () -> BitfieldOne
%2 = function_ref @consumeBitfieldOne : $@convention(c) (BitfieldOne) -> ()
apply %2(%1) : $@convention(c) (BitfieldOne) -> ()
%r = tuple ()
return %r : $()
}
// CHECK-x86_64: define{{( protected)?}} swiftcc void @test0()
// CHECK-x86_64: [[RESULT:%.*]] = alloca %TSC11BitfieldOneV, align 8
// CHECK-x86_64: [[ARG:%.*]] = alloca %TSC11BitfieldOneV, align 8
// Make the first call and pull all the values out of the indirect result.
// CHECK-x86_64: call void @createBitfieldOne(%TSC11BitfieldOneV* noalias nocapture sret [[RESULT]])
// CHECK-x86_64: [[ADDR_A:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[RESULT]], i32 0, i32 0
// CHECK-x86_64: [[ADDR_A_V:%.*]] = getelementptr inbounds %Ts6UInt32V, %Ts6UInt32V* [[ADDR_A]], i32 0, i32 0
// CHECK-x86_64: [[A:%.*]] = load i32, i32* [[ADDR_A_V]], align 8
// CHECK-x86_64: [[ADDR_B:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[RESULT]], i32 0, i32 1
// CHECK-x86_64: [[ADDR_B_X:%.*]] = getelementptr inbounds %TSC6NestedV, %TSC6NestedV* [[ADDR_B]], i32 0, i32 0
// CHECK-x86_64: [[ADDR_B_X_V:%.*]] = getelementptr inbounds %TSf, %TSf* [[ADDR_B_X]], i32 0, i32 0
// CHECK-x86_64: [[B_X:%.*]] = load float, float* [[ADDR_B_X_V]], align 4
// CHECK-x86_64: [[ADDR_B_YZ:%.*]] = getelementptr inbounds %TSC6NestedV, %TSC6NestedV* [[ADDR_B]], i32 0, i32 1
// CHECK-x86_64: [[ADDR_B_YZ_1:%.*]] = bitcast [3 x i8]* [[ADDR_B_YZ]] to i24*
// CHECK-x86_64: [[B_YZ:%.*]] = load i24, i24* [[ADDR_B_YZ_1]], align 4
// CHECK-x86_64: [[ADDR_CDE:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[RESULT]], i32 0, i32 2
// CHECK-x86_64: [[ADDR_CDE_1:%.*]] = bitcast [4 x i8]* [[ADDR_CDE]] to i32*
// CHECK-x86_64: [[CDE:%.*]] = load i32, i32* [[ADDR_CDE_1]], align 4
// CHECK-x86_64: [[ADDR_FGH:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[RESULT]], i32 0, i32 3
// CHECK-x86_64: [[ADDR_FGH_1:%.*]] = bitcast [4 x i8]* [[ADDR_FGH]] to i32*
// CHECK-x86_64: [[FGH:%.*]] = load i32, i32* [[ADDR_FGH_1]], align 8
// CHECK-x86_64: [[ADDR_I:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[RESULT]], i32 0, i32 4
// CHECK-x86_64: [[ADDR_I_V:%.*]] = getelementptr inbounds %TSf, %TSf* [[ADDR_I]], i32 0, i32 0
// CHECK-x86_64: [[I:%.*]] = load float, float* [[ADDR_I_V]], align 4
// CHECK-x86_64: [[ADDR_JK:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[RESULT]], i32 0, i32 5
// CHECK-x86_64: [[ADDR_JK_1:%.*]] = bitcast [1 x i8]* [[ADDR_JK]] to i8*
// CHECK-x86_64: [[JK:%.*]] = load i8, i8* [[ADDR_JK_1]], align 8
// CHECK-x86_64: [[ADDR_L:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[RESULT]], i32 0, i32 7
// CHECK-x86_64: [[ADDR_L_V:%.*]] = getelementptr inbounds %Ts6UInt64V, %Ts6UInt64V* [[ADDR_L]], i32 0, i32 0
// CHECK-x86_64: [[L:%.*]] = load i64, i64* [[ADDR_L_V]], align 8
// CHECK-x86_64: [[ADDR_M:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[RESULT]], i32 0, i32 8
// CHECK-x86_64: [[ADDR_M_V:%.*]] = getelementptr inbounds %Ts6UInt32V, %Ts6UInt32V* [[ADDR_M]], i32 0, i32 0
// CHECK-x86_64: [[M:%.*]] = load i32, i32* [[ADDR_M_V]], align 8
// Put all of the values into the indirect argument and make the second call.
// CHECK-x86_64: [[ADDR_A:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[ARG]], i32 0, i32 0
// CHECK-x86_64: [[ADDR_A_V:%.*]] = getelementptr inbounds %Ts6UInt32V, %Ts6UInt32V* [[ADDR_A]], i32 0, i32 0
// CHECK-x86_64: store i32 [[A]], i32* [[ADDR_A_V]], align 8
// CHECK-x86_64: [[ADDR_B:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[ARG]], i32 0, i32 1
// CHECK-x86_64: [[ADDR_B_X:%.*]] = getelementptr inbounds %TSC6NestedV, %TSC6NestedV* [[ADDR_B]], i32 0, i32 0
// CHECK-x86_64: [[ADDR_B_X_V:%.*]] = getelementptr inbounds %TSf, %TSf* [[ADDR_B_X]], i32 0, i32 0
// CHECK-x86_64: store float [[B_X]], float* [[ADDR_B_X_V]], align 4
// CHECK-x86_64: [[ADDR_B_YZ:%.*]] = getelementptr inbounds %TSC6NestedV, %TSC6NestedV* [[ADDR_B]], i32 0, i32 1
// CHECK-x86_64: [[ADDR_B_YZ_1:%.*]] = bitcast [3 x i8]* [[ADDR_B_YZ]] to i24*
// CHECK-x86_64: store i24 [[B_YZ]], i24* [[ADDR_B_YZ_1]], align 4
// CHECK-x86_64: [[ADDR_CDE:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[ARG]], i32 0, i32 2
// CHECK-x86_64: [[ADDR_CDE_1:%.*]] = bitcast [4 x i8]* [[ADDR_CDE]] to i32*
// CHECK-x86_64: store i32 [[CDE]], i32* [[ADDR_CDE_1]], align 4
// CHECK-x86_64: [[ADDR_FGH:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[ARG]], i32 0, i32 3
// CHECK-x86_64: [[ADDR_FGH_1:%.*]] = bitcast [4 x i8]* [[ADDR_FGH]] to i32*
// CHECK-x86_64: store i32 [[FGH]], i32* [[ADDR_FGH_1]], align 8
// CHECK-x86_64: [[ADDR_I:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[ARG]], i32 0, i32 4
// CHECK-x86_64: [[ADDR_I_V:%.*]] = getelementptr inbounds %TSf, %TSf* [[ADDR_I]], i32 0, i32 0
// CHECK-x86_64: store float [[I]], float* [[ADDR_I_V]], align 4
// CHECK-x86_64: [[ADDR_JK:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[ARG]], i32 0, i32 5
// CHECK-x86_64: [[ADDR_JK_1:%.*]] = bitcast [1 x i8]* [[ADDR_JK]] to i8*
// CHECK-x86_64: store i8 [[JK]], i8* [[ADDR_JK_1]], align 8
// CHECK-x86_64: [[ADDR_L:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[ARG]], i32 0, i32 7
// CHECK-x86_64: [[ADDR_L_V:%.*]] = getelementptr inbounds %Ts6UInt64V, %Ts6UInt64V* [[ADDR_L]], i32 0, i32 0
// CHECK-x86_64: store i64 [[L]], i64* [[ADDR_L_V]], align 8
// CHECK-x86_64: [[ADDR_M:%.*]] = getelementptr inbounds %TSC11BitfieldOneV, %TSC11BitfieldOneV* [[ARG]], i32 0, i32 8
// CHECK-x86_64: [[ADDR_M_V:%.*]] = getelementptr inbounds %Ts6UInt32V, %Ts6UInt32V* [[ADDR_M]], i32 0, i32 0
// CHECK-x86_64: store i32 [[M]], i32* [[ADDR_M_V]], align 8
// CHECK-x86_64: call void @consumeBitfieldOne(%TSC11BitfieldOneV* byval align 8 [[ARG]])
// CHECK-x86_64: ret void
sil public_external @testBitfields : $@convention(thin) () -> (BitfieldSeparatorReference, BitfieldSeparatorSameName, BitfieldSeparatorDifferentNameStruct, BitfieldSeparatorAnon)
sil @testTypedefs : $() -> () {
bb0:
%0 = function_ref @testBitfields : $@convention(thin) () -> (BitfieldSeparatorReference, BitfieldSeparatorSameName, BitfieldSeparatorDifferentNameStruct, BitfieldSeparatorAnon)
%1 = apply %0() : $@convention(thin) () -> (BitfieldSeparatorReference, BitfieldSeparatorSameName, BitfieldSeparatorDifferentNameStruct, BitfieldSeparatorAnon)
%r = tuple ()
return %r : $()
}
sil public_external @createSIMDStruct : $@convention(c) () -> SIMDStruct
sil public_external @consumeSIMDStruct : $@convention(c) SIMDStruct -> ()
// CHECK-x86_64-LABEL: define{{( protected)?}} swiftcc void @testSIMDStruct()
// CHECK-x86_64: call <3 x float> @createSIMDStruct
// CHECK-x86_64: call void @consumeSIMDStruct(<3 x float>
sil @testSIMDStruct : $() -> () {
bb0:
%f = function_ref @createSIMDStruct : $@convention(c) () -> SIMDStruct
%x = apply %f() : $@convention(c) () -> SIMDStruct
%g = function_ref @consumeSIMDStruct : $@convention(c) SIMDStruct -> ()
%z = apply %g(%x) : $@convention(c) SIMDStruct -> ()
return undef : $()
}
sil @testRecursive : $@convention(thin) () -> Builtin.Word {
bb0:
%m = metatype $@thin HasRecursivePointers.Type
%s = builtin "sizeof"<HasRecursivePointers>(%m : $@thin HasRecursivePointers.Type) : $Builtin.Word
return %s : $Builtin.Word
}
// CHECK-x86_64-LABEL: define{{( protected)?}} swiftcc void @testIntegerExtension
// CHECK-x86_64: call signext i8 @chareth(i8 signext %0)
// CHECK-x86_64: call signext i8 @signedChareth(i8 signext %1)
// CHECK-x86_64: call zeroext i8 @unsignedChareth(i8 zeroext %2)
// CHECK-x86_64: call signext i16 @eatMyShorts(i16 signext %3)
// CHECK-x86_64: call zeroext i16 @eatMyUnsignedShorts(i16 zeroext %4)
// CHECK-x86_64: call i32 @ints(i32 %5)
// CHECK-x86_64: call i32 @unsigneds(i32 %6)
// CHECK-x86_64-LABEL: declare signext i8 @chareth(i8 signext)
// CHECK-x86_64-LABEL: declare signext i8 @signedChareth(i8 signext)
// CHECK-x86_64-LABEL: declare zeroext i8 @unsignedChareth(i8 zeroext)
// CHECK-x86_64-LABEL: declare signext i16 @eatMyShorts(i16 signext)
// CHECK-x86_64-LABEL: declare zeroext i16 @eatMyUnsignedShorts(i16 zeroext)
// CHECK-x86_64-LABEL: declare i32 @ints(i32)
// CHECK-x86_64-LABEL: declare i32 @unsigneds(i32)
// CHECK-i386-LABEL: define{{( protected)?}} swiftcc void @testIntegerExtension
// CHECK-i386: call signext i8 @chareth(i8 signext %0)
// CHECK-i386: call signext i8 @signedChareth(i8 signext %1)
// CHECK-i386: call zeroext i8 @unsignedChareth(i8 zeroext %2)
// CHECK-i386: call signext i16 @eatMyShorts(i16 signext %3)
// CHECK-i386: call zeroext i16 @eatMyUnsignedShorts(i16 zeroext %4)
// CHECK-i386: call i32 @ints(i32 %5)
// CHECK-i386: call i32 @unsigneds(i32 %6)
// CHECK-i386-LABEL: declare signext i8 @chareth(i8 signext)
// CHECK-i386-LABEL: declare signext i8 @signedChareth(i8 signext)
// CHECK-i386-LABEL: declare zeroext i8 @unsignedChareth(i8 zeroext)
// CHECK-i386-LABEL: declare signext i16 @eatMyShorts(i16 signext)
// CHECK-i386-LABEL: declare zeroext i16 @eatMyUnsignedShorts(i16 zeroext)
// CHECK-i386-LABEL: declare i32 @ints(i32)
// CHECK-i386-LABEL: declare i32 @unsigneds(i32)
// CHECK-armv7-LABEL: define{{( protected)?}} swiftcc void @testIntegerExtension
// CHECK-armv7: call signext i8 @chareth(i8 signext %0)
// CHECK-armv7: call signext i8 @signedChareth(i8 signext %1)
// CHECK-armv7: call zeroext i8 @unsignedChareth(i8 zeroext %2)
// CHECK-armv7: call signext i16 @eatMyShorts(i16 signext %3)
// CHECK-armv7: call zeroext i16 @eatMyUnsignedShorts(i16 zeroext %4)
// CHECK-armv7: call i32 @ints(i32 %5)
// CHECK-armv7: call i32 @unsigneds(i32 %6)
// CHECK-armv7-LABEL: declare signext i8 @chareth(i8 signext)
// CHECK-armv7-LABEL: declare signext i8 @signedChareth(i8 signext)
// CHECK-armv7-LABEL: declare zeroext i8 @unsignedChareth(i8 zeroext)
// CHECK-armv7-LABEL: declare signext i16 @eatMyShorts(i16 signext)
// CHECK-armv7-LABEL: declare zeroext i16 @eatMyUnsignedShorts(i16 zeroext)
// CHECK-armv7-LABEL: declare i32 @ints(i32)
// CHECK-armv7-LABEL: declare i32 @unsigneds(i32)
// CHECK-armv7s-LABEL: define{{( protected)?}} swiftcc void @testIntegerExtension
// CHECK-armv7s: call signext i8 @chareth(i8 signext %0)
// CHECK-armv7s: call signext i8 @signedChareth(i8 signext %1)
// CHECK-armv7s: call zeroext i8 @unsignedChareth(i8 zeroext %2)
// CHECK-armv7s: call signext i16 @eatMyShorts(i16 signext %3)
// CHECK-armv7s: call zeroext i16 @eatMyUnsignedShorts(i16 zeroext %4)
// CHECK-armv7s: call i32 @ints(i32 %5)
// CHECK-armv7s: call i32 @unsigneds(i32 %6)
// CHECK-armv7s-LABEL: declare signext i8 @chareth(i8 signext)
// CHECK-armv7s-LABEL: declare signext i8 @signedChareth(i8 signext)
// CHECK-armv7s-LABEL: declare zeroext i8 @unsignedChareth(i8 zeroext)
// CHECK-armv7s-LABEL: declare signext i16 @eatMyShorts(i16 signext)
// CHECK-armv7s-LABEL: declare zeroext i16 @eatMyUnsignedShorts(i16 zeroext)
// CHECK-armv7s-LABEL: declare i32 @ints(i32)
// CHECK-armv7s-LABEL: declare i32 @unsigneds(i32)
// CHECK-armv7k-LABEL: define{{( protected)?}} swiftcc void @testIntegerExtension
// CHECK-armv7k: call signext i8 @chareth(i8 signext %0)
// CHECK-armv7k: call signext i8 @signedChareth(i8 signext %1)
// CHECK-armv7k: call zeroext i8 @unsignedChareth(i8 zeroext %2)
// CHECK-armv7k: call signext i16 @eatMyShorts(i16 signext %3)
// CHECK-armv7k: call zeroext i16 @eatMyUnsignedShorts(i16 zeroext %4)
// CHECK-armv7k: call i32 @ints(i32 %5)
// CHECK-armv7k: call i32 @unsigneds(i32 %6)
// CHECK-armv7k-LABEL: declare signext i8 @chareth(i8 signext)
// CHECK-armv7k-LABEL: declare signext i8 @signedChareth(i8 signext)
// CHECK-armv7k-LABEL: declare zeroext i8 @unsignedChareth(i8 zeroext)
// CHECK-armv7k-LABEL: declare signext i16 @eatMyShorts(i16 signext)
// CHECK-armv7k-LABEL: declare zeroext i16 @eatMyUnsignedShorts(i16 zeroext)
// CHECK-armv7k-LABEL: declare i32 @ints(i32)
// CHECK-armv7k-LABEL: declare i32 @unsigneds(i32)
// CHECK-arm64-LABEL: define{{( protected)?}} swiftcc void @testIntegerExtension
// CHECK-arm64: call signext i8 @chareth(i8 signext %0)
// CHECK-arm64: call signext i8 @signedChareth(i8 signext %1)
// CHECK-arm64: call zeroext i8 @unsignedChareth(i8 zeroext %2)
// CHECK-arm64: call signext i16 @eatMyShorts(i16 signext %3)
// CHECK-arm64: call zeroext i16 @eatMyUnsignedShorts(i16 zeroext %4)
// CHECK-arm64: call i32 @ints(i32 %5)
// CHECK-arm64: call i32 @unsigneds(i32 %6)
// CHECK-arm64-LABEL: declare signext i8 @chareth(i8 signext)
// CHECK-arm64-LABEL: declare signext i8 @signedChareth(i8 signext)
// CHECK-arm64-LABEL: declare zeroext i8 @unsignedChareth(i8 zeroext)
// CHECK-arm64-LABEL: declare signext i16 @eatMyShorts(i16 signext)
// CHECK-arm64-LABEL: declare zeroext i16 @eatMyUnsignedShorts(i16 zeroext)
// CHECK-arm64-LABEL: declare i32 @ints(i32)
// CHECK-arm64-LABEL: declare i32 @unsigneds(i32)
// CHECK-powerpc64-LABEL: define{{( protected)?}} swiftcc void @testIntegerExtension
// CHECK-powerpc64: call zeroext i8 @chareth(i8 zeroext %0)
// CHECK-powerpc64: call zeroext i8 @signedChareth(i8 zeroext %1)
// CHECK-powerpc64: call zeroext i8 @unsignedChareth(i8 zeroext %2)
// CHECK-powerpc64: call signext i16 @eatMyShorts(i16 signext %3)
// CHECK-powerpc64: call zeroext i16 @eatMyUnsignedShorts(i16 zeroext %4)
// CHECK-powerpc64: call signext i32 @ints(i32 signext %5)
// CHECK-powerpc64: call zeroext i32 @unsigneds(i32 zeroext %6)
// CHECK-powerpc64-LABEL: declare zeroext i8 @chareth(i8 zeroext)
// CHECK-powerpc64-LABEL: declare zeroext i8 @signedChareth(i8 zeroext)
// CHECK-powerpc64-LABEL: declare zeroext i8 @unsignedChareth(i8 zeroext)
// CHECK-powerpc64-LABEL: declare signext i16 @eatMyShorts(i16 signext)
// CHECK-powerpc64-LABEL: declare zeroext i16 @eatMyUnsignedShorts(i16 zeroext)
// CHECK-powerpc64-LABEL: declare signext i32 @ints(i32 signext)
// CHECK-powerpc64-LABEL: declare zeroext i32 @unsigneds(i32 zeroext)
// CHECK-powerpc64le-LABEL: define{{( protected)?}} swiftcc void @testIntegerExtension
// CHECK-powerpc64le: call zeroext i8 @chareth(i8 zeroext %0)
// CHECK-powerpc64le: call zeroext i8 @signedChareth(i8 zeroext %1)
// CHECK-powerpc64le: call zeroext i8 @unsignedChareth(i8 zeroext %2)
// CHECK-powerpc64le: call signext i16 @eatMyShorts(i16 signext %3)
// CHECK-powerpc64le: call zeroext i16 @eatMyUnsignedShorts(i16 zeroext %4)
// CHECK-powerpc64le: call signext i32 @ints(i32 signext %5)
// CHECK-powerpc64le: call zeroext i32 @unsigneds(i32 zeroext %6)
// CHECK-powerpc64le-LABEL: declare zeroext i8 @chareth(i8 zeroext)
// CHECK-powerpc64le-LABEL: declare zeroext i8 @signedChareth(i8 zeroext)
// CHECK-powerpc64le-LABEL: declare zeroext i8 @unsignedChareth(i8 zeroext)
// CHECK-powerpc64le-LABEL: declare signext i16 @eatMyShorts(i16 signext)
// CHECK-powerpc64le-LABEL: declare zeroext i16 @eatMyUnsignedShorts(i16 zeroext)
// CHECK-powerpc64le-LABEL: declare signext i32 @ints(i32 signext)
// CHECK-powerpc64le-LABEL: declare zeroext i32 @unsigneds(i32 zeroext)
// CHECK-s390x-LABEL: define{{( protected)?}} swiftcc void @testIntegerExtension
// CHECK-s390x: call zeroext i8 @chareth(i8 zeroext %0)
// CHECK-s390x: call zeroext i8 @signedChareth(i8 zeroext %1)
// CHECK-s390x: call zeroext i8 @unsignedChareth(i8 zeroext %2)
// CHECK-s390x: call signext i16 @eatMyShorts(i16 signext %3)
// CHECK-s390x: call zeroext i16 @eatMyUnsignedShorts(i16 zeroext %4)
// CHECK-s390x: call signext i32 @ints(i32 signext %5)
// CHECK-s390x: call zeroext i32 @unsigneds(i32 zeroext %6)
// CHECK-s390x-LABEL: declare zeroext i8 @chareth(i8 zeroext)
// CHECK-s390x-LABEL: declare zeroext i8 @signedChareth(i8 zeroext)
// CHECK-s390x-LABEL: declare zeroext i8 @unsignedChareth(i8 zeroext)
// CHECK-s390x-LABEL: declare signext i16 @eatMyShorts(i16 signext)
// CHECK-s390x-LABEL: declare zeroext i16 @eatMyUnsignedShorts(i16 zeroext)
// CHECK-s390x-LABEL: declare signext i32 @ints(i32 signext)
// CHECK-s390x-LABEL: declare zeroext i32 @unsigneds(i32 zeroext)
sil @testIntegerExtension : $@convention(thin) (CChar, CSignedChar, CUnsignedChar, CShort, CUnsignedShort, CInt, CUnsignedInt) -> () {
entry(%a : $CChar, %b : $CSignedChar, %c : $CUnsignedChar, %d : $CShort, %e : $CUnsignedShort, %f : $CInt, %g : $CUnsignedInt):
%h = function_ref @chareth : $@convention(c) (CChar) -> CChar
%i = apply %h(%a) : $@convention(c) (CChar) -> CChar
%j = function_ref @signedChareth : $@convention(c) (CSignedChar) -> CSignedChar
%k = apply %j(%b) : $@convention(c) (CSignedChar) -> CSignedChar
%l = function_ref @unsignedChareth : $@convention(c) (CUnsignedChar) -> CUnsignedChar
%m = apply %l(%c) : $@convention(c) (CUnsignedChar) -> CUnsignedChar
%n = function_ref @eatMyShorts : $@convention(c) (CShort) -> CShort
%o = apply %n(%d) : $@convention(c) (CShort) -> CShort
%p = function_ref @eatMyUnsignedShorts : $@convention(c) (CUnsignedShort) -> CUnsignedShort
%q = apply %p(%e) : $@convention(c) (CUnsignedShort) -> CUnsignedShort
%r = function_ref @ints : $@convention(c) (CInt) -> CInt
%s = apply %r(%f) : $@convention(c) (CInt) -> CInt
%t = function_ref @unsigneds : $@convention(c) (CUnsignedInt) -> CUnsignedInt
%u = apply %t(%g) : $@convention(c) (CUnsignedInt) -> CUnsignedInt
return undef : $()
}
// CHECK-x86_64-LABEL: define{{( protected)?}} swiftcc i8 @testIntegerExtensionInBlock(%objc_block*, i8)
sil @testIntegerExtensionInBlock : $@convention(thin) (@owned @convention(block) (CChar) -> CChar, CChar) -> CChar {
entry(%b : $@convention(block) (CChar) -> CChar, %c : $CChar):
// CHECK-x86_64: call signext i8 {{%.*}}(%objc_block* {{%.*}}, i8 signext {{%.*}})
%r = apply %b(%c) : $@convention(block) (CChar) -> CChar
return %r : $CChar
}
// CHECK-x86_64-LABEL: define{{( protected)?}} swiftcc void @testBitfieldInBlock
// CHECK-x86_64: call void {{%.*}}(%TSC11BitfieldOneV* noalias nocapture sret {{%.*}}, %objc_block* {{%.*}}, %TSC11BitfieldOneV* byval align 8 {{%.*}})
sil @testBitfieldInBlock : $@convention(thin) (@owned @convention(block) (BitfieldOne) -> BitfieldOne, BitfieldOne) -> BitfieldOne {
entry(%b : $@convention(block) (BitfieldOne) -> BitfieldOne, %x : $BitfieldOne):
%r = apply %b(%x) : $@convention(block) (BitfieldOne) -> BitfieldOne
return %r : $BitfieldOne
}
sil public_external @chareth : $@convention(c) (CChar) -> CChar
sil public_external @signedChareth : $@convention(c) (CSignedChar) -> CSignedChar
sil public_external @unsignedChareth : $@convention(c) (CUnsignedChar) -> CUnsignedChar
sil public_external @eatMyShorts : $@convention(c) (CShort) -> CShort
sil public_external @eatMyUnsignedShorts : $@convention(c) (CUnsignedShort) -> CUnsignedShort
sil public_external @ints : $@convention(c) (CInt) -> CInt
sil public_external @unsigneds : $@convention(c) (CUnsignedInt) -> CUnsignedInt