1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=instruction-select %s -o - \
6 define void @load_i8_i64(ptr %addr) { ret void }
7 define void @load_i16_i64(ptr %addr) { ret void }
8 define void @load_i32_i64(ptr %addr) { ret void }
9 define void @load_i64_i64(ptr %addr) { ret void }
10 define void @load_p0(ptr %addr) { ret void }
11 define void @zextload_i8_i64(ptr %addr) { ret void }
12 define void @zextload_i16_i64(ptr %addr) { ret void }
13 define void @zextload_i32_i64(ptr %addr) { ret void }
14 define void @sextload_i8_i64(ptr %addr) { ret void }
15 define void @sextload_i16_i64(ptr %addr) { ret void }
16 define void @sextload_i32_i64(ptr %addr) { ret void }
17 define void @load_i8_i32(ptr %addr) { ret void }
18 define void @load_i16_i32(ptr %addr) { ret void }
19 define void @load_i32_i32(ptr %addr) { ret void }
20 define void @zextload_i8_i32(ptr %addr) { ret void }
21 define void @zextload_i16_i32(ptr %addr) { ret void }
22 define void @sextload_i8_i32(ptr %addr) { ret void }
23 define void @sextload_i16_i32(ptr %addr) { ret void }
24 define void @load_fi_i64() {
28 define void @load_fi_gep_i64_i64() {
29 %ptr0 = alloca [2 x i64]
32 define void @load_gep_i64_i64(ptr %addr) { ret void }
38 tracksRegLiveness: true
43 ; CHECK-LABEL: name: load_i8_i64
44 ; CHECK: liveins: $x10
46 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
47 ; CHECK-NEXT: [[LBU:%[0-9]+]]:gpr = LBU [[COPY]], 0 :: (load (s8))
48 ; CHECK-NEXT: $x10 = COPY [[LBU]]
49 ; CHECK-NEXT: PseudoRET implicit $x10
50 %0:gprb(p0) = COPY $x10
51 %1:gprb(s64) = G_LOAD %0(p0) :: (load (s8))
53 PseudoRET implicit $x10
60 tracksRegLiveness: true
65 ; CHECK-LABEL: name: load_i16_i64
66 ; CHECK: liveins: $x10
68 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
69 ; CHECK-NEXT: [[LH:%[0-9]+]]:gpr = LH [[COPY]], 0 :: (load (s16))
70 ; CHECK-NEXT: $x10 = COPY [[LH]]
71 ; CHECK-NEXT: PseudoRET implicit $x10
72 %0:gprb(p0) = COPY $x10
73 %1:gprb(s64) = G_LOAD %0(p0) :: (load (s16))
75 PseudoRET implicit $x10
82 tracksRegLiveness: true
87 ; CHECK-LABEL: name: load_i32_i64
88 ; CHECK: liveins: $x10
90 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
91 ; CHECK-NEXT: [[LW:%[0-9]+]]:gpr = LW [[COPY]], 0 :: (load (s32))
92 ; CHECK-NEXT: $x10 = COPY [[LW]]
93 ; CHECK-NEXT: PseudoRET implicit $x10
94 %0:gprb(p0) = COPY $x10
95 %1:gprb(s64) = G_LOAD %0(p0) :: (load (s32))
97 PseudoRET implicit $x10
103 regBankSelected: true
104 tracksRegLiveness: true
109 ; CHECK-LABEL: name: load_i64_i64
110 ; CHECK: liveins: $x10
112 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
113 ; CHECK-NEXT: [[LD:%[0-9]+]]:gpr = LD [[COPY]], 0 :: (load (s64))
114 ; CHECK-NEXT: $x10 = COPY [[LD]]
115 ; CHECK-NEXT: PseudoRET implicit $x10
116 %0:gprb(p0) = COPY $x10
117 %1:gprb(s64) = G_LOAD %0(p0) :: (load (s64))
119 PseudoRET implicit $x10
125 regBankSelected: true
126 tracksRegLiveness: true
131 ; CHECK-LABEL: name: load_p0
132 ; CHECK: liveins: $x10
134 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
135 ; CHECK-NEXT: [[LD:%[0-9]+]]:gpr = LD [[COPY]], 0 :: (load (p0))
136 ; CHECK-NEXT: $x10 = COPY [[LD]]
137 ; CHECK-NEXT: PseudoRET implicit $x10
138 %0:gprb(p0) = COPY $x10
139 %1:gprb(p0) = G_LOAD %0(p0) :: (load (p0))
141 PseudoRET implicit $x10
145 name: zextload_i8_i64
147 regBankSelected: true
148 tracksRegLiveness: true
153 ; CHECK-LABEL: name: zextload_i8_i64
154 ; CHECK: liveins: $x10
156 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
157 ; CHECK-NEXT: [[LBU:%[0-9]+]]:gpr = LBU [[COPY]], 0 :: (load (s8))
158 ; CHECK-NEXT: $x10 = COPY [[LBU]]
159 ; CHECK-NEXT: PseudoRET implicit $x10
160 %0:gprb(p0) = COPY $x10
161 %1:gprb(s64) = G_ZEXTLOAD %0(p0) :: (load (s8))
163 PseudoRET implicit $x10
167 name: zextload_i16_i64
169 regBankSelected: true
170 tracksRegLiveness: true
175 ; CHECK-LABEL: name: zextload_i16_i64
176 ; CHECK: liveins: $x10
178 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
179 ; CHECK-NEXT: [[LHU:%[0-9]+]]:gpr = LHU [[COPY]], 0 :: (load (s16))
180 ; CHECK-NEXT: $x10 = COPY [[LHU]]
181 ; CHECK-NEXT: PseudoRET implicit $x10
182 %0:gprb(p0) = COPY $x10
183 %1:gprb(s64) = G_ZEXTLOAD %0(p0) :: (load (s16))
185 PseudoRET implicit $x10
189 name: zextload_i32_i64
191 regBankSelected: true
192 tracksRegLiveness: true
197 ; CHECK-LABEL: name: zextload_i32_i64
198 ; CHECK: liveins: $x10
200 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
201 ; CHECK-NEXT: [[LWU:%[0-9]+]]:gpr = LWU [[COPY]], 0 :: (load (s32))
202 ; CHECK-NEXT: $x10 = COPY [[LWU]]
203 ; CHECK-NEXT: PseudoRET implicit $x10
204 %0:gprb(p0) = COPY $x10
205 %1:gprb(s64) = G_ZEXTLOAD %0(p0) :: (load (s32))
207 PseudoRET implicit $x10
211 name: sextload_i8_i64
213 regBankSelected: true
214 tracksRegLiveness: true
219 ; CHECK-LABEL: name: sextload_i8_i64
220 ; CHECK: liveins: $x10
222 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
223 ; CHECK-NEXT: [[LB:%[0-9]+]]:gpr = LB [[COPY]], 0 :: (load (s8))
224 ; CHECK-NEXT: $x10 = COPY [[LB]]
225 ; CHECK-NEXT: PseudoRET implicit $x10
226 %0:gprb(p0) = COPY $x10
227 %1:gprb(s64) = G_SEXTLOAD %0(p0) :: (load (s8))
229 PseudoRET implicit $x10
233 name: sextload_i16_i64
235 regBankSelected: true
236 tracksRegLiveness: true
241 ; CHECK-LABEL: name: sextload_i16_i64
242 ; CHECK: liveins: $x10
244 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
245 ; CHECK-NEXT: [[LH:%[0-9]+]]:gpr = LH [[COPY]], 0 :: (load (s16))
246 ; CHECK-NEXT: $x10 = COPY [[LH]]
247 ; CHECK-NEXT: PseudoRET implicit $x10
248 %0:gprb(p0) = COPY $x10
249 %1:gprb(s64) = G_SEXTLOAD %0(p0) :: (load (s16))
251 PseudoRET implicit $x10
255 name: sextload_i32_i64
257 regBankSelected: true
258 tracksRegLiveness: true
263 ; CHECK-LABEL: name: sextload_i32_i64
264 ; CHECK: liveins: $x10
266 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
267 ; CHECK-NEXT: [[LW:%[0-9]+]]:gpr = LW [[COPY]], 0 :: (load (s32))
268 ; CHECK-NEXT: $x10 = COPY [[LW]]
269 ; CHECK-NEXT: PseudoRET implicit $x10
270 %0:gprb(p0) = COPY $x10
271 %1:gprb(s64) = G_SEXTLOAD %0(p0) :: (load (s32))
273 PseudoRET implicit $x10
279 regBankSelected: true
280 tracksRegLiveness: true
284 ; CHECK-LABEL: name: load_i8_i32
285 ; CHECK: liveins: $x10, $x11
287 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
288 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
289 ; CHECK-NEXT: [[LBU:%[0-9]+]]:gpr = LBU [[COPY]], 0 :: (load (s8))
290 ; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LBU]], [[COPY1]]
291 ; CHECK-NEXT: $x10 = COPY [[ADDW]]
292 ; CHECK-NEXT: PseudoRET implicit $x10
293 %0:gprb(p0) = COPY $x10
294 %2:gprb(s64) = COPY $x11
295 %9:gprb(s32) = G_LOAD %0(p0) :: (load (s8))
296 %7:gprb(s32) = G_TRUNC %2(s64)
297 %8:gprb(s32) = G_ADD %9, %7
298 %5:gprb(s64) = G_ANYEXT %8(s32)
300 PseudoRET implicit $x10
306 regBankSelected: true
307 tracksRegLiveness: true
311 ; CHECK-LABEL: name: load_i16_i32
312 ; CHECK: liveins: $x10, $x11
314 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
315 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
316 ; CHECK-NEXT: [[LH:%[0-9]+]]:gpr = LH [[COPY]], 0 :: (load (s16))
317 ; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LH]], [[COPY1]]
318 ; CHECK-NEXT: $x10 = COPY [[ADDW]]
319 ; CHECK-NEXT: PseudoRET implicit $x10
320 %0:gprb(p0) = COPY $x10
321 %2:gprb(s64) = COPY $x11
322 %9:gprb(s32) = G_LOAD %0(p0) :: (load (s16))
323 %7:gprb(s32) = G_TRUNC %2(s64)
324 %8:gprb(s32) = G_ADD %9, %7
325 %5:gprb(s64) = G_ANYEXT %8(s32)
327 PseudoRET implicit $x10
333 regBankSelected: true
334 tracksRegLiveness: true
338 ; CHECK-LABEL: name: load_i32_i32
339 ; CHECK: liveins: $x10, $x11
341 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
342 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
343 ; CHECK-NEXT: [[LW:%[0-9]+]]:gpr = LW [[COPY]], 0 :: (load (s32))
344 ; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LW]], [[COPY1]]
345 ; CHECK-NEXT: $x10 = COPY [[ADDW]]
346 ; CHECK-NEXT: PseudoRET implicit $x10
347 %0:gprb(p0) = COPY $x10
348 %2:gprb(s64) = COPY $x11
349 %9:gprb(s32) = G_LOAD %0(p0) :: (load (s32))
350 %7:gprb(s32) = G_TRUNC %2(s64)
351 %8:gprb(s32) = G_ADD %9, %7
352 %5:gprb(s64) = G_ANYEXT %8(s32)
354 PseudoRET implicit $x10
358 name: zextload_i8_i32
360 regBankSelected: true
361 tracksRegLiveness: true
365 ; CHECK-LABEL: name: zextload_i8_i32
366 ; CHECK: liveins: $x10, $x11
368 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
369 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
370 ; CHECK-NEXT: [[LBU:%[0-9]+]]:gpr = LBU [[COPY]], 0 :: (load (s8))
371 ; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LBU]], [[COPY1]]
372 ; CHECK-NEXT: $x10 = COPY [[ADDW]]
373 ; CHECK-NEXT: PseudoRET implicit $x10
374 %0:gprb(p0) = COPY $x10
375 %2:gprb(s64) = COPY $x11
376 %9:gprb(s32) = G_ZEXTLOAD %0(p0) :: (load (s8))
377 %7:gprb(s32) = G_TRUNC %2(s64)
378 %8:gprb(s32) = G_ADD %9, %7
379 %5:gprb(s64) = G_ANYEXT %8(s32)
381 PseudoRET implicit $x10
385 name: zextload_i16_i32
387 regBankSelected: true
388 tracksRegLiveness: true
392 ; CHECK-LABEL: name: zextload_i16_i32
393 ; CHECK: liveins: $x10, $x11
395 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
396 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
397 ; CHECK-NEXT: [[LHU:%[0-9]+]]:gpr = LHU [[COPY]], 0 :: (load (s16))
398 ; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LHU]], [[COPY1]]
399 ; CHECK-NEXT: $x10 = COPY [[ADDW]]
400 ; CHECK-NEXT: PseudoRET implicit $x10
401 %0:gprb(p0) = COPY $x10
402 %2:gprb(s64) = COPY $x11
403 %9:gprb(s32) = G_ZEXTLOAD %0(p0) :: (load (s16))
404 %7:gprb(s32) = G_TRUNC %2(s64)
405 %8:gprb(s32) = G_ADD %9, %7
406 %5:gprb(s64) = G_ANYEXT %8(s32)
408 PseudoRET implicit $x10
412 name: sextload_i8_i32
414 regBankSelected: true
415 tracksRegLiveness: true
419 ; CHECK-LABEL: name: sextload_i8_i32
420 ; CHECK: liveins: $x10, $x11
422 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
423 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
424 ; CHECK-NEXT: [[LB:%[0-9]+]]:gpr = LB [[COPY]], 0 :: (load (s8))
425 ; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LB]], [[COPY1]]
426 ; CHECK-NEXT: $x10 = COPY [[ADDW]]
427 ; CHECK-NEXT: PseudoRET implicit $x10
428 %0:gprb(p0) = COPY $x10
429 %2:gprb(s64) = COPY $x11
430 %9:gprb(s32) = G_SEXTLOAD %0(p0) :: (load (s8))
431 %7:gprb(s32) = G_TRUNC %2(s64)
432 %8:gprb(s32) = G_ADD %9, %7
433 %5:gprb(s64) = G_ANYEXT %8(s32)
435 PseudoRET implicit $x10
439 name: sextload_i16_i32
441 regBankSelected: true
442 tracksRegLiveness: true
446 ; CHECK-LABEL: name: sextload_i16_i32
447 ; CHECK: liveins: $x10, $x11
449 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
450 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
451 ; CHECK-NEXT: [[LH:%[0-9]+]]:gpr = LH [[COPY]], 0 :: (load (s16))
452 ; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LH]], [[COPY1]]
453 ; CHECK-NEXT: $x10 = COPY [[ADDW]]
454 ; CHECK-NEXT: PseudoRET implicit $x10
455 %0:gprb(p0) = COPY $x10
456 %2:gprb(s64) = COPY $x11
457 %9:gprb(s32) = G_SEXTLOAD %0(p0) :: (load (s16))
458 %7:gprb(s32) = G_TRUNC %2(s64)
459 %8:gprb(s32) = G_ADD %9, %7
460 %5:gprb(s64) = G_ANYEXT %8(s32)
462 PseudoRET implicit $x10
468 regBankSelected: true
469 tracksRegLiveness: true
472 - { id: 0, name: ptr0, offset: 0, size: 8, alignment: 8 }
476 ; CHECK-LABEL: name: load_fi_i64
477 ; CHECK: [[LD:%[0-9]+]]:gpr = LD %stack.0.ptr0, 0 :: (load (s64))
478 ; CHECK-NEXT: $x10 = COPY [[LD]]
479 ; CHECK-NEXT: PseudoRET implicit $x10
480 %0:gprb(p0) = G_FRAME_INDEX %stack.0.ptr0
481 %1:gprb(s64) = G_LOAD %0(p0) :: (load (s64))
483 PseudoRET implicit $x10
487 name: load_fi_gep_i64_i64
489 regBankSelected: true
490 tracksRegLiveness: true
493 - { id: 0, name: ptr0, offset: 0, size: 16, alignment: 8 }
497 ; CHECK-LABEL: name: load_fi_gep_i64_i64
498 ; CHECK: [[LD:%[0-9]+]]:gpr = LD %stack.0.ptr0, 8 :: (load (s64))
499 ; CHECK-NEXT: $x10 = COPY [[LD]]
500 ; CHECK-NEXT: PseudoRET implicit $x10
501 %0:gprb(p0) = G_FRAME_INDEX %stack.0.ptr0
502 %1:gprb(s64) = G_CONSTANT i64 8
503 %2:gprb(p0) = G_PTR_ADD %0(p0), %1(s64)
504 %3:gprb(s64) = G_LOAD %2(p0) :: (load (s64))
506 PseudoRET implicit $x10
510 name: load_gep_i64_i64
512 regBankSelected: true
513 tracksRegLiveness: true
518 ; CHECK-LABEL: name: load_gep_i64_i64
519 ; CHECK: liveins: $x10
521 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
522 ; CHECK-NEXT: [[LD:%[0-9]+]]:gpr = LD [[COPY]], 8 :: (load (s64))
523 ; CHECK-NEXT: $x10 = COPY [[LD]]
524 ; CHECK-NEXT: PseudoRET implicit $x10
525 %0:gprb(p0) = COPY $x10
526 %1:gprb(s64) = G_CONSTANT i64 8
527 %2:gprb(p0) = G_PTR_ADD %0(p0), %1(s64)
528 %3:gprb(s64) = G_LOAD %2(p0) :: (load (s64))
530 PseudoRET implicit $x10