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
10 ; CHECK-I-LABEL: name: srem_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: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[COPY1]], [[C]](s64)
17 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C]](s64)
18 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
19 ; CHECK-I-NEXT: $x10 = COPY [[ASHR]](s64)
20 ; CHECK-I-NEXT: $x11 = COPY [[ASHR1]](s64)
21 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__moddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
22 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
23 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
24 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
25 ; CHECK-I-NEXT: PseudoRET implicit $x10
27 ; CHECK-M-LABEL: name: srem_i8
28 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
29 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
30 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
31 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C]](s64)
32 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
33 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[COPY1]], [[C]](s64)
34 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C]](s64)
35 ; CHECK-M-NEXT: [[SREM:%[0-9]+]]:_(s64) = G_SREM [[ASHR]], [[ASHR1]]
36 ; CHECK-M-NEXT: $x10 = COPY [[SREM]](s64)
37 ; CHECK-M-NEXT: PseudoRET implicit $x10
40 %2:_(s8) = G_TRUNC %0(s64)
41 %3:_(s8) = G_TRUNC %1(s64)
42 %4:_(s8) = G_SREM %2, %3
43 %5:_(s64) = G_ANYEXT %4(s8)
45 PseudoRET implicit $x10
52 ; CHECK-I-LABEL: name: srem_i15
53 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
54 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
55 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 49
56 ; CHECK-I-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C]](s64)
57 ; CHECK-I-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
58 ; CHECK-I-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[COPY1]], [[C]](s64)
59 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C]](s64)
60 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
61 ; CHECK-I-NEXT: $x10 = COPY [[ASHR]](s64)
62 ; CHECK-I-NEXT: $x11 = COPY [[ASHR1]](s64)
63 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__moddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
64 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
65 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
66 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
67 ; CHECK-I-NEXT: PseudoRET implicit $x10
69 ; CHECK-M-LABEL: name: srem_i15
70 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
71 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
72 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 49
73 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C]](s64)
74 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
75 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[COPY1]], [[C]](s64)
76 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C]](s64)
77 ; CHECK-M-NEXT: [[SREM:%[0-9]+]]:_(s64) = G_SREM [[ASHR]], [[ASHR1]]
78 ; CHECK-M-NEXT: $x10 = COPY [[SREM]](s64)
79 ; CHECK-M-NEXT: PseudoRET implicit $x10
82 %2:_(s15) = G_TRUNC %0(s64)
83 %3:_(s15) = G_TRUNC %1(s64)
84 %4:_(s15) = G_SREM %2, %3
85 %5:_(s64) = G_ANYEXT %4(s15)
87 PseudoRET implicit $x10
94 ; CHECK-I-LABEL: name: srem_i16
95 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
96 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
97 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 48
98 ; CHECK-I-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C]](s64)
99 ; CHECK-I-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
100 ; CHECK-I-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[COPY1]], [[C]](s64)
101 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C]](s64)
102 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
103 ; CHECK-I-NEXT: $x10 = COPY [[ASHR]](s64)
104 ; CHECK-I-NEXT: $x11 = COPY [[ASHR1]](s64)
105 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__moddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
106 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
107 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
108 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
109 ; CHECK-I-NEXT: PseudoRET implicit $x10
111 ; CHECK-M-LABEL: name: srem_i16
112 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
113 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
114 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 48
115 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C]](s64)
116 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
117 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[COPY1]], [[C]](s64)
118 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C]](s64)
119 ; CHECK-M-NEXT: [[SREM:%[0-9]+]]:_(s64) = G_SREM [[ASHR]], [[ASHR1]]
120 ; CHECK-M-NEXT: $x10 = COPY [[SREM]](s64)
121 ; CHECK-M-NEXT: PseudoRET implicit $x10
122 %0:_(s64) = COPY $x10
123 %1:_(s64) = COPY $x11
124 %2:_(s16) = G_TRUNC %0(s64)
125 %3:_(s16) = G_TRUNC %1(s64)
126 %4:_(s16) = G_SREM %2, %3
127 %5:_(s64) = G_ANYEXT %4(s16)
129 PseudoRET implicit $x10
136 ; CHECK-I-LABEL: name: srem_i32
137 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
138 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
139 ; CHECK-I-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32
140 ; CHECK-I-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32
141 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
142 ; CHECK-I-NEXT: $x10 = COPY [[SEXT_INREG]](s64)
143 ; CHECK-I-NEXT: $x11 = COPY [[SEXT_INREG1]](s64)
144 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__moddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
145 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
146 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
147 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
148 ; CHECK-I-NEXT: PseudoRET implicit $x10
150 ; CHECK-M-LABEL: name: srem_i32
151 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
152 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
153 ; CHECK-M-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32
154 ; CHECK-M-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32
155 ; CHECK-M-NEXT: [[SREM:%[0-9]+]]:_(s64) = G_SREM [[SEXT_INREG]], [[SEXT_INREG1]]
156 ; CHECK-M-NEXT: $x10 = COPY [[SREM]](s64)
157 ; CHECK-M-NEXT: PseudoRET implicit $x10
158 %0:_(s64) = COPY $x10
159 %1:_(s64) = COPY $x11
160 %2:_(s32) = G_TRUNC %0(s64)
161 %3:_(s32) = G_TRUNC %1(s64)
162 %4:_(s32) = G_SREM %2, %3
163 %5:_(s64) = G_ANYEXT %4(s32)
165 PseudoRET implicit $x10
172 ; CHECK-I-LABEL: name: srem_i64
173 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
174 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
175 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
176 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
177 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
178 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__moddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
179 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
180 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
181 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
182 ; CHECK-I-NEXT: PseudoRET implicit $x10
184 ; CHECK-M-LABEL: name: srem_i64
185 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
186 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
187 ; CHECK-M-NEXT: [[SREM:%[0-9]+]]:_(s64) = G_SREM [[COPY]], [[COPY1]]
188 ; CHECK-M-NEXT: $x10 = COPY [[SREM]](s64)
189 ; CHECK-M-NEXT: PseudoRET implicit $x10
190 %0:_(s64) = COPY $x10
191 %1:_(s64) = COPY $x11
192 %2:_(s64) = G_SREM %0, %1
194 PseudoRET implicit $x10
201 ; CHECK-I-LABEL: name: srem_i72
202 ; CHECK-I: %xlo:_(s64) = COPY $x10
203 ; CHECK-I-NEXT: %xhi:_(s64) = COPY $x11
204 ; CHECK-I-NEXT: %ylo:_(s64) = COPY $x12
205 ; CHECK-I-NEXT: %yhi:_(s64) = COPY $x13
206 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
207 ; CHECK-I-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL %xhi, [[C]](s64)
208 ; CHECK-I-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
209 ; CHECK-I-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL %yhi, [[C]](s64)
210 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C]](s64)
211 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
212 ; CHECK-I-NEXT: $x10 = COPY %xlo(s64)
213 ; CHECK-I-NEXT: $x11 = COPY [[ASHR]](s64)
214 ; CHECK-I-NEXT: $x12 = COPY %ylo(s64)
215 ; CHECK-I-NEXT: $x13 = COPY [[ASHR1]](s64)
216 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__modti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
217 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
218 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
219 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
220 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
221 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
222 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
224 ; CHECK-M-LABEL: name: srem_i72
225 ; CHECK-M: %xlo:_(s64) = COPY $x10
226 ; CHECK-M-NEXT: %xhi:_(s64) = COPY $x11
227 ; CHECK-M-NEXT: %ylo:_(s64) = COPY $x12
228 ; CHECK-M-NEXT: %yhi:_(s64) = COPY $x13
229 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 56
230 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL %xhi, [[C]](s64)
231 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[SHL]], [[C]](s64)
232 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s64) = G_SHL %yhi, [[C]](s64)
233 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[SHL1]], [[C]](s64)
234 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
235 ; CHECK-M-NEXT: $x10 = COPY %xlo(s64)
236 ; CHECK-M-NEXT: $x11 = COPY [[ASHR]](s64)
237 ; CHECK-M-NEXT: $x12 = COPY %ylo(s64)
238 ; CHECK-M-NEXT: $x13 = COPY [[ASHR1]](s64)
239 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__modti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
240 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
241 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
242 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
243 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s64)
244 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s64)
245 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
246 %xlo:_(s64) = COPY $x10
247 %xhi:_(s64) = COPY $x11
248 %ylo:_(s64) = COPY $x12
249 %yhi:_(s64) = COPY $x13
250 %x0:_(s128) = G_MERGE_VALUES %xlo(s64), %xhi(s64)
251 %y0:_(s128) = G_MERGE_VALUES %ylo(s64), %yhi(s64)
252 %x:_(s72) = G_TRUNC %x0
253 %y:_(s72) = G_TRUNC %y0
254 %z:_(s72) = G_SREM %x, %y
255 %z0:_(s128) = G_ANYEXT %z
256 %zlo:_(s64), %zhi:_(s64) = G_UNMERGE_VALUES %z0(s128)
257 $x10 = COPY %zlo(s64)
258 $x11 = COPY %zhi(s64)
259 PseudoRET implicit $x10, implicit $x11
266 ; CHECK-I-LABEL: name: srem_i128
267 ; CHECK-I: %lo1:_(s64) = COPY $x10
268 ; CHECK-I-NEXT: %hi1:_(s64) = COPY $x11
269 ; CHECK-I-NEXT: %lo2:_(s64) = COPY $x12
270 ; CHECK-I-NEXT: %hi2:_(s64) = COPY $x13
271 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
272 ; CHECK-I-NEXT: $x10 = COPY %lo1(s64)
273 ; CHECK-I-NEXT: $x11 = COPY %hi1(s64)
274 ; CHECK-I-NEXT: $x12 = COPY %lo2(s64)
275 ; CHECK-I-NEXT: $x13 = COPY %hi2(s64)
276 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__modti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
277 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
278 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
279 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
280 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
281 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
282 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
284 ; CHECK-M-LABEL: name: srem_i128
285 ; CHECK-M: %lo1:_(s64) = COPY $x10
286 ; CHECK-M-NEXT: %hi1:_(s64) = COPY $x11
287 ; CHECK-M-NEXT: %lo2:_(s64) = COPY $x12
288 ; CHECK-M-NEXT: %hi2:_(s64) = COPY $x13
289 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
290 ; CHECK-M-NEXT: $x10 = COPY %lo1(s64)
291 ; CHECK-M-NEXT: $x11 = COPY %hi1(s64)
292 ; CHECK-M-NEXT: $x12 = COPY %lo2(s64)
293 ; CHECK-M-NEXT: $x13 = COPY %hi2(s64)
294 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__modti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
295 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
296 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
297 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
298 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s64)
299 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s64)
300 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
301 %lo1:_(s64) = COPY $x10
302 %hi1:_(s64) = COPY $x11
303 %lo2:_(s64) = COPY $x12
304 %hi2:_(s64) = COPY $x13
305 %x1:_(s128) = G_MERGE_VALUES %lo1(s64), %hi1(s64)
306 %x2:_(s128) = G_MERGE_VALUES %lo2(s64), %hi2(s64)
307 %y:_(s128) = G_SREM %x1, %x2
308 %loy:_(s64), %hiy:_(s64) = G_UNMERGE_VALUES %y(s128)
309 $x10 = COPY %loy(s64)
310 $x11 = COPY %hiy(s64)
311 PseudoRET implicit $x10, implicit $x11
318 ; CHECK-I-LABEL: name: urem_i8
319 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
320 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
321 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
322 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
323 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
324 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
325 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s64)
326 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s64)
327 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umoddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
328 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
329 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
330 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
331 ; CHECK-I-NEXT: PseudoRET implicit $x10
333 ; CHECK-M-LABEL: name: urem_i8
334 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
335 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
336 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
337 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
338 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
339 ; CHECK-M-NEXT: [[REMUW:%[0-9]+]]:_(s64) = G_REMUW [[AND]], [[AND1]]
340 ; CHECK-M-NEXT: $x10 = COPY [[REMUW]](s64)
341 ; CHECK-M-NEXT: PseudoRET implicit $x10
342 %0:_(s64) = COPY $x10
343 %1:_(s64) = COPY $x11
344 %2:_(s8) = G_TRUNC %0(s64)
345 %3:_(s8) = G_TRUNC %1(s64)
346 %4:_(s8) = G_UREM %2, %3
347 %5:_(s64) = G_ANYEXT %4(s8)
349 PseudoRET implicit $x10
356 ; CHECK-I-LABEL: name: urem_i15
357 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
358 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
359 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767
360 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
361 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
362 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
363 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s64)
364 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s64)
365 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umoddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
366 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
367 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
368 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
369 ; CHECK-I-NEXT: PseudoRET implicit $x10
371 ; CHECK-M-LABEL: name: urem_i15
372 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
373 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
374 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32767
375 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
376 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
377 ; CHECK-M-NEXT: [[REMUW:%[0-9]+]]:_(s64) = G_REMUW [[AND]], [[AND1]]
378 ; CHECK-M-NEXT: $x10 = COPY [[REMUW]](s64)
379 ; CHECK-M-NEXT: PseudoRET implicit $x10
380 %0:_(s64) = COPY $x10
381 %1:_(s64) = COPY $x11
382 %2:_(s15) = G_TRUNC %0(s64)
383 %3:_(s15) = G_TRUNC %1(s64)
384 %4:_(s15) = G_UREM %2, %3
385 %5:_(s64) = G_ANYEXT %4(s15)
387 PseudoRET implicit $x10
394 ; CHECK-I-LABEL: name: urem_i16
395 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
396 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
397 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
398 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
399 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
400 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
401 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s64)
402 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s64)
403 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umoddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
404 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
405 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
406 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
407 ; CHECK-I-NEXT: PseudoRET implicit $x10
409 ; CHECK-M-LABEL: name: urem_i16
410 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
411 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
412 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 65535
413 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
414 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
415 ; CHECK-M-NEXT: [[REMUW:%[0-9]+]]:_(s64) = G_REMUW [[AND]], [[AND1]]
416 ; CHECK-M-NEXT: $x10 = COPY [[REMUW]](s64)
417 ; CHECK-M-NEXT: PseudoRET implicit $x10
418 %0:_(s64) = COPY $x10
419 %1:_(s64) = COPY $x11
420 %2:_(s16) = G_TRUNC %0(s64)
421 %3:_(s16) = G_TRUNC %1(s64)
422 %4:_(s16) = G_UREM %2, %3
423 %5:_(s64) = G_ANYEXT %4(s16)
425 PseudoRET implicit $x10
432 ; CHECK-I-LABEL: name: urem_i32
433 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
434 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
435 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4294967295
436 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY]], [[C]]
437 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND [[COPY1]], [[C]]
438 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
439 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s64)
440 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s64)
441 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umoddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
442 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
443 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
444 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
445 ; CHECK-I-NEXT: PseudoRET implicit $x10
447 ; CHECK-M-LABEL: name: urem_i32
448 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
449 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
450 ; CHECK-M-NEXT: [[REMUW:%[0-9]+]]:_(s64) = G_REMUW [[COPY]], [[COPY1]]
451 ; CHECK-M-NEXT: $x10 = COPY [[REMUW]](s64)
452 ; CHECK-M-NEXT: PseudoRET implicit $x10
453 %0:_(s64) = COPY $x10
454 %1:_(s64) = COPY $x11
455 %2:_(s32) = G_TRUNC %0(s64)
456 %3:_(s32) = G_TRUNC %1(s64)
457 %4:_(s32) = G_UREM %2, %3
458 %5:_(s64) = G_ANYEXT %4(s32)
460 PseudoRET implicit $x10
467 ; CHECK-I-LABEL: name: urem_i64
468 ; CHECK-I: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
469 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
470 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
471 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
472 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
473 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umoddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
474 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
475 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x10
476 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s64)
477 ; CHECK-I-NEXT: PseudoRET implicit $x10
479 ; CHECK-M-LABEL: name: urem_i64
480 ; CHECK-M: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
481 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
482 ; CHECK-M-NEXT: [[UREM:%[0-9]+]]:_(s64) = G_UREM [[COPY]], [[COPY1]]
483 ; CHECK-M-NEXT: $x10 = COPY [[UREM]](s64)
484 ; CHECK-M-NEXT: PseudoRET implicit $x10
485 %0:_(s64) = COPY $x10
486 %1:_(s64) = COPY $x11
487 %2:_(s64) = G_UREM %0, %1
489 PseudoRET implicit $x10
496 ; CHECK-I-LABEL: name: urem_i72
497 ; CHECK-I: %xlo:_(s64) = COPY $x10
498 ; CHECK-I-NEXT: %xhi:_(s64) = COPY $x11
499 ; CHECK-I-NEXT: %ylo:_(s64) = COPY $x12
500 ; CHECK-I-NEXT: %yhi:_(s64) = COPY $x13
501 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
502 ; CHECK-I-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
503 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %xlo, [[C]]
504 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %xhi, [[C1]]
505 ; CHECK-I-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND %ylo, [[C]]
506 ; CHECK-I-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND %yhi, [[C1]]
507 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
508 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s64)
509 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s64)
510 ; CHECK-I-NEXT: $x12 = COPY [[AND2]](s64)
511 ; CHECK-I-NEXT: $x13 = COPY [[AND3]](s64)
512 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umodti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
513 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
514 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
515 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
516 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
517 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
518 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
520 ; CHECK-M-LABEL: name: urem_i72
521 ; CHECK-M: %xlo:_(s64) = COPY $x10
522 ; CHECK-M-NEXT: %xhi:_(s64) = COPY $x11
523 ; CHECK-M-NEXT: %ylo:_(s64) = COPY $x12
524 ; CHECK-M-NEXT: %yhi:_(s64) = COPY $x13
525 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
526 ; CHECK-M-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 255
527 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %xlo, [[C]]
528 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %xhi, [[C1]]
529 ; CHECK-M-NEXT: [[AND2:%[0-9]+]]:_(s64) = G_AND %ylo, [[C]]
530 ; CHECK-M-NEXT: [[AND3:%[0-9]+]]:_(s64) = G_AND %yhi, [[C1]]
531 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
532 ; CHECK-M-NEXT: $x10 = COPY [[AND]](s64)
533 ; CHECK-M-NEXT: $x11 = COPY [[AND1]](s64)
534 ; CHECK-M-NEXT: $x12 = COPY [[AND2]](s64)
535 ; CHECK-M-NEXT: $x13 = COPY [[AND3]](s64)
536 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__umodti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
537 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
538 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
539 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
540 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s64)
541 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s64)
542 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
543 %xlo:_(s64) = COPY $x10
544 %xhi:_(s64) = COPY $x11
545 %ylo:_(s64) = COPY $x12
546 %yhi:_(s64) = COPY $x13
547 %x0:_(s128) = G_MERGE_VALUES %xlo(s64), %xhi(s64)
548 %y0:_(s128) = G_MERGE_VALUES %ylo(s64), %yhi(s64)
549 %x:_(s72) = G_TRUNC %x0
550 %y:_(s72) = G_TRUNC %y0
551 %z:_(s72) = G_UREM %x, %y
552 %z0:_(s128) = G_ANYEXT %z
553 %zlo:_(s64), %zhi:_(s64) = G_UNMERGE_VALUES %z0(s128)
554 $x10 = COPY %zlo(s64)
555 $x11 = COPY %zhi(s64)
556 PseudoRET implicit $x10, implicit $x11
563 ; CHECK-I-LABEL: name: urem_i128
564 ; CHECK-I: %lo1:_(s64) = COPY $x10
565 ; CHECK-I-NEXT: %hi1:_(s64) = COPY $x11
566 ; CHECK-I-NEXT: %lo2:_(s64) = COPY $x12
567 ; CHECK-I-NEXT: %hi2:_(s64) = COPY $x13
568 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
569 ; CHECK-I-NEXT: $x10 = COPY %lo1(s64)
570 ; CHECK-I-NEXT: $x11 = COPY %hi1(s64)
571 ; CHECK-I-NEXT: $x12 = COPY %lo2(s64)
572 ; CHECK-I-NEXT: $x13 = COPY %hi2(s64)
573 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umodti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
574 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
575 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
576 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
577 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s64)
578 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s64)
579 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
581 ; CHECK-M-LABEL: name: urem_i128
582 ; CHECK-M: %lo1:_(s64) = COPY $x10
583 ; CHECK-M-NEXT: %hi1:_(s64) = COPY $x11
584 ; CHECK-M-NEXT: %lo2:_(s64) = COPY $x12
585 ; CHECK-M-NEXT: %hi2:_(s64) = COPY $x13
586 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
587 ; CHECK-M-NEXT: $x10 = COPY %lo1(s64)
588 ; CHECK-M-NEXT: $x11 = COPY %hi1(s64)
589 ; CHECK-M-NEXT: $x12 = COPY %lo2(s64)
590 ; CHECK-M-NEXT: $x13 = COPY %hi2(s64)
591 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__umodti3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
592 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
593 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
594 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
595 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s64)
596 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s64)
597 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
598 %lo1:_(s64) = COPY $x10
599 %hi1:_(s64) = COPY $x11
600 %lo2:_(s64) = COPY $x12
601 %hi2:_(s64) = COPY $x13
602 %x1:_(s128) = G_MERGE_VALUES %lo1(s64), %hi1(s64)
603 %x2:_(s128) = G_MERGE_VALUES %lo2(s64), %hi2(s64)
604 %y:_(s128) = G_UREM %x1, %x2
605 %loy:_(s64), %hiy:_(s64) = G_UNMERGE_VALUES %y(s128)
606 $x10 = COPY %loy(s64)
607 $x11 = COPY %hiy(s64)
608 PseudoRET implicit $x10, implicit $x11