calling-conv-sext-zext.ll
9.36 KB
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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
; RUN: | FileCheck -check-prefix=RV32I %s
define zeroext i8 @uint8_arg_to_uint8_ret(i8 zeroext %a) nounwind {
; RV32I-LABEL: uint8_arg_to_uint8_ret:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
ret i8 %a
}
declare void @receive_uint8(i8 zeroext)
define void @pass_uint8_as_uint8(i8 zeroext %a) nounwind {
; RV32I-LABEL: pass_uint8_as_uint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call receive_uint8
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
call void @receive_uint8(i8 zeroext %a)
ret void
}
declare zeroext i8 @return_uint8()
define zeroext i8 @ret_callresult_uint8_as_uint8() nounwind {
; RV32I-LABEL: ret_callresult_uint8_as_uint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call return_uint8
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = call zeroext i8 @return_uint8()
ret i8 %1
}
define signext i8 @uint8_arg_to_sint8_ret(i8 zeroext %a) nounwind {
; RV32I-LABEL: uint8_arg_to_sint8_ret:
; RV32I: # %bb.0:
; RV32I-NEXT: slli a0, a0, 24
; RV32I-NEXT: srai a0, a0, 24
; RV32I-NEXT: ret
ret i8 %a
}
declare void @receive_sint8(i8 signext)
define void @pass_uint8_as_sint8(i8 zeroext %a) nounwind {
; RV32I-LABEL: pass_uint8_as_sint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: slli a0, a0, 24
; RV32I-NEXT: srai a0, a0, 24
; RV32I-NEXT: call receive_sint8
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
call void @receive_sint8(i8 signext %a)
ret void
}
define signext i8 @ret_callresult_uint8_as_sint8() nounwind {
; RV32I-LABEL: ret_callresult_uint8_as_sint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call return_uint8
; RV32I-NEXT: slli a0, a0, 24
; RV32I-NEXT: srai a0, a0, 24
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = call zeroext i8 @return_uint8()
ret i8 %1
}
define signext i32 @uint8_arg_to_anyint32_ret(i8 zeroext %a) nounwind {
; RV32I-LABEL: uint8_arg_to_anyint32_ret:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
%1 = zext i8 %a to i32
ret i32 %1
}
declare void @receive_anyint32(i32 signext)
define void @pass_uint8_as_anyint32(i8 zeroext %a) nounwind {
; RV32I-LABEL: pass_uint8_as_anyint32:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call receive_anyint32
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = zext i8 %a to i32
call void @receive_anyint32(i32 signext %1)
ret void
}
define signext i32 @ret_callresult_uint8_as_anyint32() nounwind {
; RV32I-LABEL: ret_callresult_uint8_as_anyint32:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call return_uint8
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = call zeroext i8 @return_uint8()
%2 = zext i8 %1 to i32
ret i32 %2
}
define zeroext i8 @sint8_arg_to_uint8_ret(i8 signext %a) nounwind {
; RV32I-LABEL: sint8_arg_to_uint8_ret:
; RV32I: # %bb.0:
; RV32I-NEXT: andi a0, a0, 255
; RV32I-NEXT: ret
ret i8 %a
}
define void @pass_sint8_as_uint8(i8 signext %a) nounwind {
; RV32I-LABEL: pass_sint8_as_uint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: andi a0, a0, 255
; RV32I-NEXT: call receive_uint8
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
call void @receive_uint8(i8 zeroext %a)
ret void
}
declare signext i8 @return_sint8()
define zeroext i8 @ret_callresult_sint8_as_uint8() nounwind {
; RV32I-LABEL: ret_callresult_sint8_as_uint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call return_sint8
; RV32I-NEXT: andi a0, a0, 255
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = call signext i8 @return_sint8()
ret i8 %1
}
define signext i8 @sint8_arg_to_sint8_ret(i8 signext %a) nounwind {
; RV32I-LABEL: sint8_arg_to_sint8_ret:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
ret i8 %a
}
define void @pass_sint8_as_sint8(i8 signext %a) nounwind {
; RV32I-LABEL: pass_sint8_as_sint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call receive_sint8
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
call void @receive_sint8(i8 signext %a)
ret void
}
define signext i8 @ret_callresult_sint8_as_sint8() nounwind {
; RV32I-LABEL: ret_callresult_sint8_as_sint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call return_sint8
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = call signext i8 @return_sint8()
ret i8 %1
}
define signext i32 @sint8_arg_to_anyint32_ret(i8 signext %a) nounwind {
; RV32I-LABEL: sint8_arg_to_anyint32_ret:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
%1 = sext i8 %a to i32
ret i32 %1
}
define void @pass_sint8_as_anyint32(i8 signext %a) nounwind {
; RV32I-LABEL: pass_sint8_as_anyint32:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call receive_anyint32
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = sext i8 %a to i32
call void @receive_anyint32(i32 signext %1)
ret void
}
define signext i32 @ret_callresult_sint8_as_anyint32() nounwind {
; RV32I-LABEL: ret_callresult_sint8_as_anyint32:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call return_sint8
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = call signext i8 @return_sint8()
%2 = sext i8 %1 to i32
ret i32 %2
}
define zeroext i8 @anyint32_arg_to_uint8_ret(i32 signext %a) nounwind {
; RV32I-LABEL: anyint32_arg_to_uint8_ret:
; RV32I: # %bb.0:
; RV32I-NEXT: andi a0, a0, 255
; RV32I-NEXT: ret
%1 = trunc i32 %a to i8
ret i8 %1
}
define void @pass_anyint32_as_uint8(i32 signext %a) nounwind {
; RV32I-LABEL: pass_anyint32_as_uint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: andi a0, a0, 255
; RV32I-NEXT: call receive_uint8
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = trunc i32 %a to i8
call void @receive_uint8(i8 zeroext %1)
ret void
}
declare signext i32 @return_anyint32()
define zeroext i8 @ret_callresult_anyint32_as_uint8() nounwind {
; RV32I-LABEL: ret_callresult_anyint32_as_uint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call return_anyint32
; RV32I-NEXT: andi a0, a0, 255
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = call signext i32 @return_anyint32()
%2 = trunc i32 %1 to i8
ret i8 %2
}
define signext i8 @anyint32_arg_to_sint8_ret(i32 signext %a) nounwind {
; RV32I-LABEL: anyint32_arg_to_sint8_ret:
; RV32I: # %bb.0:
; RV32I-NEXT: slli a0, a0, 24
; RV32I-NEXT: srai a0, a0, 24
; RV32I-NEXT: ret
%1 = trunc i32 %a to i8
ret i8 %1
}
define void @pass_anyint32_as_sint8(i32 signext %a) nounwind {
; RV32I-LABEL: pass_anyint32_as_sint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: slli a0, a0, 24
; RV32I-NEXT: srai a0, a0, 24
; RV32I-NEXT: call receive_sint8
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = trunc i32 %a to i8
call void @receive_sint8(i8 signext %1)
ret void
}
define signext i8 @ret_callresult_anyint32_as_sint8() nounwind {
; RV32I-LABEL: ret_callresult_anyint32_as_sint8:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call return_anyint32
; RV32I-NEXT: slli a0, a0, 24
; RV32I-NEXT: srai a0, a0, 24
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = call signext i32 @return_anyint32()
%2 = trunc i32 %1 to i8
ret i8 %2
}
define signext i32 @anyint32_arg_to_anyint32_ret(i32 signext %a) nounwind {
; RV32I-LABEL: anyint32_arg_to_anyint32_ret:
; RV32I: # %bb.0:
; RV32I-NEXT: ret
ret i32 %a
}
define void @pass_anyint32_as_anyint32(i32 signext %a) nounwind {
; RV32I-LABEL: pass_anyint32_as_anyint32:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call receive_anyint32
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
call void @receive_anyint32(i32 signext %a)
ret void
}
define signext i32 @ret_callresult_anyint32_as_anyint32() nounwind {
; RV32I-LABEL: ret_callresult_anyint32_as_anyint32:
; RV32I: # %bb.0:
; RV32I-NEXT: addi sp, sp, -16
; RV32I-NEXT: sw ra, 12(sp)
; RV32I-NEXT: call return_anyint32
; RV32I-NEXT: lw ra, 12(sp)
; RV32I-NEXT: addi sp, sp, 16
; RV32I-NEXT: ret
%1 = call signext i32 @return_anyint32()
ret i32 %1
}