1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -mattr=+d -run-pass=legalizer %s -o - \
7 tracksRegLiveness: true
12 ; CHECK-LABEL: name: sitofp_s32_s1
13 ; CHECK: liveins: $x10
15 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
16 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
17 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
18 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
19 ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[ASHR]](s32)
20 ; CHECK-NEXT: $f10_f = COPY [[SITOFP]](s32)
21 ; CHECK-NEXT: PseudoRET implicit $f10_f
23 %0:_(s1) = G_TRUNC %1(s32)
24 %2:_(s32) = G_SITOFP %0(s1)
26 PseudoRET implicit $f10_f
31 tracksRegLiveness: true
36 ; CHECK-LABEL: name: uitofp_s32_s1
37 ; CHECK: liveins: $x10
39 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
40 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
41 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
42 ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
43 ; CHECK-NEXT: $f10_f = COPY [[UITOFP]](s32)
44 ; CHECK-NEXT: PseudoRET implicit $f10_f
46 %0:_(s1) = G_TRUNC %1(s32)
47 %2:_(s32) = G_UITOFP %0(s1)
49 PseudoRET implicit $f10_f
54 tracksRegLiveness: true
59 ; CHECK-LABEL: name: sitofp_s32_s8
60 ; CHECK: liveins: $x10
62 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
63 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
64 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
65 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
66 ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[ASHR]](s32)
67 ; CHECK-NEXT: $f10_f = COPY [[SITOFP]](s32)
68 ; CHECK-NEXT: PseudoRET implicit $f10_f
70 %0:_(s8) = G_TRUNC %1(s32)
71 %2:_(s32) = G_SITOFP %0(s8)
73 PseudoRET implicit $f10_f
78 tracksRegLiveness: true
83 ; CHECK-LABEL: name: uitofp_s32_s8
84 ; CHECK: liveins: $x10
86 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
87 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
88 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
89 ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
90 ; CHECK-NEXT: $f10_f = COPY [[UITOFP]](s32)
91 ; CHECK-NEXT: PseudoRET implicit $f10_f
93 %0:_(s8) = G_TRUNC %1(s32)
94 %2:_(s32) = G_UITOFP %0(s8)
96 PseudoRET implicit $f10_f
101 tracksRegLiveness: true
106 ; CHECK-LABEL: name: sitofp_s32_s16
107 ; CHECK: liveins: $x10
109 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
110 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
111 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
112 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
113 ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[ASHR]](s32)
114 ; CHECK-NEXT: $f10_f = COPY [[SITOFP]](s32)
115 ; CHECK-NEXT: PseudoRET implicit $f10_f
116 %1:_(s32) = COPY $x10
117 %0:_(s16) = G_TRUNC %1(s32)
118 %2:_(s32) = G_SITOFP %0(s16)
119 $f10_f = COPY %2(s32)
120 PseudoRET implicit $f10_f
125 tracksRegLiveness: true
130 ; CHECK-LABEL: name: uitofp_s32_s16
131 ; CHECK: liveins: $x10
133 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
134 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
135 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
136 ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[AND]](s32)
137 ; CHECK-NEXT: $f10_f = COPY [[UITOFP]](s32)
138 ; CHECK-NEXT: PseudoRET implicit $f10_f
139 %1:_(s32) = COPY $x10
140 %0:_(s16) = G_TRUNC %1(s32)
141 %2:_(s32) = G_UITOFP %0(s16)
142 $f10_f = COPY %2(s32)
143 PseudoRET implicit $f10_f
148 tracksRegLiveness: true
153 ; CHECK-LABEL: name: sitofp_s32_s32
154 ; CHECK: liveins: $x10
156 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
157 ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[COPY]](s32)
158 ; CHECK-NEXT: $f10_f = COPY [[SITOFP]](s32)
159 ; CHECK-NEXT: PseudoRET implicit $f10_f
160 %0:_(s32) = COPY $x10
161 %1:_(s32) = G_SITOFP %0(s32)
162 $f10_f = COPY %1(s32)
163 PseudoRET implicit $f10_f
168 tracksRegLiveness: true
173 ; CHECK-LABEL: name: uitofp_s32_s32
174 ; CHECK: liveins: $x10
176 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
177 ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s32) = G_UITOFP [[COPY]](s32)
178 ; CHECK-NEXT: $f10_f = COPY [[UITOFP]](s32)
179 ; CHECK-NEXT: PseudoRET implicit $f10_f
180 %0:_(s32) = COPY $x10
181 %1:_(s32) = G_UITOFP %0(s32)
182 $f10_f = COPY %1(s32)
183 PseudoRET implicit $f10_f
188 tracksRegLiveness: true
193 ; CHECK-LABEL: name: sitofp_s64_s1
194 ; CHECK: liveins: $x10
196 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
197 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 31
198 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
199 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
200 ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[ASHR]](s32)
201 ; CHECK-NEXT: $f10_d = COPY [[SITOFP]](s64)
202 ; CHECK-NEXT: PseudoRET implicit $f10_d
203 %1:_(s32) = COPY $x10
204 %0:_(s1) = G_TRUNC %1(s32)
205 %2:_(s64) = G_SITOFP %0(s1)
206 $f10_d = COPY %2(s64)
207 PseudoRET implicit $f10_d
212 tracksRegLiveness: true
217 ; CHECK-LABEL: name: uitofp_s64_s1
218 ; CHECK: liveins: $x10
220 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
221 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
222 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
223 ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
224 ; CHECK-NEXT: $f10_d = COPY [[UITOFP]](s64)
225 ; CHECK-NEXT: PseudoRET implicit $f10_d
226 %1:_(s32) = COPY $x10
227 %0:_(s1) = G_TRUNC %1(s32)
228 %2:_(s64) = G_UITOFP %0(s1)
229 $f10_d = COPY %2(s64)
230 PseudoRET implicit $f10_d
235 tracksRegLiveness: true
240 ; CHECK-LABEL: name: sitofp_s64_s8
241 ; CHECK: liveins: $x10
243 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
244 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
245 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
246 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
247 ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[ASHR]](s32)
248 ; CHECK-NEXT: $f10_d = COPY [[SITOFP]](s64)
249 ; CHECK-NEXT: PseudoRET implicit $f10_d
250 %1:_(s32) = COPY $x10
251 %0:_(s8) = G_TRUNC %1(s32)
252 %2:_(s64) = G_SITOFP %0(s8)
253 $f10_d = COPY %2(s64)
254 PseudoRET implicit $f10_d
259 tracksRegLiveness: true
264 ; CHECK-LABEL: name: uitofp_s64_s8
265 ; CHECK: liveins: $x10
267 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
268 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
269 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
270 ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
271 ; CHECK-NEXT: $f10_d = COPY [[UITOFP]](s64)
272 ; CHECK-NEXT: PseudoRET implicit $f10_d
273 %1:_(s32) = COPY $x10
274 %0:_(s8) = G_TRUNC %1(s32)
275 %2:_(s64) = G_UITOFP %0(s8)
276 $f10_d = COPY %2(s64)
277 PseudoRET implicit $f10_d
282 tracksRegLiveness: true
287 ; CHECK-LABEL: name: sitofp_s64_s16
288 ; CHECK: liveins: $x10
290 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
291 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
292 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
293 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
294 ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[ASHR]](s32)
295 ; CHECK-NEXT: $f10_d = COPY [[SITOFP]](s64)
296 ; CHECK-NEXT: PseudoRET implicit $f10_d
297 %1:_(s32) = COPY $x10
298 %0:_(s16) = G_TRUNC %1(s32)
299 %2:_(s64) = G_SITOFP %0(s16)
300 $f10_d = COPY %2(s64)
301 PseudoRET implicit $f10_d
306 tracksRegLiveness: true
311 ; CHECK-LABEL: name: uitofp_s64_s16
312 ; CHECK: liveins: $x10
314 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
315 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
316 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
317 ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[AND]](s32)
318 ; CHECK-NEXT: $f10_d = COPY [[UITOFP]](s64)
319 ; CHECK-NEXT: PseudoRET implicit $f10_d
320 %1:_(s32) = COPY $x10
321 %0:_(s16) = G_TRUNC %1(s32)
322 %2:_(s64) = G_UITOFP %0(s16)
323 $f10_d = COPY %2(s64)
324 PseudoRET implicit $f10_d
329 tracksRegLiveness: true
334 ; CHECK-LABEL: name: sitofp_s64_s32
335 ; CHECK: liveins: $x10
337 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
338 ; CHECK-NEXT: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[COPY]](s32)
339 ; CHECK-NEXT: $f10_d = COPY [[SITOFP]](s64)
340 ; CHECK-NEXT: PseudoRET implicit $f10_d
341 %0:_(s32) = COPY $x10
342 %1:_(s64) = G_SITOFP %0(s32)
343 $f10_d = COPY %1(s64)
344 PseudoRET implicit $f10_d
349 tracksRegLiveness: true
354 ; CHECK-LABEL: name: uitofp_s64_s32
355 ; CHECK: liveins: $x10
357 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
358 ; CHECK-NEXT: [[UITOFP:%[0-9]+]]:_(s64) = G_UITOFP [[COPY]](s32)
359 ; CHECK-NEXT: $f10_d = COPY [[UITOFP]](s64)
360 ; CHECK-NEXT: PseudoRET implicit $f10_d
361 %0:_(s32) = COPY $x10
362 %1:_(s64) = G_UITOFP %0(s32)
363 $f10_d = COPY %1(s64)
364 PseudoRET implicit $f10_d