Debian Codegraph @

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-rem-rv32.mir

raw
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \
3 # RUN: | FileCheck %s -check-prefix=CHECK-I
4 # RUN: llc -mattr=+m -mtriple=riscv32 -run-pass=legalizer %s -o - \
5 # RUN: | FileCheck %s -check-prefix=CHECK-M
6 ---
7 name: srem_i7
8 body: |
9 bb.0.entry:
10 ; CHECK-I-LABEL: name: srem_i7
11 ; CHECK-I: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
12 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
13 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 25
14 ; CHECK-I-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
15 ; CHECK-I-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
16 ; CHECK-I-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32)
17 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32)
18 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
19 ; CHECK-I-NEXT: $x10 = COPY [[ASHR]](s32)
20 ; CHECK-I-NEXT: $x11 = COPY [[ASHR1]](s32)
21 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__modsi3, 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]+]]:_(s32) = COPY $x10
24 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s32)
25 ; CHECK-I-NEXT: PseudoRET implicit $x10
26 ;
27 ; CHECK-M-LABEL: name: srem_i7
28 ; CHECK-M: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
29 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
30 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 25
31 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
32 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
33 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32)
34 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32)
35 ; CHECK-M-NEXT: [[SREM:%[0-9]+]]:_(s32) = G_SREM [[ASHR]], [[ASHR1]]
36 ; CHECK-M-NEXT: $x10 = COPY [[SREM]](s32)
37 ; CHECK-M-NEXT: PseudoRET implicit $x10
38 %0:_(s32) = COPY $x10
39 %1:_(s32) = COPY $x11
40 %2:_(s7) = G_TRUNC %0(s32)
41 %3:_(s7) = G_TRUNC %1(s32)
42 %4:_(s7) = G_SREM %2, %3
43 %5:_(s32) = G_ANYEXT %4(s7)
44 $x10 = COPY %5(s32)
45 PseudoRET implicit $x10
46
47 ...
48 ---
49 name: srem_i8
50 body: |
51 bb.0.entry:
52 ; CHECK-I-LABEL: name: srem_i8
53 ; CHECK-I: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
54 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
55 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
56 ; CHECK-I-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
57 ; CHECK-I-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
58 ; CHECK-I-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32)
59 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32)
60 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
61 ; CHECK-I-NEXT: $x10 = COPY [[ASHR]](s32)
62 ; CHECK-I-NEXT: $x11 = COPY [[ASHR1]](s32)
63 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__modsi3, 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]+]]:_(s32) = COPY $x10
66 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s32)
67 ; CHECK-I-NEXT: PseudoRET implicit $x10
68 ;
69 ; CHECK-M-LABEL: name: srem_i8
70 ; CHECK-M: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
71 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
72 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
73 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
74 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
75 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32)
76 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32)
77 ; CHECK-M-NEXT: [[SREM:%[0-9]+]]:_(s32) = G_SREM [[ASHR]], [[ASHR1]]
78 ; CHECK-M-NEXT: $x10 = COPY [[SREM]](s32)
79 ; CHECK-M-NEXT: PseudoRET implicit $x10
80 %0:_(s32) = COPY $x10
81 %1:_(s32) = COPY $x11
82 %2:_(s8) = G_TRUNC %0(s32)
83 %3:_(s8) = G_TRUNC %1(s32)
84 %4:_(s8) = G_SREM %2, %3
85 %5:_(s32) = G_ANYEXT %4(s8)
86 $x10 = COPY %5(s32)
87 PseudoRET implicit $x10
88
89 ...
90 ---
91 name: srem_i16
92 body: |
93 bb.0.entry:
94 ; CHECK-I-LABEL: name: srem_i16
95 ; CHECK-I: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
96 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
97 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
98 ; CHECK-I-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
99 ; CHECK-I-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
100 ; CHECK-I-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32)
101 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32)
102 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
103 ; CHECK-I-NEXT: $x10 = COPY [[ASHR]](s32)
104 ; CHECK-I-NEXT: $x11 = COPY [[ASHR1]](s32)
105 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__modsi3, 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]+]]:_(s32) = COPY $x10
108 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s32)
109 ; CHECK-I-NEXT: PseudoRET implicit $x10
110 ;
111 ; CHECK-M-LABEL: name: srem_i16
112 ; CHECK-M: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
113 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
114 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
115 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
116 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
117 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32)
118 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32)
119 ; CHECK-M-NEXT: [[SREM:%[0-9]+]]:_(s32) = G_SREM [[ASHR]], [[ASHR1]]
120 ; CHECK-M-NEXT: $x10 = COPY [[SREM]](s32)
121 ; CHECK-M-NEXT: PseudoRET implicit $x10
122 %0:_(s32) = COPY $x10
123 %1:_(s32) = COPY $x11
124 %2:_(s16) = G_TRUNC %0(s32)
125 %3:_(s16) = G_TRUNC %1(s32)
126 %4:_(s16) = G_SREM %2, %3
127 %5:_(s32) = G_ANYEXT %4(s16)
128 $x10 = COPY %5(s32)
129 PseudoRET implicit $x10
130
131 ...
132 ---
133 name: srem_i32
134 body: |
135 bb.0.entry:
136 ; CHECK-I-LABEL: name: srem_i32
137 ; CHECK-I: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
138 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
139 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
140 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s32)
141 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s32)
142 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__modsi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
143 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
144 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x10
145 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s32)
146 ; CHECK-I-NEXT: PseudoRET implicit $x10
147 ;
148 ; CHECK-M-LABEL: name: srem_i32
149 ; CHECK-M: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
150 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
151 ; CHECK-M-NEXT: [[SREM:%[0-9]+]]:_(s32) = G_SREM [[COPY]], [[COPY1]]
152 ; CHECK-M-NEXT: $x10 = COPY [[SREM]](s32)
153 ; CHECK-M-NEXT: PseudoRET implicit $x10
154 %0:_(s32) = COPY $x10
155 %1:_(s32) = COPY $x11
156 %2:_(s32) = G_SREM %0, %1
157 $x10 = COPY %2(s32)
158 PseudoRET implicit $x10
159
160 ...
161 ---
162 name: srem_i48
163 body: |
164 bb.0.entry:
165 ; CHECK-I-LABEL: name: srem_i48
166 ; CHECK-I: %xlo:_(s32) = COPY $x10
167 ; CHECK-I-NEXT: %xhi:_(s32) = COPY $x11
168 ; CHECK-I-NEXT: %ylo:_(s32) = COPY $x12
169 ; CHECK-I-NEXT: %yhi:_(s32) = COPY $x13
170 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
171 ; CHECK-I-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %xhi, [[C]](s32)
172 ; CHECK-I-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
173 ; CHECK-I-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %yhi, [[C]](s32)
174 ; CHECK-I-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32)
175 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
176 ; CHECK-I-NEXT: $x10 = COPY %xlo(s32)
177 ; CHECK-I-NEXT: $x11 = COPY [[ASHR]](s32)
178 ; CHECK-I-NEXT: $x12 = COPY %ylo(s32)
179 ; CHECK-I-NEXT: $x13 = COPY [[ASHR1]](s32)
180 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__moddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
181 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
182 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
183 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
184 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s32)
185 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s32)
186 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
187 ;
188 ; CHECK-M-LABEL: name: srem_i48
189 ; CHECK-M: %xlo:_(s32) = COPY $x10
190 ; CHECK-M-NEXT: %xhi:_(s32) = COPY $x11
191 ; CHECK-M-NEXT: %ylo:_(s32) = COPY $x12
192 ; CHECK-M-NEXT: %yhi:_(s32) = COPY $x13
193 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
194 ; CHECK-M-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %xhi, [[C]](s32)
195 ; CHECK-M-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
196 ; CHECK-M-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %yhi, [[C]](s32)
197 ; CHECK-M-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32)
198 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
199 ; CHECK-M-NEXT: $x10 = COPY %xlo(s32)
200 ; CHECK-M-NEXT: $x11 = COPY [[ASHR]](s32)
201 ; CHECK-M-NEXT: $x12 = COPY %ylo(s32)
202 ; CHECK-M-NEXT: $x13 = COPY [[ASHR1]](s32)
203 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__moddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
204 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
205 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
206 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
207 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s32)
208 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s32)
209 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
210 %xlo:_(s32) = COPY $x10
211 %xhi:_(s32) = COPY $x11
212 %ylo:_(s32) = COPY $x12
213 %yhi:_(s32) = COPY $x13
214 %x0:_(s64) = G_MERGE_VALUES %xlo(s32), %xhi(s32)
215 %y0:_(s64) = G_MERGE_VALUES %ylo(s32), %yhi(s32)
216 %x:_(s48) = G_TRUNC %x0
217 %y:_(s48) = G_TRUNC %y0
218 %z:_(s48) = G_SREM %x, %y
219 %z0:_(s64) = G_ANYEXT %z
220 %zlo:_(s32), %zhi:_(s32) = G_UNMERGE_VALUES %z0(s64)
221 $x10 = COPY %zlo(s32)
222 $x11 = COPY %zhi(s32)
223 PseudoRET implicit $x10, implicit $x11
224
225 ...
226 ---
227 name: srem_i64
228 body: |
229 bb.0.entry:
230 ; CHECK-I-LABEL: name: srem_i64
231 ; CHECK-I: %lo1:_(s32) = COPY $x10
232 ; CHECK-I-NEXT: %hi1:_(s32) = COPY $x11
233 ; CHECK-I-NEXT: %lo2:_(s32) = COPY $x12
234 ; CHECK-I-NEXT: %hi2:_(s32) = COPY $x13
235 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
236 ; CHECK-I-NEXT: $x10 = COPY %lo1(s32)
237 ; CHECK-I-NEXT: $x11 = COPY %hi1(s32)
238 ; CHECK-I-NEXT: $x12 = COPY %lo2(s32)
239 ; CHECK-I-NEXT: $x13 = COPY %hi2(s32)
240 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__moddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
241 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
242 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
243 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
244 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s32)
245 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s32)
246 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
247 ;
248 ; CHECK-M-LABEL: name: srem_i64
249 ; CHECK-M: %lo1:_(s32) = COPY $x10
250 ; CHECK-M-NEXT: %hi1:_(s32) = COPY $x11
251 ; CHECK-M-NEXT: %lo2:_(s32) = COPY $x12
252 ; CHECK-M-NEXT: %hi2:_(s32) = COPY $x13
253 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
254 ; CHECK-M-NEXT: $x10 = COPY %lo1(s32)
255 ; CHECK-M-NEXT: $x11 = COPY %hi1(s32)
256 ; CHECK-M-NEXT: $x12 = COPY %lo2(s32)
257 ; CHECK-M-NEXT: $x13 = COPY %hi2(s32)
258 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__moddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
259 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
260 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
261 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
262 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s32)
263 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s32)
264 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
265 %lo1:_(s32) = COPY $x10
266 %hi1:_(s32) = COPY $x11
267 %lo2:_(s32) = COPY $x12
268 %hi2:_(s32) = COPY $x13
269 %x1:_(s64) = G_MERGE_VALUES %lo1(s32), %hi1(s32)
270 %x2:_(s64) = G_MERGE_VALUES %lo2(s32), %hi2(s32)
271 %y:_(s64) = G_SREM %x1, %x2
272 %loy:_(s32), %hiy:_(s32) = G_UNMERGE_VALUES %y(s64)
273 $x10 = COPY %loy(s32)
274 $x11 = COPY %hiy(s32)
275 PseudoRET implicit $x10, implicit $x11
276
277 ...
278 ---
279 name: urem_i7
280 body: |
281 bb.0.entry:
282 ; CHECK-I-LABEL: name: urem_i7
283 ; CHECK-I: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
284 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
285 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127
286 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
287 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
288 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
289 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s32)
290 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s32)
291 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umodsi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
292 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
293 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x10
294 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s32)
295 ; CHECK-I-NEXT: PseudoRET implicit $x10
296 ;
297 ; CHECK-M-LABEL: name: urem_i7
298 ; CHECK-M: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
299 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
300 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127
301 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
302 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
303 ; CHECK-M-NEXT: [[UREM:%[0-9]+]]:_(s32) = G_UREM [[AND]], [[AND1]]
304 ; CHECK-M-NEXT: $x10 = COPY [[UREM]](s32)
305 ; CHECK-M-NEXT: PseudoRET implicit $x10
306 %0:_(s32) = COPY $x10
307 %1:_(s32) = COPY $x11
308 %2:_(s7) = G_TRUNC %0(s32)
309 %3:_(s7) = G_TRUNC %1(s32)
310 %4:_(s7) = G_UREM %2, %3
311 %5:_(s32) = G_ANYEXT %4(s7)
312 $x10 = COPY %5(s32)
313 PseudoRET implicit $x10
314
315 ...
316 ---
317 name: urem_i8
318 body: |
319 bb.0.entry:
320 ; CHECK-I-LABEL: name: urem_i8
321 ; CHECK-I: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
322 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
323 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
324 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
325 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
326 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
327 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s32)
328 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s32)
329 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umodsi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
330 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
331 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x10
332 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s32)
333 ; CHECK-I-NEXT: PseudoRET implicit $x10
334 ;
335 ; CHECK-M-LABEL: name: urem_i8
336 ; CHECK-M: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
337 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
338 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
339 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
340 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
341 ; CHECK-M-NEXT: [[UREM:%[0-9]+]]:_(s32) = G_UREM [[AND]], [[AND1]]
342 ; CHECK-M-NEXT: $x10 = COPY [[UREM]](s32)
343 ; CHECK-M-NEXT: PseudoRET implicit $x10
344 %0:_(s32) = COPY $x10
345 %1:_(s32) = COPY $x11
346 %2:_(s8) = G_TRUNC %0(s32)
347 %3:_(s8) = G_TRUNC %1(s32)
348 %4:_(s8) = G_UREM %2, %3
349 %5:_(s32) = G_ANYEXT %4(s8)
350 $x10 = COPY %5(s32)
351 PseudoRET implicit $x10
352
353 ...
354 ---
355 name: urem_i16
356 body: |
357 bb.0.entry:
358 ; CHECK-I-LABEL: name: urem_i16
359 ; CHECK-I: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
360 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
361 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
362 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
363 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
364 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
365 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s32)
366 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s32)
367 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umodsi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
368 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
369 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x10
370 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s32)
371 ; CHECK-I-NEXT: PseudoRET implicit $x10
372 ;
373 ; CHECK-M-LABEL: name: urem_i16
374 ; CHECK-M: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
375 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
376 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
377 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
378 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
379 ; CHECK-M-NEXT: [[UREM:%[0-9]+]]:_(s32) = G_UREM [[AND]], [[AND1]]
380 ; CHECK-M-NEXT: $x10 = COPY [[UREM]](s32)
381 ; CHECK-M-NEXT: PseudoRET implicit $x10
382 %0:_(s32) = COPY $x10
383 %1:_(s32) = COPY $x11
384 %2:_(s16) = G_TRUNC %0(s32)
385 %3:_(s16) = G_TRUNC %1(s32)
386 %4:_(s16) = G_UREM %2, %3
387 %5:_(s32) = G_ANYEXT %4(s16)
388 $x10 = COPY %5(s32)
389 PseudoRET implicit $x10
390
391 ...
392 ---
393 name: urem_i32
394 body: |
395 bb.0.entry:
396 ; CHECK-I-LABEL: name: urem_i32
397 ; CHECK-I: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
398 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
399 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
400 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s32)
401 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s32)
402 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umodsi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit-def $x10
403 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
404 ; CHECK-I-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x10
405 ; CHECK-I-NEXT: $x10 = COPY [[COPY2]](s32)
406 ; CHECK-I-NEXT: PseudoRET implicit $x10
407 ;
408 ; CHECK-M-LABEL: name: urem_i32
409 ; CHECK-M: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
410 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
411 ; CHECK-M-NEXT: [[UREM:%[0-9]+]]:_(s32) = G_UREM [[COPY]], [[COPY1]]
412 ; CHECK-M-NEXT: $x10 = COPY [[UREM]](s32)
413 ; CHECK-M-NEXT: PseudoRET implicit $x10
414 %0:_(s32) = COPY $x10
415 %1:_(s32) = COPY $x11
416 %2:_(s32) = G_UREM %0, %1
417 $x10 = COPY %2(s32)
418 PseudoRET implicit $x10
419
420 ...
421 ---
422 name: urem_i48
423 body: |
424 bb.0.entry:
425 ; CHECK-I-LABEL: name: urem_i48
426 ; CHECK-I: %xlo:_(s32) = COPY $x10
427 ; CHECK-I-NEXT: %xhi:_(s32) = COPY $x11
428 ; CHECK-I-NEXT: %ylo:_(s32) = COPY $x12
429 ; CHECK-I-NEXT: %yhi:_(s32) = COPY $x13
430 ; CHECK-I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
431 ; CHECK-I-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
432 ; CHECK-I-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %xlo, [[C]]
433 ; CHECK-I-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %xhi, [[C1]]
434 ; CHECK-I-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND %ylo, [[C]]
435 ; CHECK-I-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND %yhi, [[C1]]
436 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
437 ; CHECK-I-NEXT: $x10 = COPY [[AND]](s32)
438 ; CHECK-I-NEXT: $x11 = COPY [[AND1]](s32)
439 ; CHECK-I-NEXT: $x12 = COPY [[AND2]](s32)
440 ; CHECK-I-NEXT: $x13 = COPY [[AND3]](s32)
441 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umoddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
442 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
443 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
444 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
445 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s32)
446 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s32)
447 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
448 ;
449 ; CHECK-M-LABEL: name: urem_i48
450 ; CHECK-M: %xlo:_(s32) = COPY $x10
451 ; CHECK-M-NEXT: %xhi:_(s32) = COPY $x11
452 ; CHECK-M-NEXT: %ylo:_(s32) = COPY $x12
453 ; CHECK-M-NEXT: %yhi:_(s32) = COPY $x13
454 ; CHECK-M-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
455 ; CHECK-M-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
456 ; CHECK-M-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %xlo, [[C]]
457 ; CHECK-M-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %xhi, [[C1]]
458 ; CHECK-M-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND %ylo, [[C]]
459 ; CHECK-M-NEXT: [[AND3:%[0-9]+]]:_(s32) = G_AND %yhi, [[C1]]
460 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
461 ; CHECK-M-NEXT: $x10 = COPY [[AND]](s32)
462 ; CHECK-M-NEXT: $x11 = COPY [[AND1]](s32)
463 ; CHECK-M-NEXT: $x12 = COPY [[AND2]](s32)
464 ; CHECK-M-NEXT: $x13 = COPY [[AND3]](s32)
465 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__umoddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
466 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
467 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
468 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
469 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s32)
470 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s32)
471 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
472 %xlo:_(s32) = COPY $x10
473 %xhi:_(s32) = COPY $x11
474 %ylo:_(s32) = COPY $x12
475 %yhi:_(s32) = COPY $x13
476 %x0:_(s64) = G_MERGE_VALUES %xlo(s32), %xhi(s32)
477 %y0:_(s64) = G_MERGE_VALUES %ylo(s32), %yhi(s32)
478 %x:_(s48) = G_TRUNC %x0
479 %y:_(s48) = G_TRUNC %y0
480 %z:_(s48) = G_UREM %x, %y
481 %z0:_(s64) = G_ANYEXT %z
482 %zlo:_(s32), %zhi:_(s32) = G_UNMERGE_VALUES %z0(s64)
483 $x10 = COPY %zlo(s32)
484 $x11 = COPY %zhi(s32)
485 PseudoRET implicit $x10, implicit $x11
486
487 ...
488 ---
489 name: urem_i64
490 body: |
491 bb.0.entry:
492 ; CHECK-I-LABEL: name: urem_i64
493 ; CHECK-I: %lo1:_(s32) = COPY $x10
494 ; CHECK-I-NEXT: %hi1:_(s32) = COPY $x11
495 ; CHECK-I-NEXT: %lo2:_(s32) = COPY $x12
496 ; CHECK-I-NEXT: %hi2:_(s32) = COPY $x13
497 ; CHECK-I-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
498 ; CHECK-I-NEXT: $x10 = COPY %lo1(s32)
499 ; CHECK-I-NEXT: $x11 = COPY %hi1(s32)
500 ; CHECK-I-NEXT: $x12 = COPY %lo2(s32)
501 ; CHECK-I-NEXT: $x13 = COPY %hi2(s32)
502 ; CHECK-I-NEXT: PseudoCALL target-flags(riscv-call) &__umoddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
503 ; CHECK-I-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
504 ; CHECK-I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
505 ; CHECK-I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
506 ; CHECK-I-NEXT: $x10 = COPY [[COPY]](s32)
507 ; CHECK-I-NEXT: $x11 = COPY [[COPY1]](s32)
508 ; CHECK-I-NEXT: PseudoRET implicit $x10, implicit $x11
509 ;
510 ; CHECK-M-LABEL: name: urem_i64
511 ; CHECK-M: %lo1:_(s32) = COPY $x10
512 ; CHECK-M-NEXT: %hi1:_(s32) = COPY $x11
513 ; CHECK-M-NEXT: %lo2:_(s32) = COPY $x12
514 ; CHECK-M-NEXT: %hi2:_(s32) = COPY $x13
515 ; CHECK-M-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def $x2, implicit $x2
516 ; CHECK-M-NEXT: $x10 = COPY %lo1(s32)
517 ; CHECK-M-NEXT: $x11 = COPY %hi1(s32)
518 ; CHECK-M-NEXT: $x12 = COPY %lo2(s32)
519 ; CHECK-M-NEXT: $x13 = COPY %hi2(s32)
520 ; CHECK-M-NEXT: PseudoCALL target-flags(riscv-call) &__umoddi3, csr_ilp32_lp64, implicit-def $x1, implicit $x10, implicit $x11, implicit $x12, implicit $x13, implicit-def $x10, implicit-def $x11
521 ; CHECK-M-NEXT: ADJCALLSTACKUP 0, 0, implicit-def $x2, implicit $x2
522 ; CHECK-M-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
523 ; CHECK-M-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
524 ; CHECK-M-NEXT: $x10 = COPY [[COPY]](s32)
525 ; CHECK-M-NEXT: $x11 = COPY [[COPY1]](s32)
526 ; CHECK-M-NEXT: PseudoRET implicit $x10, implicit $x11
527 %lo1:_(s32) = COPY $x10
528 %hi1:_(s32) = COPY $x11
529 %lo2:_(s32) = COPY $x12
530 %hi2:_(s32) = COPY $x13
531 %x1:_(s64) = G_MERGE_VALUES %lo1(s32), %hi1(s32)
532 %x2:_(s64) = G_MERGE_VALUES %lo2(s32), %hi2(s32)
533 %y:_(s64) = G_UREM %x1, %x2
534 %loy:_(s32), %hiy:_(s32) = G_UNMERGE_VALUES %y(s64)
535 $x10 = COPY %loy(s32)
536 $x11 = COPY %hiy(s32)
537 PseudoRET implicit $x10, implicit $x11
538
539 ...