1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -run-pass=instruction-select %s -o - \
6 define void @load_i8(ptr %addr) { ret void }
7 define void @load_i16(ptr %addr) { ret void }
8 define void @load_i32(ptr %addr) { ret void }
9 define void @zextload_i8(ptr %addr) { ret void }
10 define void @zextload_i16(ptr %addr) { ret void }
11 define void @sextload_i8(ptr %addr) { ret void }
12 define void @sextload_i16(ptr %addr) { ret void }
13 define void @load_p0(ptr %addr) { ret void }
14 define void @load_fi_i32() {
18 define void @load_fi_gep_i32() {
19 %ptr0 = alloca [2 x i32]
22 define void @load_gep_i32(ptr %addr) { ret void }
28 tracksRegLiveness: true
33 ; CHECK-LABEL: name: load_i8
34 ; CHECK: liveins: $x10
36 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
37 ; CHECK-NEXT: [[LBU:%[0-9]+]]:gpr = LBU [[COPY]], 0 :: (load (s8))
38 ; CHECK-NEXT: $x10 = COPY [[LBU]]
39 ; CHECK-NEXT: PseudoRET implicit $x10
40 %0:gprb(p0) = COPY $x10
41 %1:gprb(s32) = G_LOAD %0(p0) :: (load (s8))
43 PseudoRET implicit $x10
50 tracksRegLiveness: true
55 ; CHECK-LABEL: name: load_i16
56 ; CHECK: liveins: $x10
58 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
59 ; CHECK-NEXT: [[LH:%[0-9]+]]:gpr = LH [[COPY]], 0 :: (load (s16))
60 ; CHECK-NEXT: $x10 = COPY [[LH]]
61 ; CHECK-NEXT: PseudoRET implicit $x10
62 %0:gprb(p0) = COPY $x10
63 %1:gprb(s32) = G_LOAD %0(p0) :: (load (s16))
65 PseudoRET implicit $x10
72 tracksRegLiveness: true
77 ; CHECK-LABEL: name: load_i32
78 ; CHECK: liveins: $x10
80 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
81 ; CHECK-NEXT: [[LW:%[0-9]+]]:gpr = LW [[COPY]], 0 :: (load (s32))
82 ; CHECK-NEXT: $x10 = COPY [[LW]]
83 ; CHECK-NEXT: PseudoRET implicit $x10
84 %0:gprb(p0) = COPY $x10
85 %1:gprb(s32) = G_LOAD %0(p0) :: (load (s32))
87 PseudoRET implicit $x10
94 tracksRegLiveness: true
99 ; CHECK-LABEL: name: zextload_i8
100 ; CHECK: liveins: $x10
102 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
103 ; CHECK-NEXT: [[LBU:%[0-9]+]]:gpr = LBU [[COPY]], 0 :: (load (s8))
104 ; CHECK-NEXT: $x10 = COPY [[LBU]]
105 ; CHECK-NEXT: PseudoRET implicit $x10
106 %0:gprb(p0) = COPY $x10
107 %1:gprb(s32) = G_ZEXTLOAD %0(p0) :: (load (s8))
109 PseudoRET implicit $x10
115 regBankSelected: true
116 tracksRegLiveness: true
121 ; CHECK-LABEL: name: zextload_i16
122 ; CHECK: liveins: $x10
124 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
125 ; CHECK-NEXT: [[LHU:%[0-9]+]]:gpr = LHU [[COPY]], 0 :: (load (s16))
126 ; CHECK-NEXT: $x10 = COPY [[LHU]]
127 ; CHECK-NEXT: PseudoRET implicit $x10
128 %0:gprb(p0) = COPY $x10
129 %1:gprb(s32) = G_ZEXTLOAD %0(p0) :: (load (s16))
131 PseudoRET implicit $x10
137 regBankSelected: true
138 tracksRegLiveness: true
143 ; CHECK-LABEL: name: sextload_i8
144 ; CHECK: liveins: $x10
146 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
147 ; CHECK-NEXT: [[LB:%[0-9]+]]:gpr = LB [[COPY]], 0 :: (load (s8))
148 ; CHECK-NEXT: $x10 = COPY [[LB]]
149 ; CHECK-NEXT: PseudoRET implicit $x10
150 %0:gprb(p0) = COPY $x10
151 %1:gprb(s32) = G_SEXTLOAD %0(p0) :: (load (s8))
153 PseudoRET implicit $x10
159 regBankSelected: true
160 tracksRegLiveness: true
165 ; CHECK-LABEL: name: sextload_i16
166 ; CHECK: liveins: $x10
168 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
169 ; CHECK-NEXT: [[LH:%[0-9]+]]:gpr = LH [[COPY]], 0 :: (load (s16))
170 ; CHECK-NEXT: $x10 = COPY [[LH]]
171 ; CHECK-NEXT: PseudoRET implicit $x10
172 %0:gprb(p0) = COPY $x10
173 %1:gprb(s32) = G_SEXTLOAD %0(p0) :: (load (s16))
175 PseudoRET implicit $x10
181 regBankSelected: true
182 tracksRegLiveness: true
187 ; CHECK-LABEL: name: load_p0
188 ; CHECK: liveins: $x10
190 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
191 ; CHECK-NEXT: [[LW:%[0-9]+]]:gpr = LW [[COPY]], 0 :: (load (p0))
192 ; CHECK-NEXT: $x10 = COPY [[LW]]
193 ; CHECK-NEXT: PseudoRET implicit $x10
194 %0:gprb(p0) = COPY $x10
195 %1:gprb(p0) = G_LOAD %0(p0) :: (load (p0))
197 PseudoRET implicit $x10
203 regBankSelected: true
204 tracksRegLiveness: true
207 - { id: 0, name: ptr0, offset: 0, size: 4, alignment: 4 }
211 ; CHECK-LABEL: name: load_fi_i32
212 ; CHECK: [[LW:%[0-9]+]]:gpr = LW %stack.0.ptr0, 0 :: (load (s32))
213 ; CHECK-NEXT: $x10 = COPY [[LW]]
214 ; CHECK-NEXT: PseudoRET implicit $x10
215 %0:gprb(p0) = G_FRAME_INDEX %stack.0.ptr0
216 %1:gprb(s32) = G_LOAD %0(p0) :: (load (s32))
218 PseudoRET implicit $x10
222 name: load_fi_gep_i32
224 regBankSelected: true
225 tracksRegLiveness: true
228 - { id: 0, name: ptr0, offset: 0, size: 8, alignment: 4 }
232 ; CHECK-LABEL: name: load_fi_gep_i32
233 ; CHECK: [[LW:%[0-9]+]]:gpr = LW %stack.0.ptr0, 4 :: (load (s32))
234 ; CHECK-NEXT: $x10 = COPY [[LW]]
235 ; CHECK-NEXT: PseudoRET implicit $x10
236 %0:gprb(p0) = G_FRAME_INDEX %stack.0.ptr0
237 %1:gprb(s32) = G_CONSTANT i32 4
238 %2:gprb(p0) = G_PTR_ADD %0(p0), %1(s32)
239 %3:gprb(s32) = G_LOAD %2(p0) :: (load (s32))
241 PseudoRET implicit $x10
247 regBankSelected: true
248 tracksRegLiveness: true
253 ; CHECK-LABEL: name: load_gep_i32
254 ; CHECK: liveins: $x10
256 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
257 ; CHECK-NEXT: [[LW:%[0-9]+]]:gpr = LW [[COPY]], 4 :: (load (s32))
258 ; CHECK-NEXT: $x10 = COPY [[LW]]
259 ; CHECK-NEXT: PseudoRET implicit $x10
260 %0:gprb(p0) = COPY $x10
261 %1:gprb(s32) = G_CONSTANT i32 4
262 %2:gprb(p0) = G_PTR_ADD %0(p0), %1(s32)
263 %3:gprb(s32) = G_LOAD %2(p0) :: (load (s32))
265 PseudoRET implicit $x10