1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -mattr=+m -run-pass=instruction-select -simplify-mir -verify-machineinstrs %s -o - \
3 # RUN: | FileCheck -check-prefix=RV32I %s
9 tracksRegLiveness: true
14 ; RV32I-LABEL: name: mul_i32
15 ; RV32I: liveins: $x10, $x11
17 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
18 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
19 ; RV32I-NEXT: [[MUL:%[0-9]+]]:gpr = MUL [[COPY]], [[COPY1]]
20 ; RV32I-NEXT: $x10 = COPY [[MUL]]
21 ; RV32I-NEXT: PseudoRET implicit $x10
22 %0:gprb(s32) = COPY $x10
23 %1:gprb(s32) = COPY $x11
24 %2:gprb(s32) = G_MUL %0, %1
26 PseudoRET implicit $x10
33 tracksRegLiveness: true
38 ; RV32I-LABEL: name: sdiv_i32
39 ; RV32I: liveins: $x10, $x11
41 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
42 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
43 ; RV32I-NEXT: [[DIV:%[0-9]+]]:gpr = DIV [[COPY]], [[COPY1]]
44 ; RV32I-NEXT: $x10 = COPY [[DIV]]
45 ; RV32I-NEXT: PseudoRET implicit $x10
46 %0:gprb(s32) = COPY $x10
47 %1:gprb(s32) = COPY $x11
48 %2:gprb(s32) = G_SDIV %0, %1
50 PseudoRET implicit $x10
57 tracksRegLiveness: true
62 ; RV32I-LABEL: name: srem_i32
63 ; RV32I: liveins: $x10, $x11
65 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
66 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
67 ; RV32I-NEXT: [[REM:%[0-9]+]]:gpr = REM [[COPY]], [[COPY1]]
68 ; RV32I-NEXT: $x10 = COPY [[REM]]
69 ; RV32I-NEXT: PseudoRET implicit $x10
70 %0:gprb(s32) = COPY $x10
71 %1:gprb(s32) = COPY $x11
72 %2:gprb(s32) = G_SREM %0, %1
74 PseudoRET implicit $x10
81 tracksRegLiveness: true
86 ; RV32I-LABEL: name: smulh_i32
87 ; RV32I: liveins: $x10, $x11
89 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
90 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
91 ; RV32I-NEXT: [[MULH:%[0-9]+]]:gpr = MULH [[COPY]], [[COPY1]]
92 ; RV32I-NEXT: $x10 = COPY [[MULH]]
93 ; RV32I-NEXT: PseudoRET implicit $x10
94 %0:gprb(s32) = COPY $x10
95 %1:gprb(s32) = COPY $x11
96 %2:gprb(s32) = G_SMULH %0, %1
98 PseudoRET implicit $x10
104 regBankSelected: true
105 tracksRegLiveness: true
110 ; RV32I-LABEL: name: udiv_i32
111 ; RV32I: liveins: $x10, $x11
113 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
114 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
115 ; RV32I-NEXT: [[DIVU:%[0-9]+]]:gpr = DIVU [[COPY]], [[COPY1]]
116 ; RV32I-NEXT: $x10 = COPY [[DIVU]]
117 ; RV32I-NEXT: PseudoRET implicit $x10
118 %0:gprb(s32) = COPY $x10
119 %1:gprb(s32) = COPY $x11
120 %2:gprb(s32) = G_UDIV %0, %1
122 PseudoRET implicit $x10
128 regBankSelected: true
129 tracksRegLiveness: true
134 ; RV32I-LABEL: name: urem_i32
135 ; RV32I: liveins: $x10, $x11
137 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
138 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
139 ; RV32I-NEXT: [[REMU:%[0-9]+]]:gpr = REMU [[COPY]], [[COPY1]]
140 ; RV32I-NEXT: $x10 = COPY [[REMU]]
141 ; RV32I-NEXT: PseudoRET implicit $x10
142 %0:gprb(s32) = COPY $x10
143 %1:gprb(s32) = COPY $x11
144 %2:gprb(s32) = G_UREM %0, %1
146 PseudoRET implicit $x10
152 regBankSelected: true
153 tracksRegLiveness: true
156 liveins: $x10, $x11, $x12, $x13
158 ; RV32I-LABEL: name: mul_i64
159 ; RV32I: liveins: $x10, $x11, $x12, $x13
161 ; RV32I-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x10
162 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11
163 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:gpr = COPY $x12
164 ; RV32I-NEXT: [[COPY3:%[0-9]+]]:gpr = COPY $x13
165 ; RV32I-NEXT: [[MUL:%[0-9]+]]:gpr = MUL [[COPY]], [[COPY2]]
166 ; RV32I-NEXT: [[MUL1:%[0-9]+]]:gpr = MUL [[COPY1]], [[COPY2]]
167 ; RV32I-NEXT: [[MUL2:%[0-9]+]]:gpr = MUL [[COPY]], [[COPY3]]
168 ; RV32I-NEXT: [[MULHU:%[0-9]+]]:gpr = MULHU [[COPY]], [[COPY2]]
169 ; RV32I-NEXT: [[ADD:%[0-9]+]]:gpr = ADD [[MUL1]], [[MUL2]]
170 ; RV32I-NEXT: [[ADD1:%[0-9]+]]:gpr = ADD [[ADD]], [[MULHU]]
171 ; RV32I-NEXT: $x10 = COPY [[MUL]]
172 ; RV32I-NEXT: $x11 = COPY [[ADD1]]
173 ; RV32I-NEXT: PseudoRET implicit $x10, implicit $x11
174 %0:gprb(s32) = COPY $x10
175 %1:gprb(s32) = COPY $x11
176 %2:gprb(s32) = COPY $x12
177 %3:gprb(s32) = COPY $x13
178 %4:gprb(s32) = G_MUL %0, %2
179 %5:gprb(s32) = G_MUL %1, %2
180 %6:gprb(s32) = G_MUL %0, %3
181 %7:gprb(s32) = G_UMULH %0, %2
182 %8:gprb(s32) = G_ADD %5, %6
183 %9:gprb(s32) = G_ADD %8, %7
186 PseudoRET implicit $x10, implicit $x11