1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=RV32I %s
5 define zeroext i8 @uint8_arg_to_uint8_ret(i8 zeroext %a) nounwind {
6 ; RV32I-LABEL: uint8_arg_to_uint8_ret:
12 declare void @receive_uint8(i8 zeroext)
14 define void @pass_uint8_as_uint8(i8 zeroext %a) nounwind {
15 ; RV32I-LABEL: pass_uint8_as_uint8:
17 ; RV32I-NEXT: addi sp, sp, -16
18 ; RV32I-NEXT: sw ra, 12(sp)
19 ; RV32I-NEXT: call receive_uint8
20 ; RV32I-NEXT: lw ra, 12(sp)
21 ; RV32I-NEXT: addi sp, sp, 16
23 call void @receive_uint8(i8 zeroext %a)
27 declare zeroext i8 @return_uint8()
29 define zeroext i8 @ret_callresult_uint8_as_uint8() nounwind {
30 ; RV32I-LABEL: ret_callresult_uint8_as_uint8:
32 ; RV32I-NEXT: addi sp, sp, -16
33 ; RV32I-NEXT: sw ra, 12(sp)
34 ; RV32I-NEXT: call return_uint8
35 ; RV32I-NEXT: lw ra, 12(sp)
36 ; RV32I-NEXT: addi sp, sp, 16
38 %1 = call zeroext i8 @return_uint8()
42 define signext i8 @uint8_arg_to_sint8_ret(i8 zeroext %a) nounwind {
43 ; RV32I-LABEL: uint8_arg_to_sint8_ret:
45 ; RV32I-NEXT: slli a0, a0, 24
46 ; RV32I-NEXT: srai a0, a0, 24
51 declare void @receive_sint8(i8 signext)
53 define void @pass_uint8_as_sint8(i8 zeroext %a) nounwind {
54 ; RV32I-LABEL: pass_uint8_as_sint8:
56 ; RV32I-NEXT: addi sp, sp, -16
57 ; RV32I-NEXT: sw ra, 12(sp)
58 ; RV32I-NEXT: slli a0, a0, 24
59 ; RV32I-NEXT: srai a0, a0, 24
60 ; RV32I-NEXT: call receive_sint8
61 ; RV32I-NEXT: lw ra, 12(sp)
62 ; RV32I-NEXT: addi sp, sp, 16
65 call void @receive_sint8(i8 signext %a)
69 define signext i8 @ret_callresult_uint8_as_sint8() nounwind {
70 ; RV32I-LABEL: ret_callresult_uint8_as_sint8:
72 ; RV32I-NEXT: addi sp, sp, -16
73 ; RV32I-NEXT: sw ra, 12(sp)
74 ; RV32I-NEXT: call return_uint8
75 ; RV32I-NEXT: slli a0, a0, 24
76 ; RV32I-NEXT: srai a0, a0, 24
77 ; RV32I-NEXT: lw ra, 12(sp)
78 ; RV32I-NEXT: addi sp, sp, 16
80 %1 = call zeroext i8 @return_uint8()
84 define signext i32 @uint8_arg_to_anyint32_ret(i8 zeroext %a) nounwind {
85 ; RV32I-LABEL: uint8_arg_to_anyint32_ret:
88 %1 = zext i8 %a to i32
92 declare void @receive_anyint32(i32 signext)
94 define void @pass_uint8_as_anyint32(i8 zeroext %a) nounwind {
95 ; RV32I-LABEL: pass_uint8_as_anyint32:
97 ; RV32I-NEXT: addi sp, sp, -16
98 ; RV32I-NEXT: sw ra, 12(sp)
99 ; RV32I-NEXT: call receive_anyint32
100 ; RV32I-NEXT: lw ra, 12(sp)
101 ; RV32I-NEXT: addi sp, sp, 16
103 %1 = zext i8 %a to i32
104 call void @receive_anyint32(i32 signext %1)
108 define signext i32 @ret_callresult_uint8_as_anyint32() nounwind {
109 ; RV32I-LABEL: ret_callresult_uint8_as_anyint32:
111 ; RV32I-NEXT: addi sp, sp, -16
112 ; RV32I-NEXT: sw ra, 12(sp)
113 ; RV32I-NEXT: call return_uint8
114 ; RV32I-NEXT: lw ra, 12(sp)
115 ; RV32I-NEXT: addi sp, sp, 16
117 %1 = call zeroext i8 @return_uint8()
118 %2 = zext i8 %1 to i32
122 define zeroext i8 @sint8_arg_to_uint8_ret(i8 signext %a) nounwind {
123 ; RV32I-LABEL: sint8_arg_to_uint8_ret:
125 ; RV32I-NEXT: andi a0, a0, 255
130 define void @pass_sint8_as_uint8(i8 signext %a) nounwind {
131 ; RV32I-LABEL: pass_sint8_as_uint8:
133 ; RV32I-NEXT: addi sp, sp, -16
134 ; RV32I-NEXT: sw ra, 12(sp)
135 ; RV32I-NEXT: andi a0, a0, 255
136 ; RV32I-NEXT: call receive_uint8
137 ; RV32I-NEXT: lw ra, 12(sp)
138 ; RV32I-NEXT: addi sp, sp, 16
140 call void @receive_uint8(i8 zeroext %a)
144 declare signext i8 @return_sint8()
146 define zeroext i8 @ret_callresult_sint8_as_uint8() nounwind {
147 ; RV32I-LABEL: ret_callresult_sint8_as_uint8:
149 ; RV32I-NEXT: addi sp, sp, -16
150 ; RV32I-NEXT: sw ra, 12(sp)
151 ; RV32I-NEXT: call return_sint8
152 ; RV32I-NEXT: andi a0, a0, 255
153 ; RV32I-NEXT: lw ra, 12(sp)
154 ; RV32I-NEXT: addi sp, sp, 16
156 %1 = call signext i8 @return_sint8()
160 define signext i8 @sint8_arg_to_sint8_ret(i8 signext %a) nounwind {
161 ; RV32I-LABEL: sint8_arg_to_sint8_ret:
167 define void @pass_sint8_as_sint8(i8 signext %a) nounwind {
168 ; RV32I-LABEL: pass_sint8_as_sint8:
170 ; RV32I-NEXT: addi sp, sp, -16
171 ; RV32I-NEXT: sw ra, 12(sp)
172 ; RV32I-NEXT: call receive_sint8
173 ; RV32I-NEXT: lw ra, 12(sp)
174 ; RV32I-NEXT: addi sp, sp, 16
176 call void @receive_sint8(i8 signext %a)
180 define signext i8 @ret_callresult_sint8_as_sint8() nounwind {
181 ; RV32I-LABEL: ret_callresult_sint8_as_sint8:
183 ; RV32I-NEXT: addi sp, sp, -16
184 ; RV32I-NEXT: sw ra, 12(sp)
185 ; RV32I-NEXT: call return_sint8
186 ; RV32I-NEXT: lw ra, 12(sp)
187 ; RV32I-NEXT: addi sp, sp, 16
189 %1 = call signext i8 @return_sint8()
193 define signext i32 @sint8_arg_to_anyint32_ret(i8 signext %a) nounwind {
194 ; RV32I-LABEL: sint8_arg_to_anyint32_ret:
197 %1 = sext i8 %a to i32
201 define void @pass_sint8_as_anyint32(i8 signext %a) nounwind {
202 ; RV32I-LABEL: pass_sint8_as_anyint32:
204 ; RV32I-NEXT: addi sp, sp, -16
205 ; RV32I-NEXT: sw ra, 12(sp)
206 ; RV32I-NEXT: call receive_anyint32
207 ; RV32I-NEXT: lw ra, 12(sp)
208 ; RV32I-NEXT: addi sp, sp, 16
210 %1 = sext i8 %a to i32
211 call void @receive_anyint32(i32 signext %1)
215 define signext i32 @ret_callresult_sint8_as_anyint32() nounwind {
216 ; RV32I-LABEL: ret_callresult_sint8_as_anyint32:
218 ; RV32I-NEXT: addi sp, sp, -16
219 ; RV32I-NEXT: sw ra, 12(sp)
220 ; RV32I-NEXT: call return_sint8
221 ; RV32I-NEXT: lw ra, 12(sp)
222 ; RV32I-NEXT: addi sp, sp, 16
224 %1 = call signext i8 @return_sint8()
225 %2 = sext i8 %1 to i32
229 define zeroext i8 @anyint32_arg_to_uint8_ret(i32 signext %a) nounwind {
230 ; RV32I-LABEL: anyint32_arg_to_uint8_ret:
232 ; RV32I-NEXT: andi a0, a0, 255
234 %1 = trunc i32 %a to i8
238 define void @pass_anyint32_as_uint8(i32 signext %a) nounwind {
239 ; RV32I-LABEL: pass_anyint32_as_uint8:
241 ; RV32I-NEXT: addi sp, sp, -16
242 ; RV32I-NEXT: sw ra, 12(sp)
243 ; RV32I-NEXT: andi a0, a0, 255
244 ; RV32I-NEXT: call receive_uint8
245 ; RV32I-NEXT: lw ra, 12(sp)
246 ; RV32I-NEXT: addi sp, sp, 16
248 %1 = trunc i32 %a to i8
249 call void @receive_uint8(i8 zeroext %1)
253 declare signext i32 @return_anyint32()
255 define zeroext i8 @ret_callresult_anyint32_as_uint8() nounwind {
256 ; RV32I-LABEL: ret_callresult_anyint32_as_uint8:
258 ; RV32I-NEXT: addi sp, sp, -16
259 ; RV32I-NEXT: sw ra, 12(sp)
260 ; RV32I-NEXT: call return_anyint32
261 ; RV32I-NEXT: andi a0, a0, 255
262 ; RV32I-NEXT: lw ra, 12(sp)
263 ; RV32I-NEXT: addi sp, sp, 16
265 %1 = call signext i32 @return_anyint32()
266 %2 = trunc i32 %1 to i8
270 define signext i8 @anyint32_arg_to_sint8_ret(i32 signext %a) nounwind {
271 ; RV32I-LABEL: anyint32_arg_to_sint8_ret:
273 ; RV32I-NEXT: slli a0, a0, 24
274 ; RV32I-NEXT: srai a0, a0, 24
276 %1 = trunc i32 %a to i8
280 define void @pass_anyint32_as_sint8(i32 signext %a) nounwind {
281 ; RV32I-LABEL: pass_anyint32_as_sint8:
283 ; RV32I-NEXT: addi sp, sp, -16
284 ; RV32I-NEXT: sw ra, 12(sp)
285 ; RV32I-NEXT: slli a0, a0, 24
286 ; RV32I-NEXT: srai a0, a0, 24
287 ; RV32I-NEXT: call receive_sint8
288 ; RV32I-NEXT: lw ra, 12(sp)
289 ; RV32I-NEXT: addi sp, sp, 16
291 %1 = trunc i32 %a to i8
292 call void @receive_sint8(i8 signext %1)
296 define signext i8 @ret_callresult_anyint32_as_sint8() nounwind {
297 ; RV32I-LABEL: ret_callresult_anyint32_as_sint8:
299 ; RV32I-NEXT: addi sp, sp, -16
300 ; RV32I-NEXT: sw ra, 12(sp)
301 ; RV32I-NEXT: call return_anyint32
302 ; RV32I-NEXT: slli a0, a0, 24
303 ; RV32I-NEXT: srai a0, a0, 24
304 ; RV32I-NEXT: lw ra, 12(sp)
305 ; RV32I-NEXT: addi sp, sp, 16
307 %1 = call signext i32 @return_anyint32()
308 %2 = trunc i32 %1 to i8
312 define signext i32 @anyint32_arg_to_anyint32_ret(i32 signext %a) nounwind {
313 ; RV32I-LABEL: anyint32_arg_to_anyint32_ret:
319 define void @pass_anyint32_as_anyint32(i32 signext %a) nounwind {
320 ; RV32I-LABEL: pass_anyint32_as_anyint32:
322 ; RV32I-NEXT: addi sp, sp, -16
323 ; RV32I-NEXT: sw ra, 12(sp)
324 ; RV32I-NEXT: call receive_anyint32
325 ; RV32I-NEXT: lw ra, 12(sp)
326 ; RV32I-NEXT: addi sp, sp, 16
328 call void @receive_anyint32(i32 signext %a)
332 define signext i32 @ret_callresult_anyint32_as_anyint32() nounwind {
333 ; RV32I-LABEL: ret_callresult_anyint32_as_anyint32:
335 ; RV32I-NEXT: addi sp, sp, -16
336 ; RV32I-NEXT: sw ra, 12(sp)
337 ; RV32I-NEXT: call return_anyint32
338 ; RV32I-NEXT: lw ra, 12(sp)
339 ; RV32I-NEXT: addi sp, sp, 16
341 %1 = call signext i32 @return_anyint32()