# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=riscv64 -run-pass=instruction-select %s -o - \
# RUN: | FileCheck %s
--- |
define void @load_i8_i64(ptr %addr) { ret void }
define void @load_i16_i64(ptr %addr) { ret void }
define void @load_i32_i64(ptr %addr) { ret void }
define void @load_i64_i64(ptr %addr) { ret void }
define void @load_p0(ptr %addr) { ret void }
define void @zextload_i8_i64(ptr %addr) { ret void }
define void @zextload_i16_i64(ptr %addr) { ret void }
define void @zextload_i32_i64(ptr %addr) { ret void }
define void @sextload_i8_i64(ptr %addr) { ret void }
define void @sextload_i16_i64(ptr %addr) { ret void }
define void @sextload_i32_i64(ptr %addr) { ret void }
define void @load_i8_i32(ptr %addr) { ret void }
define void @load_i16_i32(ptr %addr) { ret void }
define void @load_i32_i32(ptr %addr) { ret void }
define void @zextload_i8_i32(ptr %addr) { ret void }
define void @zextload_i16_i32(ptr %addr) { ret void }
define void @sextload_i8_i32(ptr %addr) { ret void }
define void @sextload_i16_i32(ptr %addr) { ret void }
define void @load_fi_i64() {
%ptr0 = alloca i64
ret void
}
define void @load_fi_gep_i64_i64() {
%ptr0 = alloca [2 x i64]
ret void
}
define void @load_gep_i64_i64(ptr %addr) { ret void }
...
---
name: load_i8_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: load_i8_i64
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LBU:%[0-9]+]]:gpr = LBU [[COPY]], 0 :: (load (s8))
; CHECK-NEXT: $x10 = COPY [[LBU]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(s64) = G_LOAD %0(p0) :: (load (s8))
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: load_i16_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: load_i16_i64
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LH:%[0-9]+]]:gpr = LH [[COPY]], 0 :: (load (s16))
; CHECK-NEXT: $x10 = COPY [[LH]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(s64) = G_LOAD %0(p0) :: (load (s16))
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: load_i32_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: load_i32_i64
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LW:%[0-9]+]]:gpr = LW [[COPY]], 0 :: (load (s32))
; CHECK-NEXT: $x10 = COPY [[LW]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(s64) = G_LOAD %0(p0) :: (load (s32))
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: load_i64_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: load_i64_i64
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LD:%[0-9]+]]:gpr = LD [[COPY]], 0 :: (load (s64))
; CHECK-NEXT: $x10 = COPY [[LD]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(s64) = G_LOAD %0(p0) :: (load (s64))
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: load_p0
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: load_p0
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LD:%[0-9]+]]:gpr = LD [[COPY]], 0 :: (load (p0))
; CHECK-NEXT: $x10 = COPY [[LD]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(p0) = G_LOAD %0(p0) :: (load (p0))
$x10 = COPY %1(p0)
PseudoRET implicit $x10
...
---
name: zextload_i8_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: zextload_i8_i64
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LBU:%[0-9]+]]:gpr = LBU [[COPY]], 0 :: (load (s8))
; CHECK-NEXT: $x10 = COPY [[LBU]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(s64) = G_ZEXTLOAD %0(p0) :: (load (s8))
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: zextload_i16_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: zextload_i16_i64
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LHU:%[0-9]+]]:gpr = LHU [[COPY]], 0 :: (load (s16))
; CHECK-NEXT: $x10 = COPY [[LHU]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(s64) = G_ZEXTLOAD %0(p0) :: (load (s16))
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: zextload_i32_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: zextload_i32_i64
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LWU:%[0-9]+]]:gpr = LWU [[COPY]], 0 :: (load (s32))
; CHECK-NEXT: $x10 = COPY [[LWU]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(s64) = G_ZEXTLOAD %0(p0) :: (load (s32))
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: sextload_i8_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: sextload_i8_i64
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LB:%[0-9]+]]:gpr = LB [[COPY]], 0 :: (load (s8))
; CHECK-NEXT: $x10 = COPY [[LB]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(s64) = G_SEXTLOAD %0(p0) :: (load (s8))
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: sextload_i16_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: sextload_i16_i64
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LH:%[0-9]+]]:gpr = LH [[COPY]], 0 :: (load (s16))
; CHECK-NEXT: $x10 = COPY [[LH]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(s64) = G_SEXTLOAD %0(p0) :: (load (s16))
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: sextload_i32_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: sextload_i32_i64
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LW:%[0-9]+]]:gpr = LW [[COPY]], 0 :: (load (s32))
; CHECK-NEXT: $x10 = COPY [[LW]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(s64) = G_SEXTLOAD %0(p0) :: (load (s32))
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: load_i8_i32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10, $x11
; CHECK-LABEL: name: load_i8_i32
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[LBU:%[0-9]+]]:gpr = LBU [[COPY]], 0 :: (load (s8))
; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LBU]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[ADDW]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%2:gprb(s64) = COPY $x11
%9:gprb(s32) = G_LOAD %0(p0) :: (load (s8))
%7:gprb(s32) = G_TRUNC %2(s64)
%8:gprb(s32) = G_ADD %9, %7
%5:gprb(s64) = G_ANYEXT %8(s32)
$x10 = COPY %5(s64)
PseudoRET implicit $x10
...
---
name: load_i16_i32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10, $x11
; CHECK-LABEL: name: load_i16_i32
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[LH:%[0-9]+]]:gpr = LH [[COPY]], 0 :: (load (s16))
; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LH]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[ADDW]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%2:gprb(s64) = COPY $x11
%9:gprb(s32) = G_LOAD %0(p0) :: (load (s16))
%7:gprb(s32) = G_TRUNC %2(s64)
%8:gprb(s32) = G_ADD %9, %7
%5:gprb(s64) = G_ANYEXT %8(s32)
$x10 = COPY %5(s64)
PseudoRET implicit $x10
...
---
name: load_i32_i32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10, $x11
; CHECK-LABEL: name: load_i32_i32
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[LW:%[0-9]+]]:gpr = LW [[COPY]], 0 :: (load (s32))
; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LW]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[ADDW]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%2:gprb(s64) = COPY $x11
%9:gprb(s32) = G_LOAD %0(p0) :: (load (s32))
%7:gprb(s32) = G_TRUNC %2(s64)
%8:gprb(s32) = G_ADD %9, %7
%5:gprb(s64) = G_ANYEXT %8(s32)
$x10 = COPY %5(s64)
PseudoRET implicit $x10
...
---
name: zextload_i8_i32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10, $x11
; CHECK-LABEL: name: zextload_i8_i32
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[LBU:%[0-9]+]]:gpr = LBU [[COPY]], 0 :: (load (s8))
; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LBU]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[ADDW]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%2:gprb(s64) = COPY $x11
%9:gprb(s32) = G_ZEXTLOAD %0(p0) :: (load (s8))
%7:gprb(s32) = G_TRUNC %2(s64)
%8:gprb(s32) = G_ADD %9, %7
%5:gprb(s64) = G_ANYEXT %8(s32)
$x10 = COPY %5(s64)
PseudoRET implicit $x10
...
---
name: zextload_i16_i32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10, $x11
; CHECK-LABEL: name: zextload_i16_i32
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[LHU:%[0-9]+]]:gpr = LHU [[COPY]], 0 :: (load (s16))
; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LHU]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[ADDW]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%2:gprb(s64) = COPY $x11
%9:gprb(s32) = G_ZEXTLOAD %0(p0) :: (load (s16))
%7:gprb(s32) = G_TRUNC %2(s64)
%8:gprb(s32) = G_ADD %9, %7
%5:gprb(s64) = G_ANYEXT %8(s32)
$x10 = COPY %5(s64)
PseudoRET implicit $x10
...
---
name: sextload_i8_i32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10, $x11
; CHECK-LABEL: name: sextload_i8_i32
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[LB:%[0-9]+]]:gpr = LB [[COPY]], 0 :: (load (s8))
; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LB]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[ADDW]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%2:gprb(s64) = COPY $x11
%9:gprb(s32) = G_SEXTLOAD %0(p0) :: (load (s8))
%7:gprb(s32) = G_TRUNC %2(s64)
%8:gprb(s32) = G_ADD %9, %7
%5:gprb(s64) = G_ANYEXT %8(s32)
$x10 = COPY %5(s64)
PseudoRET implicit $x10
...
---
name: sextload_i16_i32
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10, $x11
; CHECK-LABEL: name: sextload_i16_i32
; CHECK: liveins: $x10, $x11
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
; CHECK-NEXT: [[LH:%[0-9]+]]:gpr = LH [[COPY]], 0 :: (load (s16))
; CHECK-NEXT: [[ADDW:%[0-9]+]]:gpr = ADDW [[LH]], [[COPY1]]
; CHECK-NEXT: $x10 = COPY [[ADDW]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%2:gprb(s64) = COPY $x11
%9:gprb(s32) = G_SEXTLOAD %0(p0) :: (load (s16))
%7:gprb(s32) = G_TRUNC %2(s64)
%8:gprb(s32) = G_ADD %9, %7
%5:gprb(s64) = G_ANYEXT %8(s32)
$x10 = COPY %5(s64)
PseudoRET implicit $x10
...
---
name: load_fi_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
stack:
- { id: 0, name: ptr0, offset: 0, size: 8, alignment: 8 }
body: |
bb.0:
; CHECK-LABEL: name: load_fi_i64
; CHECK: [[LD:%[0-9]+]]:gpr = LD %stack.0.ptr0, 0 :: (load (s64))
; CHECK-NEXT: $x10 = COPY [[LD]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = G_FRAME_INDEX %stack.0.ptr0
%1:gprb(s64) = G_LOAD %0(p0) :: (load (s64))
$x10 = COPY %1(s64)
PseudoRET implicit $x10
...
---
name: load_fi_gep_i64_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
stack:
- { id: 0, name: ptr0, offset: 0, size: 16, alignment: 8 }
body: |
bb.0:
; CHECK-LABEL: name: load_fi_gep_i64_i64
; CHECK: [[LD:%[0-9]+]]:gpr = LD %stack.0.ptr0, 8 :: (load (s64))
; CHECK-NEXT: $x10 = COPY [[LD]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = G_FRAME_INDEX %stack.0.ptr0
%1:gprb(s64) = G_CONSTANT i64 8
%2:gprb(p0) = G_PTR_ADD %0(p0), %1(s64)
%3:gprb(s64) = G_LOAD %2(p0) :: (load (s64))
$x10 = COPY %3(s64)
PseudoRET implicit $x10
...
---
name: load_gep_i64_i64
legalized: true
regBankSelected: true
tracksRegLiveness: true
body: |
bb.0:
liveins: $x10
; CHECK-LABEL: name: load_gep_i64_i64
; CHECK: liveins: $x10
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
; CHECK-NEXT: [[LD:%[0-9]+]]:gpr = LD [[COPY]], 8 :: (load (s64))
; CHECK-NEXT: $x10 = COPY [[LD]]
; CHECK-NEXT: PseudoRET implicit $x10
%0:gprb(p0) = COPY $x10
%1:gprb(s64) = G_CONSTANT i64 8
%2:gprb(p0) = G_PTR_ADD %0(p0), %1(s64)
%3:gprb(s64) = G_LOAD %2(p0) :: (load (s64))
$x10 = COPY %3(s64)
PseudoRET implicit $x10
...