1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -mattr=+m -run-pass=instruction-select -simplify-mir -verify-machineinstrs %s -o - \
3 # RUN: | FileCheck -check-prefix=RV64I %s
9 tracksRegLiveness: true
14 ; RV64I-LABEL: name: mul_i32
15 ; RV64I: liveins: $x10, $x11
17 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
18 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
19 ; RV64I-NEXT: [[MULW:%[0-9]+]]:gpr = MULW [[COPY]], [[COPY1]]
20 ; RV64I-NEXT: $x10 = COPY [[MULW]]
21 ; RV64I-NEXT: PseudoRET implicit $x10
22 %0:gprb(s64) = COPY $x10
23 %1:gprb(s32) = G_TRUNC %0(s64)
24 %2:gprb(s64) = COPY $x11
25 %3:gprb(s32) = G_TRUNC %2(s64)
26 %4:gprb(s32) = G_MUL %1, %3
27 %5:gprb(s64) = G_ANYEXT %4(s32)
29 PseudoRET implicit $x10
36 tracksRegLiveness: true
41 ; RV64I-LABEL: name: sdiv_i32
42 ; RV64I: liveins: $x10, $x11
44 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
45 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
46 ; RV64I-NEXT: [[DIVW:%[0-9]+]]:gpr = DIVW [[COPY]], [[COPY1]]
47 ; RV64I-NEXT: $x10 = COPY [[DIVW]]
48 ; RV64I-NEXT: PseudoRET implicit $x10
49 %0:gprb(s64) = COPY $x10
50 %1:gprb(s32) = G_TRUNC %0(s64)
51 %2:gprb(s64) = COPY $x11
52 %3:gprb(s32) = G_TRUNC %2(s64)
53 %4:gprb(s32) = G_SDIV %1, %3
54 %5:gprb(s64) = G_ANYEXT %4(s32)
56 PseudoRET implicit $x10
63 tracksRegLiveness: true
68 ; RV64I-LABEL: name: srem_i32
69 ; RV64I: liveins: $x10, $x11
71 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
72 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
73 ; RV64I-NEXT: [[REMW:%[0-9]+]]:gpr = REMW [[COPY]], [[COPY1]]
74 ; RV64I-NEXT: $x10 = COPY [[REMW]]
75 ; RV64I-NEXT: PseudoRET implicit $x10
76 %0:gprb(s64) = COPY $x10
77 %1:gprb(s32) = G_TRUNC %0(s64)
78 %2:gprb(s64) = COPY $x11
79 %3:gprb(s32) = G_TRUNC %2(s64)
80 %4:gprb(s32) = G_SREM %1, %3
81 %5:gprb(s64) = G_ANYEXT %4(s32)
83 PseudoRET implicit $x10
90 tracksRegLiveness: true
95 ; RV64I-LABEL: name: udiv_i32
96 ; RV64I: liveins: $x10, $x11
98 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
99 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
100 ; RV64I-NEXT: [[DIVUW:%[0-9]+]]:gpr = DIVUW [[COPY]], [[COPY1]]
101 ; RV64I-NEXT: $x10 = COPY [[DIVUW]]
102 ; RV64I-NEXT: PseudoRET implicit $x10
103 %0:gprb(s64) = COPY $x10
104 %1:gprb(s32) = G_TRUNC %0(s64)
105 %2:gprb(s64) = COPY $x11
106 %3:gprb(s32) = G_TRUNC %2(s64)
107 %4:gprb(s32) = G_UDIV %1, %3
108 %5:gprb(s64) = G_ANYEXT %4(s32)
110 PseudoRET implicit $x10
116 regBankSelected: true
117 tracksRegLiveness: true
122 ; RV64I-LABEL: name: urem_i32
123 ; RV64I: liveins: $x10, $x11
125 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
126 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
127 ; RV64I-NEXT: [[REMUW:%[0-9]+]]:gpr = REMUW [[COPY]], [[COPY1]]
128 ; RV64I-NEXT: $x10 = COPY [[REMUW]]
129 ; RV64I-NEXT: PseudoRET implicit $x10
130 %0:gprb(s64) = COPY $x10
131 %1:gprb(s32) = G_TRUNC %0(s64)
132 %2:gprb(s64) = COPY $x11
133 %3:gprb(s32) = G_TRUNC %2(s64)
134 %4:gprb(s32) = G_UREM %1, %3
135 %5:gprb(s64) = G_ANYEXT %4(s32)
137 PseudoRET implicit $x10
143 regBankSelected: true
144 tracksRegLiveness: true
149 ; RV64I-LABEL: name: mul_i64
150 ; RV64I: liveins: $x10, $x11
152 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
153 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
154 ; RV64I-NEXT: [[MUL:%[0-9]+]]:gpr = MUL [[COPY]], [[COPY1]]
155 ; RV64I-NEXT: $x10 = COPY [[MUL]]
156 ; RV64I-NEXT: PseudoRET implicit $x10
157 %0:gprb(s64) = COPY $x10
158 %1:gprb(s64) = COPY $x11
159 %2:gprb(s64) = G_MUL %0, %1
161 PseudoRET implicit $x10
167 regBankSelected: true
168 tracksRegLiveness: true
173 ; RV64I-LABEL: name: sdiv_i64
174 ; RV64I: liveins: $x10, $x11
176 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
177 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
178 ; RV64I-NEXT: [[DIV:%[0-9]+]]:gpr = DIV [[COPY]], [[COPY1]]
179 ; RV64I-NEXT: $x10 = COPY [[DIV]]
180 ; RV64I-NEXT: PseudoRET implicit $x10
181 %0:gprb(s64) = COPY $x10
182 %1:gprb(s64) = COPY $x11
183 %2:gprb(s64) = G_SDIV %0, %1
185 PseudoRET implicit $x10
191 regBankSelected: true
192 tracksRegLiveness: true
197 ; RV64I-LABEL: name: srem_i64
198 ; RV64I: liveins: $x10, $x11
200 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
201 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
202 ; RV64I-NEXT: [[REM:%[0-9]+]]:gpr = REM [[COPY]], [[COPY1]]
203 ; RV64I-NEXT: $x10 = COPY [[REM]]
204 ; RV64I-NEXT: PseudoRET implicit $x10
205 %0:gprb(s64) = COPY $x10
206 %1:gprb(s64) = COPY $x11
207 %2:gprb(s64) = G_SREM %0, %1
209 PseudoRET implicit $x10
215 regBankSelected: true
216 tracksRegLiveness: true
221 ; RV64I-LABEL: name: smulh_i64
222 ; RV64I: liveins: $x10, $x11
224 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
225 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
226 ; RV64I-NEXT: [[MULH:%[0-9]+]]:gpr = MULH [[COPY]], [[COPY1]]
227 ; RV64I-NEXT: $x10 = COPY [[MULH]]
228 ; RV64I-NEXT: PseudoRET implicit $x10
229 %0:gprb(s64) = COPY $x10
230 %1:gprb(s64) = COPY $x11
231 %2:gprb(s64) = G_SMULH %0, %1
233 PseudoRET implicit $x10
239 regBankSelected: true
240 tracksRegLiveness: true
245 ; RV64I-LABEL: name: udiv_i64
246 ; RV64I: liveins: $x10, $x11
248 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
249 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
250 ; RV64I-NEXT: [[DIVU:%[0-9]+]]:gpr = DIVU [[COPY]], [[COPY1]]
251 ; RV64I-NEXT: $x10 = COPY [[DIVU]]
252 ; RV64I-NEXT: PseudoRET implicit $x10
253 %0:gprb(s64) = COPY $x10
254 %1:gprb(s64) = COPY $x11
255 %2:gprb(s64) = G_UDIV %0, %1
257 PseudoRET implicit $x10
263 regBankSelected: true
264 tracksRegLiveness: true
269 ; RV64I-LABEL: name: urem_i64
270 ; RV64I: liveins: $x10, $x11
272 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
273 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
274 ; RV64I-NEXT: [[REMU:%[0-9]+]]:gpr = REMU [[COPY]], [[COPY1]]
275 ; RV64I-NEXT: $x10 = COPY [[REMU]]
276 ; RV64I-NEXT: PseudoRET implicit $x10
277 %0:gprb(s64) = COPY $x10
278 %1:gprb(s64) = COPY $x11
279 %2:gprb(s64) = G_UREM %0, %1
281 PseudoRET implicit $x10
287 regBankSelected: true
288 tracksRegLiveness: true
291 liveins: $x10, $x11, $x12, $x13
293 ; RV64I-LABEL: name: mul_i128
294 ; RV64I: liveins: $x10, $x11, $x12, $x13
296 ; RV64I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
297 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
298 ; RV64I-NEXT: [[COPY2:%[0-9]+]]:gpr = COPY $x12
299 ; RV64I-NEXT: [[COPY3:%[0-9]+]]:gpr = COPY $x13
300 ; RV64I-NEXT: [[MUL:%[0-9]+]]:gpr = MUL [[COPY]], [[COPY2]]
301 ; RV64I-NEXT: [[MUL1:%[0-9]+]]:gpr = MUL [[COPY1]], [[COPY2]]
302 ; RV64I-NEXT: [[MUL2:%[0-9]+]]:gpr = MUL [[COPY]], [[COPY3]]
303 ; RV64I-NEXT: [[MULHU:%[0-9]+]]:gpr = MULHU [[COPY]], [[COPY2]]
304 ; RV64I-NEXT: [[ADD:%[0-9]+]]:gpr = ADD [[MUL1]], [[MUL2]]
305 ; RV64I-NEXT: [[ADD1:%[0-9]+]]:gpr = ADD [[ADD]], [[MULHU]]
306 ; RV64I-NEXT: $x10 = COPY [[MUL]]
307 ; RV64I-NEXT: $x11 = COPY [[ADD1]]
308 ; RV64I-NEXT: PseudoRET implicit $x10, implicit $x11
309 %0:gprb(s64) = COPY $x10
310 %1:gprb(s64) = COPY $x11
311 %2:gprb(s64) = COPY $x12
312 %3:gprb(s64) = COPY $x13
313 %4:gprb(s64) = G_MUL %0, %2
314 %5:gprb(s64) = G_MUL %1, %2
315 %6:gprb(s64) = G_MUL %0, %3
316 %7:gprb(s64) = G_UMULH %0, %2
317 %8:gprb(s64) = G_ADD %5, %6
318 %9:gprb(s64) = G_ADD %8, %7
321 PseudoRET implicit $x10, implicit $x11