Debian Codegraph @

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-div-rv64.mir

raw
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \
3 # RUN: | FileCheck %s -check-prefix=CHECK-I
4 # RUN: llc -mattr=+m -mtriple=riscv64 -run-pass=legalizer %s -o - \
5 # RUN: | FileCheck %s -check-prefix=CHECK-M
6 ---
7 name: sdiv_i8
8 body: |
9 bb.0.entry:
10 ; CHECK-I-LABEL: name: sdiv_i8
11 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
12 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
13 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
14 ; CHECK-I-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C]](s64)
15 ; CHECK-I-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
16 ; CHECK-I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
17 ; CHECK-I-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[COPY1]], [[C1]](s64)
18 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C1]](s64)
19 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
20 ; CHECK-I-NEXT: $x10 = COPY [[ASHR]](s64)
21 ; CHECK-I-NEXT: $x11 = COPY [[ASHR1]](s64)
22 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__divdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
23 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
24 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
25 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
26 ; CHECK-I-NEXT: PseudoRET implicit $x10
27 ;
28 ; CHECK-M-LABEL: name: sdiv_i8
29 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
30 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
31 ; CHECK-M-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
32 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
33 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[TRUNC]], [[C]](s64)
34 ; CHECK-M-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
35 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C1]](s64)
36 ; CHECK-M-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
37 ; CHECK-M-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
38 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[TRUNC1]], [[C2]](s64)
39 ; CHECK-M-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
40 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C3]](s64)
41 ; CHECK-M-NEXT: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[ASHR]], [[ASHR1]]
42 ; CHECK-M-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SDIV]](s32)
43 ; CHECK-M-NEXT: $x10 = COPY [[ANYEXT]](s64)
44 ; CHECK-M-NEXT: PseudoRET implicit $x10
45 %0:_(s64) = COPY $x10
46 %1:_(s64) = COPY $x11
47 %2:_(s8) = G_TRUNC %0(s64)
48 %3:_(s8) = G_TRUNC %1(s64)
49 %4:_(s8) = G_SDIV %2, %3
50 %5:_(s64) = G_ANYEXT %4(s8)
51 $x10 = COPY %5(s64)
52 PseudoRET implicit $x10
53
54 ...
55 ---
56 name: sdiv_i15
57 body: |
58 bb.0.entry:
59 ; CHECK-I-LABEL: name: sdiv_i15
60 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
61 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
62 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 49
63 ; CHECK-I-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C]](s64)
64 ; CHECK-I-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
65 ; CHECK-I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 49
66 ; CHECK-I-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[COPY1]], [[C1]](s64)
67 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C1]](s64)
68 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
69 ; CHECK-I-NEXT: $x10 = COPY [[ASHR]](s64)
70 ; CHECK-I-NEXT: $x11 = COPY [[ASHR1]](s64)
71 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__divdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
72 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
73 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
74 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
75 ; CHECK-I-NEXT: PseudoRET implicit $x10
76 ;
77 ; CHECK-M-LABEL: name: sdiv_i15
78 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
79 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
80 ; CHECK-M-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
81 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 17
82 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[TRUNC]], [[C]](s64)
83 ; CHECK-M-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 17
84 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C1]](s64)
85 ; CHECK-M-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
86 ; CHECK-M-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 17
87 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[TRUNC1]], [[C2]](s64)
88 ; CHECK-M-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 17
89 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C3]](s64)
90 ; CHECK-M-NEXT: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[ASHR]], [[ASHR1]]
91 ; CHECK-M-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SDIV]](s32)
92 ; CHECK-M-NEXT: $x10 = COPY [[ANYEXT]](s64)
93 ; CHECK-M-NEXT: PseudoRET implicit $x10
94 %0:_(s64) = COPY $x10
95 %1:_(s64) = COPY $x11
96 %2:_(s15) = G_TRUNC %0(s64)
97 %3:_(s15) = G_TRUNC %1(s64)
98 %4:_(s15) = G_SDIV %2, %3
99 %5:_(s64) = G_ANYEXT %4(s15)
100 $x10 = COPY %5(s64)
101 PseudoRET implicit $x10
102
103 ...
104 ---
105 name: sdiv_i16
106 body: |
107 bb.0.entry:
108 ; CHECK-I-LABEL: name: sdiv_i16
109 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
110 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
111 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 48
112 ; CHECK-I-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C]](s64)
113 ; CHECK-I-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
114 ; CHECK-I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 48
115 ; CHECK-I-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[COPY1]], [[C1]](s64)
116 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C1]](s64)
117 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
118 ; CHECK-I-NEXT: $x10 = COPY [[ASHR]](s64)
119 ; CHECK-I-NEXT: $x11 = COPY [[ASHR1]](s64)
120 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__divdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
121 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
122 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
123 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
124 ; CHECK-I-NEXT: PseudoRET implicit $x10
125 ;
126 ; CHECK-M-LABEL: name: sdiv_i16
127 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
128 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
129 ; CHECK-M-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
130 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
131 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[TRUNC]], [[C]](s64)
132 ; CHECK-M-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
133 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C1]](s64)
134 ; CHECK-M-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
135 ; CHECK-M-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
136 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[TRUNC1]], [[C2]](s64)
137 ; CHECK-M-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
138 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C3]](s64)
139 ; CHECK-M-NEXT: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[ASHR]], [[ASHR1]]
140 ; CHECK-M-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SDIV]](s32)
141 ; CHECK-M-NEXT: $x10 = COPY [[ANYEXT]](s64)
142 ; CHECK-M-NEXT: PseudoRET implicit $x10
143 %0:_(s64) = COPY $x10
144 %1:_(s64) = COPY $x11
145 %2:_(s16) = G_TRUNC %0(s64)
146 %3:_(s16) = G_TRUNC %1(s64)
147 %4:_(s16) = G_SDIV %2, %3
148 %5:_(s64) = G_ANYEXT %4(s16)
149 $x10 = COPY %5(s64)
150 PseudoRET implicit $x10
151
152 ...
153 ---
154 name: sdiv_i32
155 body: |
156 bb.0.entry:
157 ; CHECK-I-LABEL: name: sdiv_i32
158 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
159 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
160 ; CHECK-I-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32
161 ; CHECK-I-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32
162 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
163 ; CHECK-I-NEXT: $x10 = COPY [[SEXT_INREG]](s64)
164 ; CHECK-I-NEXT: $x11 = COPY [[SEXT_INREG1]](s64)
165 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__divdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
166 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
167 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
168 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
169 ; CHECK-I-NEXT: PseudoRET implicit $x10
170 ;
171 ; CHECK-M-LABEL: name: sdiv_i32
172 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
173 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
174 ; CHECK-M-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
175 ; CHECK-M-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
176 ; CHECK-M-NEXT: [[SDIV:%[0-9]+]]:_(s32) = G_SDIV [[TRUNC]], [[TRUNC1]]
177 ; CHECK-M-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SDIV]](s32)
178 ; CHECK-M-NEXT: $x10 = COPY [[ANYEXT]](s64)
179 ; CHECK-M-NEXT: PseudoRET implicit $x10
180 %0:_(s64) = COPY $x10
181 %1:_(s64) = COPY $x11
182 %2:_(s32) = G_TRUNC %0(s64)
183 %3:_(s32) = G_TRUNC %1(s64)
184 %4:_(s32) = G_SDIV %2, %3
185 %5:_(s64) = G_ANYEXT %4(s32)
186 $x10 = COPY %5(s64)
187 PseudoRET implicit $x10
188
189 ...
190 ---
191 name: sdiv_i64
192 body: |
193 bb.0.entry:
194 ; CHECK-I-LABEL: name: sdiv_i64
195 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
196 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
197 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
198 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
199 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
200 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__divdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
201 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
202 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
203 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
204 ; CHECK-I-NEXT: PseudoRET implicit $x10
205 ;
206 ; CHECK-M-LABEL: name: sdiv_i64
207 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
208 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
209 ; CHECK-M-NEXT: [[SDIV:%[0-9]+]]:_(s64) = G_SDIV [[COPY]], [[COPY1]]
210 ; CHECK-M-NEXT: $x10 = COPY [[SDIV]](s64)
211 ; CHECK-M-NEXT: PseudoRET implicit $x10
212 %0:_(s64) = COPY $x10
213 %1:_(s64) = COPY $x11
214 %2:_(s64) = G_SDIV %0, %1
215 $x10 = COPY %2(s64)
216 PseudoRET implicit $x10
217
218 ...
219 ---
220 name: sdiv_i72
221 body: |
222 bb.0.entry:
223 ; CHECK-I-LABEL: name: sdiv_i72
224 ; CHECK-I: %xlo:_(s64) = COPY $x10
225 ; CHECK-I-NEXT: %xhi:_(s64) = COPY $x11
226 ; CHECK-I-NEXT: %ylo:_(s64) = COPY $x12
227 ; CHECK-I-NEXT: %yhi:_(s64) = COPY $x13
228 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
229 ; CHECK-I-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL %xhi, [[C]](s64)
230 ; CHECK-I-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
231 ; CHECK-I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
232 ; CHECK-I-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL %yhi, [[C1]](s64)
233 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C1]](s64)
234 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
235 ; CHECK-I-NEXT: $x10 = COPY %xlo(s64)
236 ; CHECK-I-NEXT: $x11 = COPY [[ASHR]](s64)
237 ; CHECK-I-NEXT: $x12 = COPY %ylo(s64)
238 ; CHECK-I-NEXT: $x13 = COPY [[ASHR1]](s64)
239 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__divti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
240 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
241 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
242 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
243 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
244 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
245 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
246 ;
247 ; CHECK-M-LABEL: name: sdiv_i72
248 ; CHECK-M: %xlo:_(s64) = COPY $x10
249 ; CHECK-M-NEXT: %xhi:_(s64) = COPY $x11
250 ; CHECK-M-NEXT: %ylo:_(s64) = COPY $x12
251 ; CHECK-M-NEXT: %yhi:_(s64) = COPY $x13
252 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
253 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL %xhi, [[C]](s64)
254 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
255 ; CHECK-M-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
256 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL %yhi, [[C1]](s64)
257 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C1]](s64)
258 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
259 ; CHECK-M-NEXT: $x10 = COPY %xlo(s64)
260 ; CHECK-M-NEXT: $x11 = COPY [[ASHR]](s64)
261 ; CHECK-M-NEXT: $x12 = COPY %ylo(s64)
262 ; CHECK-M-NEXT: $x13 = COPY [[ASHR1]](s64)
263 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__divti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
264 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
265 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
266 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
267 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s64)
268 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s64)
269 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
270 %xlo:_(s64) = COPY $x10
271 %xhi:_(s64) = COPY $x11
272 %ylo:_(s64) = COPY $x12
273 %yhi:_(s64) = COPY $x13
274 %x0:_(s128) = G_MERGE_VALUES %xlo(s64), %xhi(s64)
275 %y0:_(s128) = G_MERGE_VALUES %ylo(s64), %yhi(s64)
276 %x:_(s72) = G_TRUNC %x0
277 %y:_(s72) = G_TRUNC %y0
278 %z:_(s72) = G_SDIV %x, %y
279 %z0:_(s128) = G_ANYEXT %z
280 %zlo:_(s64), %zhi:_(s64) = G_UNMERGE_VALUES %z0(s128)
281 $x10 = COPY %zlo(s64)
282 $x11 = COPY %zhi(s64)
283 PseudoRET implicit $x10, implicit $x11
284
285 ...
286 ---
287 name: sdiv_i128
288 body: |
289 bb.0.entry:
290 ; CHECK-I-LABEL: name: sdiv_i128
291 ; CHECK-I: %lo1:_(s64) = COPY $x10
292 ; CHECK-I-NEXT: %hi1:_(s64) = COPY $x11
293 ; CHECK-I-NEXT: %lo2:_(s64) = COPY $x12
294 ; CHECK-I-NEXT: %hi2:_(s64) = COPY $x13
295 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
296 ; CHECK-I-NEXT: $x10 = COPY %lo1(s64)
297 ; CHECK-I-NEXT: $x11 = COPY %hi1(s64)
298 ; CHECK-I-NEXT: $x12 = COPY %lo2(s64)
299 ; CHECK-I-NEXT: $x13 = COPY %hi2(s64)
300 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__divti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
301 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
302 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
303 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
304 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
305 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
306 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
307 ;
308 ; CHECK-M-LABEL: name: sdiv_i128
309 ; CHECK-M: %lo1:_(s64) = COPY $x10
310 ; CHECK-M-NEXT: %hi1:_(s64) = COPY $x11
311 ; CHECK-M-NEXT: %lo2:_(s64) = COPY $x12
312 ; CHECK-M-NEXT: %hi2:_(s64) = COPY $x13
313 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
314 ; CHECK-M-NEXT: $x10 = COPY %lo1(s64)
315 ; CHECK-M-NEXT: $x11 = COPY %hi1(s64)
316 ; CHECK-M-NEXT: $x12 = COPY %lo2(s64)
317 ; CHECK-M-NEXT: $x13 = COPY %hi2(s64)
318 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__divti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
319 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
320 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
321 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
322 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s64)
323 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s64)
324 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
325 %lo1:_(s64) = COPY $x10
326 %hi1:_(s64) = COPY $x11
327 %lo2:_(s64) = COPY $x12
328 %hi2:_(s64) = COPY $x13
329 %x1:_(s128) = G_MERGE_VALUES %lo1(s64), %hi1(s64)
330 %x2:_(s128) = G_MERGE_VALUES %lo2(s64), %hi2(s64)
331 %y:_(s128) = G_SDIV %x1, %x2
332 %loy:_(s64), %hiy:_(s64) = G_UNMERGE_VALUES %y(s128)
333 $x10 = COPY %loy(s64)
334 $x11 = COPY %hiy(s64)
335 PseudoRET implicit $x10, implicit $x11
336
337 ...
338 ---
339 name: udiv_i8
340 body: |
341 bb.0.entry:
342 ; CHECK-I-LABEL: name: udiv_i8
343 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
344 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
345 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
346 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
347 ; CHECK-I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
348 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]]
349 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
350 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s64)
351 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s64)
352 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__udivdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
353 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
354 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
355 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
356 ; CHECK-I-NEXT: PseudoRET implicit $x10
357 ;
358 ; CHECK-M-LABEL: name: udiv_i8
359 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
360 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
361 ; CHECK-M-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
362 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
363 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC]], [[C]]
364 ; CHECK-M-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
365 ; CHECK-M-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
366 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC1]], [[C1]]
367 ; CHECK-M-NEXT: [[UDIV:%[0-9]+]]:_(s32) = G_UDIV [[AND]], [[AND1]]
368 ; CHECK-M-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[UDIV]](s32)
369 ; CHECK-M-NEXT: $x10 = COPY [[ANYEXT]](s64)
370 ; CHECK-M-NEXT: PseudoRET implicit $x10
371 %0:_(s64) = COPY $x10
372 %1:_(s64) = COPY $x11
373 %2:_(s8) = G_TRUNC %0(s64)
374 %3:_(s8) = G_TRUNC %1(s64)
375 %4:_(s8) = G_UDIV %2, %3
376 %5:_(s64) = G_ANYEXT %4(s8)
377 $x10 = COPY %5(s64)
378 PseudoRET implicit $x10
379
380 ...
381 ---
382 name: udiv_i15
383 body: |
384 bb.0.entry:
385 ; CHECK-I-LABEL: name: udiv_i15
386 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
387 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
388 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767
389 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
390 ; CHECK-I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767
391 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]]
392 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
393 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s64)
394 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s64)
395 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__udivdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
396 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
397 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
398 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
399 ; CHECK-I-NEXT: PseudoRET implicit $x10
400 ;
401 ; CHECK-M-LABEL: name: udiv_i15
402 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
403 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
404 ; CHECK-M-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
405 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32767
406 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC]], [[C]]
407 ; CHECK-M-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
408 ; CHECK-M-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 32767
409 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC1]], [[C1]]
410 ; CHECK-M-NEXT: [[UDIV:%[0-9]+]]:_(s32) = G_UDIV [[AND]], [[AND1]]
411 ; CHECK-M-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[UDIV]](s32)
412 ; CHECK-M-NEXT: $x10 = COPY [[ANYEXT]](s64)
413 ; CHECK-M-NEXT: PseudoRET implicit $x10
414 %0:_(s64) = COPY $x10
415 %1:_(s64) = COPY $x11
416 %2:_(s15) = G_TRUNC %0(s64)
417 %3:_(s15) = G_TRUNC %1(s64)
418 %4:_(s15) = G_UDIV %2, %3
419 %5:_(s64) = G_ANYEXT %4(s15)
420 $x10 = COPY %5(s64)
421 PseudoRET implicit $x10
422
423 ...
424 ---
425 name: udiv_i16
426 body: |
427 bb.0.entry:
428 ; CHECK-I-LABEL: name: udiv_i16
429 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
430 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
431 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
432 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
433 ; CHECK-I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
434 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]]
435 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
436 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s64)
437 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s64)
438 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__udivdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
439 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
440 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
441 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
442 ; CHECK-I-NEXT: PseudoRET implicit $x10
443 ;
444 ; CHECK-M-LABEL: name: udiv_i16
445 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
446 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
447 ; CHECK-M-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
448 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
449 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC]], [[C]]
450 ; CHECK-M-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
451 ; CHECK-M-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
452 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC1]], [[C1]]
453 ; CHECK-M-NEXT: [[UDIV:%[0-9]+]]:_(s32) = G_UDIV [[AND]], [[AND1]]
454 ; CHECK-M-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[UDIV]](s32)
455 ; CHECK-M-NEXT: $x10 = COPY [[ANYEXT]](s64)
456 ; CHECK-M-NEXT: PseudoRET implicit $x10
457 %0:_(s64) = COPY $x10
458 %1:_(s64) = COPY $x11
459 %2:_(s16) = G_TRUNC %0(s64)
460 %3:_(s16) = G_TRUNC %1(s64)
461 %4:_(s16) = G_UDIV %2, %3
462 %5:_(s64) = G_ANYEXT %4(s16)
463 $x10 = COPY %5(s64)
464 PseudoRET implicit $x10
465
466 ...
467 ---
468 name: udiv_i32
469 body: |
470 bb.0.entry:
471 ; CHECK-I-LABEL: name: udiv_i32
472 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
473 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
474 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
475 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
476 ; CHECK-I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
477 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C1]]
478 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
479 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s64)
480 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s64)
481 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__udivdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
482 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
483 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
484 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
485 ; CHECK-I-NEXT: PseudoRET implicit $x10
486 ;
487 ; CHECK-M-LABEL: name: udiv_i32
488 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
489 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
490 ; CHECK-M-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
491 ; CHECK-M-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
492 ; CHECK-M-NEXT: [[UDIV:%[0-9]+]]:_(s32) = G_UDIV [[TRUNC]], [[TRUNC1]]
493 ; CHECK-M-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[UDIV]](s32)
494 ; CHECK-M-NEXT: $x10 = COPY [[ANYEXT]](s64)
495 ; CHECK-M-NEXT: PseudoRET implicit $x10
496 %0:_(s64) = COPY $x10
497 %1:_(s64) = COPY $x11
498 %2:_(s32) = G_TRUNC %0(s64)
499 %3:_(s32) = G_TRUNC %1(s64)
500 %4:_(s32) = G_UDIV %2, %3
501 %5:_(s64) = G_ANYEXT %4(s32)
502 $x10 = COPY %5(s64)
503 PseudoRET implicit $x10
504
505 ...
506 ---
507 name: udiv_i64
508 body: |
509 bb.0.entry:
510 ; CHECK-I-LABEL: name: udiv_i64
511 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
512 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
513 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
514 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
515 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
516 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__udivdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
517 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
518 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
519 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
520 ; CHECK-I-NEXT: PseudoRET implicit $x10
521 ;
522 ; CHECK-M-LABEL: name: udiv_i64
523 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
524 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
525 ; CHECK-M-NEXT: [[UDIV:%[0-9]+]]:_(s64) = G_UDIV [[COPY]], [[COPY1]]
526 ; CHECK-M-NEXT: $x10 = COPY [[UDIV]](s64)
527 ; CHECK-M-NEXT: PseudoRET implicit $x10
528 %0:_(s64) = COPY $x10
529 %1:_(s64) = COPY $x11
530 %2:_(s64) = G_UDIV %0, %1
531 $x10 = COPY %2(s64)
532 PseudoRET implicit $x10
533
534 ...
535 ---
536 name: udiv_i72
537 body: |
538 bb.0.entry:
539 ; CHECK-I-LABEL: name: udiv_i72
540 ; CHECK-I: %xlo:_(s64) = COPY $x10
541 ; CHECK-I-NEXT: %xhi:_(s64) = COPY $x11
542 ; CHECK-I-NEXT: %ylo:_(s64) = COPY $x12
543 ; CHECK-I-NEXT: %yhi:_(s64) = COPY $x13
544 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
545 ; CHECK-I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
546 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %xlo, [[C]]
547 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %xhi, [[C1]]
548 ; CHECK-I-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
549 ; CHECK-I-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
550 ; CHECK-I-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND %ylo, [[C2]]
551 ; CHECK-I-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND %yhi, [[C3]]
552 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
553 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s64)
554 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s64)
555 ; CHECK-I-NEXT: $x12 = COPY [[AND2]](s64)
556 ; CHECK-I-NEXT: $x13 = COPY [[AND3]](s64)
557 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__udivti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
558 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
559 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
560 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
561 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
562 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
563 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
564 ;
565 ; CHECK-M-LABEL: name: udiv_i72
566 ; CHECK-M: %xlo:_(s64) = COPY $x10
567 ; CHECK-M-NEXT: %xhi:_(s64) = COPY $x11
568 ; CHECK-M-NEXT: %ylo:_(s64) = COPY $x12
569 ; CHECK-M-NEXT: %yhi:_(s64) = COPY $x13
570 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
571 ; CHECK-M-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
572 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %xlo, [[C]]
573 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %xhi, [[C1]]
574 ; CHECK-M-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
575 ; CHECK-M-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
576 ; CHECK-M-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND %ylo, [[C2]]
577 ; CHECK-M-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND %yhi, [[C3]]
578 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
579 ; CHECK-M-NEXT: $x10 = COPY [[AND]](s64)
580 ; CHECK-M-NEXT: $x11 = COPY [[AND1]](s64)
581 ; CHECK-M-NEXT: $x12 = COPY [[AND2]](s64)
582 ; CHECK-M-NEXT: $x13 = COPY [[AND3]](s64)
583 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__udivti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
584 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
585 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
586 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
587 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s64)
588 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s64)
589 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
590 %xlo:_(s64) = COPY $x10
591 %xhi:_(s64) = COPY $x11
592 %ylo:_(s64) = COPY $x12
593 %yhi:_(s64) = COPY $x13
594 %x0:_(s128) = G_MERGE_VALUES %xlo(s64), %xhi(s64)
595 %y0:_(s128) = G_MERGE_VALUES %ylo(s64), %yhi(s64)
596 %x:_(s72) = G_TRUNC %x0
597 %y:_(s72) = G_TRUNC %y0
598 %z:_(s72) = G_UDIV %x, %y
599 %z0:_(s128) = G_ANYEXT %z
600 %zlo:_(s64), %zhi:_(s64) = G_UNMERGE_VALUES %z0(s128)
601 $x10 = COPY %zlo(s64)
602 $x11 = COPY %zhi(s64)
603 PseudoRET implicit $x10, implicit $x11
604
605 ...
606 ---
607 name: udiv_i128
608 body: |
609 bb.0.entry:
610 ; CHECK-I-LABEL: name: udiv_i128
611 ; CHECK-I: %lo1:_(s64) = COPY $x10
612 ; CHECK-I-NEXT: %hi1:_(s64) = COPY $x11
613 ; CHECK-I-NEXT: %lo2:_(s64) = COPY $x12
614 ; CHECK-I-NEXT: %hi2:_(s64) = COPY $x13
615 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
616 ; CHECK-I-NEXT: $x10 = COPY %lo1(s64)
617 ; CHECK-I-NEXT: $x11 = COPY %hi1(s64)
618 ; CHECK-I-NEXT: $x12 = COPY %lo2(s64)
619 ; CHECK-I-NEXT: $x13 = COPY %hi2(s64)
620 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__udivti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
621 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
622 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
623 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
624 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
625 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
626 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
627 ;
628 ; CHECK-M-LABEL: name: udiv_i128
629 ; CHECK-M: %lo1:_(s64) = COPY $x10
630 ; CHECK-M-NEXT: %hi1:_(s64) = COPY $x11
631 ; CHECK-M-NEXT: %lo2:_(s64) = COPY $x12
632 ; CHECK-M-NEXT: %hi2:_(s64) = COPY $x13
633 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
634 ; CHECK-M-NEXT: $x10 = COPY %lo1(s64)
635 ; CHECK-M-NEXT: $x11 = COPY %hi1(s64)
636 ; CHECK-M-NEXT: $x12 = COPY %lo2(s64)
637 ; CHECK-M-NEXT: $x13 = COPY %hi2(s64)
638 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__udivti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
639 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
640 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
641 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
642 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s64)
643 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s64)
644 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
645 %lo1:_(s64) = COPY $x10
646 %hi1:_(s64) = COPY $x11
647 %lo2:_(s64) = COPY $x12
648 %hi2:_(s64) = COPY $x13
649 %x1:_(s128) = G_MERGE_VALUES %lo1(s64), %hi1(s64)
650 %x2:_(s128) = G_MERGE_VALUES %lo2(s64), %hi2(s64)
651 %y:_(s128) = G_UDIV %x1, %x2
652 %loy:_(s64), %hiy:_(s64) = G_UNMERGE_VALUES %y(s128)
653 $x10 = COPY %loy(s64)
654 $x11 = COPY %hiy(s64)
655 PseudoRET implicit $x10, implicit $x11
656
657 ...
658 ---
659 name: udivrem_i64
660 body: |
661 bb.1.entry:
662 liveins: $x10, $x11
663
664 ; CHECK-I-LABEL: name: udivrem_i64
665 ; CHECK-I: liveins: $x10, $x11
666 ; CHECK-I-NEXT: {{ $}}
667 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
668 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
669 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
670 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
671 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
672 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__udivdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
673 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
674 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
675 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
676 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
677 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
678 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umoddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
679 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
680 ; CHECK-I-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x10
681 ; CHECK-I-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY2]], [[COPY3]]
682 ; CHECK-I-NEXT: $x10 = COPY [[ADD]](s64)
683 ; CHECK-I-NEXT: PseudoRET implicit $x10
684 ;
685 ; CHECK-M-LABEL: name: udivrem_i64
686 ; CHECK-M: liveins: $x10, $x11
687 ; CHECK-M-NEXT: {{ $}}
688 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
689 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
690 ; CHECK-M-NEXT: [[UDIV:%[0-9]+]]:_(s64) = G_UDIV [[COPY]], [[COPY1]]
691 ; CHECK-M-NEXT: [[UREM:%[0-9]+]]:_(s64) = G_UREM [[COPY]], [[COPY1]]
692 ; CHECK-M-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[UDIV]], [[UREM]]
693 ; CHECK-M-NEXT: $x10 = COPY [[ADD]](s64)
694 ; CHECK-M-NEXT: PseudoRET implicit $x10
695 %0:_(s64) = COPY $x10
696 %1:_(s64) = COPY $x11
697 %2:_(s64), %3:_(s64) = G_UDIVREM %0, %1
698 %4:_(s64) = G_ADD %2, %3
699 $x10 = COPY %4(s64)
700 PseudoRET implicit $x10
701
702 ...
703 ---
704 name: sdivrem_i64
705 body: |
706 bb.1.entry:
707 liveins: $x10, $x11
708
709 ; CHECK-I-LABEL: name: sdivrem_i64
710 ; CHECK-I: liveins: $x10, $x11
711 ; CHECK-I-NEXT: {{ $}}
712 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
713 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
714 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
715 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
716 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
717 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__divdi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
718 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
719 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
720 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
721 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
722 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
723 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__moddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
724 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
725 ; CHECK-I-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY $x10
726 ; CHECK-I-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY2]], [[COPY3]]
727 ; CHECK-I-NEXT: $x10 = COPY [[ADD]](s64)
728 ; CHECK-I-NEXT: PseudoRET implicit $x10
729 ;
730 ; CHECK-M-LABEL: name: sdivrem_i64
731 ; CHECK-M: liveins: $x10, $x11
732 ; CHECK-M-NEXT: {{ $}}
733 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
734 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
735 ; CHECK-M-NEXT: [[SDIV:%[0-9]+]]:_(s64) = G_SDIV [[COPY]], [[COPY1]]
736 ; CHECK-M-NEXT: [[SREM:%[0-9]+]]:_(s64) = G_SREM [[COPY]], [[COPY1]]
737 ; CHECK-M-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[SDIV]], [[SREM]]
738 ; CHECK-M-NEXT: $x10 = COPY [[ADD]](s64)
739 ; CHECK-M-NEXT: PseudoRET implicit $x10
740 %0:_(s64) = COPY $x10
741 %1:_(s64) = COPY $x11
742 %2:_(s64), %3:_(s64) = G_SDIVREM %0, %1
743 %4:_(s64) = G_ADD %2, %3
744 $x10 = COPY %4(s64)
745 PseudoRET implicit $x10
746
747 ...