1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: sed 's/iXLen2/i64/g' %s | llc -mtriple=riscv32 -mattr=+m | \
3 ; RUN: FileCheck %s --check-prefix=RV32
4 ; RUN: sed 's/iXLen2/i128/g' %s | llc -mtriple=riscv64 -mattr=+m | \
5 ; RUN: FileCheck %s --check-prefix=RV64
7 define iXLen2 @test_urem_3(iXLen2 %x) nounwind {
8 ; RV32-LABEL: test_urem_3:
10 ; RV32-NEXT: addi sp, sp, -16
11 ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
14 ; RV32-NEXT: call __umoddi3@plt
15 ; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
16 ; RV32-NEXT: addi sp, sp, 16
19 ; RV64-LABEL: test_urem_3:
21 ; RV64-NEXT: addi sp, sp, -16
22 ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
25 ; RV64-NEXT: call __umodti3@plt
26 ; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
27 ; RV64-NEXT: addi sp, sp, 16
29 %a = urem iXLen2 %x, 3
33 define iXLen2 @test_urem_5(iXLen2 %x) nounwind {
34 ; RV32-LABEL: test_urem_5:
36 ; RV32-NEXT: addi sp, sp, -16
37 ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
40 ; RV32-NEXT: call __umoddi3@plt
41 ; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
42 ; RV32-NEXT: addi sp, sp, 16
45 ; RV64-LABEL: test_urem_5:
47 ; RV64-NEXT: addi sp, sp, -16
48 ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
51 ; RV64-NEXT: call __umodti3@plt
52 ; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
53 ; RV64-NEXT: addi sp, sp, 16
55 %a = urem iXLen2 %x, 5
59 define iXLen2 @test_urem_7(iXLen2 %x) nounwind {
60 ; RV32-LABEL: test_urem_7:
62 ; RV32-NEXT: addi sp, sp, -16
63 ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
66 ; RV32-NEXT: call __umoddi3@plt
67 ; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
68 ; RV32-NEXT: addi sp, sp, 16
71 ; RV64-LABEL: test_urem_7:
73 ; RV64-NEXT: addi sp, sp, -16
74 ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
77 ; RV64-NEXT: call __umodti3@plt
78 ; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
79 ; RV64-NEXT: addi sp, sp, 16
81 %a = urem iXLen2 %x, 7
85 define iXLen2 @test_urem_9(iXLen2 %x) nounwind {
86 ; RV32-LABEL: test_urem_9:
88 ; RV32-NEXT: addi sp, sp, -16
89 ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
92 ; RV32-NEXT: call __umoddi3@plt
93 ; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
94 ; RV32-NEXT: addi sp, sp, 16
97 ; RV64-LABEL: test_urem_9:
99 ; RV64-NEXT: addi sp, sp, -16
100 ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
101 ; RV64-NEXT: li a2, 9
102 ; RV64-NEXT: li a3, 0
103 ; RV64-NEXT: call __umodti3@plt
104 ; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
105 ; RV64-NEXT: addi sp, sp, 16
107 %a = urem iXLen2 %x, 9
111 define iXLen2 @test_urem_15(iXLen2 %x) nounwind {
112 ; RV32-LABEL: test_urem_15:
114 ; RV32-NEXT: addi sp, sp, -16
115 ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
116 ; RV32-NEXT: li a2, 15
117 ; RV32-NEXT: li a3, 0
118 ; RV32-NEXT: call __umoddi3@plt
119 ; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
120 ; RV32-NEXT: addi sp, sp, 16
123 ; RV64-LABEL: test_urem_15:
125 ; RV64-NEXT: addi sp, sp, -16
126 ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
127 ; RV64-NEXT: li a2, 15
128 ; RV64-NEXT: li a3, 0
129 ; RV64-NEXT: call __umodti3@plt
130 ; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
131 ; RV64-NEXT: addi sp, sp, 16
133 %a = urem iXLen2 %x, 15
137 define iXLen2 @test_urem_17(iXLen2 %x) nounwind {
138 ; RV32-LABEL: test_urem_17:
140 ; RV32-NEXT: addi sp, sp, -16
141 ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
142 ; RV32-NEXT: li a2, 17
143 ; RV32-NEXT: li a3, 0
144 ; RV32-NEXT: call __umoddi3@plt
145 ; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
146 ; RV32-NEXT: addi sp, sp, 16
149 ; RV64-LABEL: test_urem_17:
151 ; RV64-NEXT: addi sp, sp, -16
152 ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
153 ; RV64-NEXT: li a2, 17
154 ; RV64-NEXT: li a3, 0
155 ; RV64-NEXT: call __umodti3@plt
156 ; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
157 ; RV64-NEXT: addi sp, sp, 16
159 %a = urem iXLen2 %x, 17
163 define iXLen2 @test_urem_255(iXLen2 %x) nounwind {
164 ; RV32-LABEL: test_urem_255:
166 ; RV32-NEXT: addi sp, sp, -16
167 ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
168 ; RV32-NEXT: li a2, 255
169 ; RV32-NEXT: li a3, 0
170 ; RV32-NEXT: call __umoddi3@plt
171 ; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
172 ; RV32-NEXT: addi sp, sp, 16
175 ; RV64-LABEL: test_urem_255:
177 ; RV64-NEXT: addi sp, sp, -16
178 ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
179 ; RV64-NEXT: li a2, 255
180 ; RV64-NEXT: li a3, 0
181 ; RV64-NEXT: call __umodti3@plt
182 ; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
183 ; RV64-NEXT: addi sp, sp, 16
185 %a = urem iXLen2 %x, 255
189 define iXLen2 @test_urem_257(iXLen2 %x) nounwind {
190 ; RV32-LABEL: test_urem_257:
192 ; RV32-NEXT: addi sp, sp, -16
193 ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
194 ; RV32-NEXT: li a2, 257
195 ; RV32-NEXT: li a3, 0
196 ; RV32-NEXT: call __umoddi3@plt
197 ; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
198 ; RV32-NEXT: addi sp, sp, 16
201 ; RV64-LABEL: test_urem_257:
203 ; RV64-NEXT: addi sp, sp, -16
204 ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
205 ; RV64-NEXT: li a2, 257
206 ; RV64-NEXT: li a3, 0
207 ; RV64-NEXT: call __umodti3@plt
208 ; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
209 ; RV64-NEXT: addi sp, sp, 16
211 %a = urem iXLen2 %x, 257
215 define iXLen2 @test_urem_65535(iXLen2 %x) nounwind {
216 ; RV32-LABEL: test_urem_65535:
218 ; RV32-NEXT: addi sp, sp, -16
219 ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
220 ; RV32-NEXT: lui a2, 16
221 ; RV32-NEXT: addi a2, a2, -1
222 ; RV32-NEXT: li a3, 0
223 ; RV32-NEXT: call __umoddi3@plt
224 ; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
225 ; RV32-NEXT: addi sp, sp, 16
228 ; RV64-LABEL: test_urem_65535:
230 ; RV64-NEXT: addi sp, sp, -16
231 ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
232 ; RV64-NEXT: lui a2, 16
233 ; RV64-NEXT: addiw a2, a2, -1
234 ; RV64-NEXT: li a3, 0
235 ; RV64-NEXT: call __umodti3@plt
236 ; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
237 ; RV64-NEXT: addi sp, sp, 16
239 %a = urem iXLen2 %x, 65535
243 define iXLen2 @test_urem_65537(iXLen2 %x) nounwind {
244 ; RV32-LABEL: test_urem_65537:
246 ; RV32-NEXT: addi sp, sp, -16
247 ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
248 ; RV32-NEXT: lui a2, 16
249 ; RV32-NEXT: addi a2, a2, 1
250 ; RV32-NEXT: li a3, 0
251 ; RV32-NEXT: call __umoddi3@plt
252 ; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
253 ; RV32-NEXT: addi sp, sp, 16
256 ; RV64-LABEL: test_urem_65537:
258 ; RV64-NEXT: addi sp, sp, -16
259 ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
260 ; RV64-NEXT: lui a2, 16
261 ; RV64-NEXT: addiw a2, a2, 1
262 ; RV64-NEXT: li a3, 0
263 ; RV64-NEXT: call __umodti3@plt
264 ; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
265 ; RV64-NEXT: addi sp, sp, 16
267 %a = urem iXLen2 %x, 65537
271 define iXLen2 @test_urem_12(iXLen2 %x) nounwind {
272 ; RV32-LABEL: test_urem_12:
274 ; RV32-NEXT: addi sp, sp, -16
275 ; RV32-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
276 ; RV32-NEXT: li a2, 12
277 ; RV32-NEXT: li a3, 0
278 ; RV32-NEXT: call __umoddi3@plt
279 ; RV32-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
280 ; RV32-NEXT: addi sp, sp, 16
283 ; RV64-LABEL: test_urem_12:
285 ; RV64-NEXT: addi sp, sp, -16
286 ; RV64-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
287 ; RV64-NEXT: li a2, 12
288 ; RV64-NEXT: li a3, 0
289 ; RV64-NEXT: call __umodti3@plt
290 ; RV64-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
291 ; RV64-NEXT: addi sp, sp, 16
293 %a = urem iXLen2 %x, 12