1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 -mattr=+d < %s | FileCheck %s --check-prefix=LA32
3 ; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s --check-prefix=LA64
4 ; RUN: llc --mtriple=loongarch32 -mattr=+d -loongarch-check-zero-division < %s \
5 ; RUN: | FileCheck %s --check-prefix=LA32-TRAP
6 ; RUN: llc --mtriple=loongarch64 -mattr=+d -loongarch-check-zero-division < %s \
7 ; RUN: | FileCheck %s --check-prefix=LA64-TRAP
9 ;; Test the sdiv/udiv/srem/urem LLVM IR.
11 define i1 @sdiv_i1(i1 %a, i1 %b) {
12 ; LA32-LABEL: sdiv_i1:
13 ; LA32: # %bb.0: # %entry
16 ; LA64-LABEL: sdiv_i1:
17 ; LA64: # %bb.0: # %entry
20 ; LA32-TRAP-LABEL: sdiv_i1:
21 ; LA32-TRAP: # %bb.0: # %entry
24 ; LA64-TRAP-LABEL: sdiv_i1:
25 ; LA64-TRAP: # %bb.0: # %entry
32 define i8 @sdiv_i8(i8 %a, i8 %b) {
33 ; LA32-LABEL: sdiv_i8:
34 ; LA32: # %bb.0: # %entry
35 ; LA32-NEXT: ext.w.b $a1, $a1
36 ; LA32-NEXT: ext.w.b $a0, $a0
37 ; LA32-NEXT: div.w $a0, $a0, $a1
40 ; LA64-LABEL: sdiv_i8:
41 ; LA64: # %bb.0: # %entry
42 ; LA64-NEXT: ext.w.b $a1, $a1
43 ; LA64-NEXT: ext.w.b $a0, $a0
44 ; LA64-NEXT: div.d $a0, $a0, $a1
47 ; LA32-TRAP-LABEL: sdiv_i8:
48 ; LA32-TRAP: # %bb.0: # %entry
49 ; LA32-TRAP-NEXT: ext.w.b $a1, $a1
50 ; LA32-TRAP-NEXT: ext.w.b $a0, $a0
51 ; LA32-TRAP-NEXT: div.w $a0, $a0, $a1
52 ; LA32-TRAP-NEXT: bnez $a1, .LBB1_2
53 ; LA32-TRAP-NEXT: # %bb.1: # %entry
54 ; LA32-TRAP-NEXT: break 7
55 ; LA32-TRAP-NEXT: .LBB1_2: # %entry
58 ; LA64-TRAP-LABEL: sdiv_i8:
59 ; LA64-TRAP: # %bb.0: # %entry
60 ; LA64-TRAP-NEXT: ext.w.b $a1, $a1
61 ; LA64-TRAP-NEXT: ext.w.b $a0, $a0
62 ; LA64-TRAP-NEXT: div.d $a0, $a0, $a1
63 ; LA64-TRAP-NEXT: bnez $a1, .LBB1_2
64 ; LA64-TRAP-NEXT: # %bb.1: # %entry
65 ; LA64-TRAP-NEXT: break 7
66 ; LA64-TRAP-NEXT: .LBB1_2: # %entry
73 define i16 @sdiv_i16(i16 %a, i16 %b) {
74 ; LA32-LABEL: sdiv_i16:
75 ; LA32: # %bb.0: # %entry
76 ; LA32-NEXT: ext.w.h $a1, $a1
77 ; LA32-NEXT: ext.w.h $a0, $a0
78 ; LA32-NEXT: div.w $a0, $a0, $a1
81 ; LA64-LABEL: sdiv_i16:
82 ; LA64: # %bb.0: # %entry
83 ; LA64-NEXT: ext.w.h $a1, $a1
84 ; LA64-NEXT: ext.w.h $a0, $a0
85 ; LA64-NEXT: div.d $a0, $a0, $a1
88 ; LA32-TRAP-LABEL: sdiv_i16:
89 ; LA32-TRAP: # %bb.0: # %entry
90 ; LA32-TRAP-NEXT: ext.w.h $a1, $a1
91 ; LA32-TRAP-NEXT: ext.w.h $a0, $a0
92 ; LA32-TRAP-NEXT: div.w $a0, $a0, $a1
93 ; LA32-TRAP-NEXT: bnez $a1, .LBB2_2
94 ; LA32-TRAP-NEXT: # %bb.1: # %entry
95 ; LA32-TRAP-NEXT: break 7
96 ; LA32-TRAP-NEXT: .LBB2_2: # %entry
99 ; LA64-TRAP-LABEL: sdiv_i16:
100 ; LA64-TRAP: # %bb.0: # %entry
101 ; LA64-TRAP-NEXT: ext.w.h $a1, $a1
102 ; LA64-TRAP-NEXT: ext.w.h $a0, $a0
103 ; LA64-TRAP-NEXT: div.d $a0, $a0, $a1
104 ; LA64-TRAP-NEXT: bnez $a1, .LBB2_2
105 ; LA64-TRAP-NEXT: # %bb.1: # %entry
106 ; LA64-TRAP-NEXT: break 7
107 ; LA64-TRAP-NEXT: .LBB2_2: # %entry
108 ; LA64-TRAP-NEXT: ret
114 define i32 @sdiv_i32(i32 %a, i32 %b) {
115 ; LA32-LABEL: sdiv_i32:
116 ; LA32: # %bb.0: # %entry
117 ; LA32-NEXT: div.w $a0, $a0, $a1
120 ; LA64-LABEL: sdiv_i32:
121 ; LA64: # %bb.0: # %entry
122 ; LA64-NEXT: addi.w $a1, $a1, 0
123 ; LA64-NEXT: addi.w $a0, $a0, 0
124 ; LA64-NEXT: div.d $a0, $a0, $a1
127 ; LA32-TRAP-LABEL: sdiv_i32:
128 ; LA32-TRAP: # %bb.0: # %entry
129 ; LA32-TRAP-NEXT: div.w $a0, $a0, $a1
130 ; LA32-TRAP-NEXT: bnez $a1, .LBB3_2
131 ; LA32-TRAP-NEXT: # %bb.1: # %entry
132 ; LA32-TRAP-NEXT: break 7
133 ; LA32-TRAP-NEXT: .LBB3_2: # %entry
134 ; LA32-TRAP-NEXT: ret
136 ; LA64-TRAP-LABEL: sdiv_i32:
137 ; LA64-TRAP: # %bb.0: # %entry
138 ; LA64-TRAP-NEXT: addi.w $a1, $a1, 0
139 ; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
140 ; LA64-TRAP-NEXT: div.d $a0, $a0, $a1
141 ; LA64-TRAP-NEXT: bnez $a1, .LBB3_2
142 ; LA64-TRAP-NEXT: # %bb.1: # %entry
143 ; LA64-TRAP-NEXT: break 7
144 ; LA64-TRAP-NEXT: .LBB3_2: # %entry
145 ; LA64-TRAP-NEXT: ret
151 define i32 @sdiv_ui32_si32_si32(i32 signext %a, i32 signext %b) {
152 ; LA32-LABEL: sdiv_ui32_si32_si32:
153 ; LA32: # %bb.0: # %entry
154 ; LA32-NEXT: div.w $a0, $a0, $a1
157 ; LA64-LABEL: sdiv_ui32_si32_si32:
158 ; LA64: # %bb.0: # %entry
159 ; LA64-NEXT: div.d $a0, $a0, $a1
162 ; LA32-TRAP-LABEL: sdiv_ui32_si32_si32:
163 ; LA32-TRAP: # %bb.0: # %entry
164 ; LA32-TRAP-NEXT: div.w $a0, $a0, $a1
165 ; LA32-TRAP-NEXT: bnez $a1, .LBB4_2
166 ; LA32-TRAP-NEXT: # %bb.1: # %entry
167 ; LA32-TRAP-NEXT: break 7
168 ; LA32-TRAP-NEXT: .LBB4_2: # %entry
169 ; LA32-TRAP-NEXT: ret
171 ; LA64-TRAP-LABEL: sdiv_ui32_si32_si32:
172 ; LA64-TRAP: # %bb.0: # %entry
173 ; LA64-TRAP-NEXT: div.d $a0, $a0, $a1
174 ; LA64-TRAP-NEXT: bnez $a1, .LBB4_2
175 ; LA64-TRAP-NEXT: # %bb.1: # %entry
176 ; LA64-TRAP-NEXT: break 7
177 ; LA64-TRAP-NEXT: .LBB4_2: # %entry
178 ; LA64-TRAP-NEXT: ret
184 define signext i32 @sdiv_si32_ui32_ui32(i32 %a, i32 %b) {
185 ; LA32-LABEL: sdiv_si32_ui32_ui32:
186 ; LA32: # %bb.0: # %entry
187 ; LA32-NEXT: div.w $a0, $a0, $a1
190 ; LA64-LABEL: sdiv_si32_ui32_ui32:
191 ; LA64: # %bb.0: # %entry
192 ; LA64-NEXT: addi.w $a1, $a1, 0
193 ; LA64-NEXT: addi.w $a0, $a0, 0
194 ; LA64-NEXT: div.w $a0, $a0, $a1
197 ; LA32-TRAP-LABEL: sdiv_si32_ui32_ui32:
198 ; LA32-TRAP: # %bb.0: # %entry
199 ; LA32-TRAP-NEXT: div.w $a0, $a0, $a1
200 ; LA32-TRAP-NEXT: bnez $a1, .LBB5_2
201 ; LA32-TRAP-NEXT: # %bb.1: # %entry
202 ; LA32-TRAP-NEXT: break 7
203 ; LA32-TRAP-NEXT: .LBB5_2: # %entry
204 ; LA32-TRAP-NEXT: ret
206 ; LA64-TRAP-LABEL: sdiv_si32_ui32_ui32:
207 ; LA64-TRAP: # %bb.0: # %entry
208 ; LA64-TRAP-NEXT: addi.w $a1, $a1, 0
209 ; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
210 ; LA64-TRAP-NEXT: div.w $a0, $a0, $a1
211 ; LA64-TRAP-NEXT: bnez $a1, .LBB5_2
212 ; LA64-TRAP-NEXT: # %bb.1: # %entry
213 ; LA64-TRAP-NEXT: break 7
214 ; LA64-TRAP-NEXT: .LBB5_2: # %entry
215 ; LA64-TRAP-NEXT: ret
221 define signext i32 @sdiv_si32_si32_si32(i32 signext %a, i32 signext %b) {
222 ; LA32-LABEL: sdiv_si32_si32_si32:
223 ; LA32: # %bb.0: # %entry
224 ; LA32-NEXT: div.w $a0, $a0, $a1
227 ; LA64-LABEL: sdiv_si32_si32_si32:
228 ; LA64: # %bb.0: # %entry
229 ; LA64-NEXT: div.w $a0, $a0, $a1
232 ; LA32-TRAP-LABEL: sdiv_si32_si32_si32:
233 ; LA32-TRAP: # %bb.0: # %entry
234 ; LA32-TRAP-NEXT: div.w $a0, $a0, $a1
235 ; LA32-TRAP-NEXT: bnez $a1, .LBB6_2
236 ; LA32-TRAP-NEXT: # %bb.1: # %entry
237 ; LA32-TRAP-NEXT: break 7
238 ; LA32-TRAP-NEXT: .LBB6_2: # %entry
239 ; LA32-TRAP-NEXT: ret
241 ; LA64-TRAP-LABEL: sdiv_si32_si32_si32:
242 ; LA64-TRAP: # %bb.0: # %entry
243 ; LA64-TRAP-NEXT: div.w $a0, $a0, $a1
244 ; LA64-TRAP-NEXT: bnez $a1, .LBB6_2
245 ; LA64-TRAP-NEXT: # %bb.1: # %entry
246 ; LA64-TRAP-NEXT: break 7
247 ; LA64-TRAP-NEXT: .LBB6_2: # %entry
248 ; LA64-TRAP-NEXT: ret
254 define i64 @sdiv_i64(i64 %a, i64 %b) {
255 ; LA32-LABEL: sdiv_i64:
256 ; LA32: # %bb.0: # %entry
257 ; LA32-NEXT: addi.w $sp, $sp, -16
258 ; LA32-NEXT: .cfi_def_cfa_offset 16
259 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
260 ; LA32-NEXT: .cfi_offset 1, -4
261 ; LA32-NEXT: bl %plt(__divdi3)
262 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
263 ; LA32-NEXT: addi.w $sp, $sp, 16
266 ; LA64-LABEL: sdiv_i64:
267 ; LA64: # %bb.0: # %entry
268 ; LA64-NEXT: div.d $a0, $a0, $a1
271 ; LA32-TRAP-LABEL: sdiv_i64:
272 ; LA32-TRAP: # %bb.0: # %entry
273 ; LA32-TRAP-NEXT: addi.w $sp, $sp, -16
274 ; LA32-TRAP-NEXT: .cfi_def_cfa_offset 16
275 ; LA32-TRAP-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
276 ; LA32-TRAP-NEXT: .cfi_offset 1, -4
277 ; LA32-TRAP-NEXT: bl %plt(__divdi3)
278 ; LA32-TRAP-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
279 ; LA32-TRAP-NEXT: addi.w $sp, $sp, 16
280 ; LA32-TRAP-NEXT: ret
282 ; LA64-TRAP-LABEL: sdiv_i64:
283 ; LA64-TRAP: # %bb.0: # %entry
284 ; LA64-TRAP-NEXT: div.d $a0, $a0, $a1
285 ; LA64-TRAP-NEXT: bnez $a1, .LBB7_2
286 ; LA64-TRAP-NEXT: # %bb.1: # %entry
287 ; LA64-TRAP-NEXT: break 7
288 ; LA64-TRAP-NEXT: .LBB7_2: # %entry
289 ; LA64-TRAP-NEXT: ret
295 define i1 @udiv_i1(i1 %a, i1 %b) {
296 ; LA32-LABEL: udiv_i1:
297 ; LA32: # %bb.0: # %entry
300 ; LA64-LABEL: udiv_i1:
301 ; LA64: # %bb.0: # %entry
304 ; LA32-TRAP-LABEL: udiv_i1:
305 ; LA32-TRAP: # %bb.0: # %entry
306 ; LA32-TRAP-NEXT: ret
308 ; LA64-TRAP-LABEL: udiv_i1:
309 ; LA64-TRAP: # %bb.0: # %entry
310 ; LA64-TRAP-NEXT: ret
316 define i8 @udiv_i8(i8 %a, i8 %b) {
317 ; LA32-LABEL: udiv_i8:
318 ; LA32: # %bb.0: # %entry
319 ; LA32-NEXT: andi $a1, $a1, 255
320 ; LA32-NEXT: andi $a0, $a0, 255
321 ; LA32-NEXT: div.wu $a0, $a0, $a1
324 ; LA64-LABEL: udiv_i8:
325 ; LA64: # %bb.0: # %entry
326 ; LA64-NEXT: andi $a1, $a1, 255
327 ; LA64-NEXT: andi $a0, $a0, 255
328 ; LA64-NEXT: div.du $a0, $a0, $a1
331 ; LA32-TRAP-LABEL: udiv_i8:
332 ; LA32-TRAP: # %bb.0: # %entry
333 ; LA32-TRAP-NEXT: andi $a1, $a1, 255
334 ; LA32-TRAP-NEXT: andi $a0, $a0, 255
335 ; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
336 ; LA32-TRAP-NEXT: bnez $a1, .LBB9_2
337 ; LA32-TRAP-NEXT: # %bb.1: # %entry
338 ; LA32-TRAP-NEXT: break 7
339 ; LA32-TRAP-NEXT: .LBB9_2: # %entry
340 ; LA32-TRAP-NEXT: ret
342 ; LA64-TRAP-LABEL: udiv_i8:
343 ; LA64-TRAP: # %bb.0: # %entry
344 ; LA64-TRAP-NEXT: andi $a1, $a1, 255
345 ; LA64-TRAP-NEXT: andi $a0, $a0, 255
346 ; LA64-TRAP-NEXT: div.du $a0, $a0, $a1
347 ; LA64-TRAP-NEXT: bnez $a1, .LBB9_2
348 ; LA64-TRAP-NEXT: # %bb.1: # %entry
349 ; LA64-TRAP-NEXT: break 7
350 ; LA64-TRAP-NEXT: .LBB9_2: # %entry
351 ; LA64-TRAP-NEXT: ret
357 define i16 @udiv_i16(i16 %a, i16 %b) {
358 ; LA32-LABEL: udiv_i16:
359 ; LA32: # %bb.0: # %entry
360 ; LA32-NEXT: bstrpick.w $a1, $a1, 15, 0
361 ; LA32-NEXT: bstrpick.w $a0, $a0, 15, 0
362 ; LA32-NEXT: div.wu $a0, $a0, $a1
365 ; LA64-LABEL: udiv_i16:
366 ; LA64: # %bb.0: # %entry
367 ; LA64-NEXT: bstrpick.d $a1, $a1, 15, 0
368 ; LA64-NEXT: bstrpick.d $a0, $a0, 15, 0
369 ; LA64-NEXT: div.du $a0, $a0, $a1
372 ; LA32-TRAP-LABEL: udiv_i16:
373 ; LA32-TRAP: # %bb.0: # %entry
374 ; LA32-TRAP-NEXT: bstrpick.w $a1, $a1, 15, 0
375 ; LA32-TRAP-NEXT: bstrpick.w $a0, $a0, 15, 0
376 ; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
377 ; LA32-TRAP-NEXT: bnez $a1, .LBB10_2
378 ; LA32-TRAP-NEXT: # %bb.1: # %entry
379 ; LA32-TRAP-NEXT: break 7
380 ; LA32-TRAP-NEXT: .LBB10_2: # %entry
381 ; LA32-TRAP-NEXT: ret
383 ; LA64-TRAP-LABEL: udiv_i16:
384 ; LA64-TRAP: # %bb.0: # %entry
385 ; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 15, 0
386 ; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 15, 0
387 ; LA64-TRAP-NEXT: div.du $a0, $a0, $a1
388 ; LA64-TRAP-NEXT: bnez $a1, .LBB10_2
389 ; LA64-TRAP-NEXT: # %bb.1: # %entry
390 ; LA64-TRAP-NEXT: break 7
391 ; LA64-TRAP-NEXT: .LBB10_2: # %entry
392 ; LA64-TRAP-NEXT: ret
398 define i32 @udiv_i32(i32 %a, i32 %b) {
399 ; LA32-LABEL: udiv_i32:
400 ; LA32: # %bb.0: # %entry
401 ; LA32-NEXT: div.wu $a0, $a0, $a1
404 ; LA64-LABEL: udiv_i32:
405 ; LA64: # %bb.0: # %entry
406 ; LA64-NEXT: addi.w $a1, $a1, 0
407 ; LA64-NEXT: addi.w $a0, $a0, 0
408 ; LA64-NEXT: div.wu $a0, $a0, $a1
411 ; LA32-TRAP-LABEL: udiv_i32:
412 ; LA32-TRAP: # %bb.0: # %entry
413 ; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
414 ; LA32-TRAP-NEXT: bnez $a1, .LBB11_2
415 ; LA32-TRAP-NEXT: # %bb.1: # %entry
416 ; LA32-TRAP-NEXT: break 7
417 ; LA32-TRAP-NEXT: .LBB11_2: # %entry
418 ; LA32-TRAP-NEXT: ret
420 ; LA64-TRAP-LABEL: udiv_i32:
421 ; LA64-TRAP: # %bb.0: # %entry
422 ; LA64-TRAP-NEXT: addi.w $a1, $a1, 0
423 ; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
424 ; LA64-TRAP-NEXT: div.wu $a0, $a0, $a1
425 ; LA64-TRAP-NEXT: bnez $a1, .LBB11_2
426 ; LA64-TRAP-NEXT: # %bb.1: # %entry
427 ; LA64-TRAP-NEXT: break 7
428 ; LA64-TRAP-NEXT: .LBB11_2: # %entry
429 ; LA64-TRAP-NEXT: ret
435 define i32 @udiv_ui32_si32_si32(i32 signext %a, i32 signext %b) {
436 ; LA32-LABEL: udiv_ui32_si32_si32:
437 ; LA32: # %bb.0: # %entry
438 ; LA32-NEXT: div.wu $a0, $a0, $a1
441 ; LA64-LABEL: udiv_ui32_si32_si32:
442 ; LA64: # %bb.0: # %entry
443 ; LA64-NEXT: div.wu $a0, $a0, $a1
446 ; LA32-TRAP-LABEL: udiv_ui32_si32_si32:
447 ; LA32-TRAP: # %bb.0: # %entry
448 ; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
449 ; LA32-TRAP-NEXT: bnez $a1, .LBB12_2
450 ; LA32-TRAP-NEXT: # %bb.1: # %entry
451 ; LA32-TRAP-NEXT: break 7
452 ; LA32-TRAP-NEXT: .LBB12_2: # %entry
453 ; LA32-TRAP-NEXT: ret
455 ; LA64-TRAP-LABEL: udiv_ui32_si32_si32:
456 ; LA64-TRAP: # %bb.0: # %entry
457 ; LA64-TRAP-NEXT: div.wu $a0, $a0, $a1
458 ; LA64-TRAP-NEXT: bnez $a1, .LBB12_2
459 ; LA64-TRAP-NEXT: # %bb.1: # %entry
460 ; LA64-TRAP-NEXT: break 7
461 ; LA64-TRAP-NEXT: .LBB12_2: # %entry
462 ; LA64-TRAP-NEXT: ret
468 define signext i32 @udiv_si32_ui32_ui32(i32 %a, i32 %b) {
469 ; LA32-LABEL: udiv_si32_ui32_ui32:
470 ; LA32: # %bb.0: # %entry
471 ; LA32-NEXT: div.wu $a0, $a0, $a1
474 ; LA64-LABEL: udiv_si32_ui32_ui32:
475 ; LA64: # %bb.0: # %entry
476 ; LA64-NEXT: addi.w $a1, $a1, 0
477 ; LA64-NEXT: addi.w $a0, $a0, 0
478 ; LA64-NEXT: div.wu $a0, $a0, $a1
481 ; LA32-TRAP-LABEL: udiv_si32_ui32_ui32:
482 ; LA32-TRAP: # %bb.0: # %entry
483 ; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
484 ; LA32-TRAP-NEXT: bnez $a1, .LBB13_2
485 ; LA32-TRAP-NEXT: # %bb.1: # %entry
486 ; LA32-TRAP-NEXT: break 7
487 ; LA32-TRAP-NEXT: .LBB13_2: # %entry
488 ; LA32-TRAP-NEXT: ret
490 ; LA64-TRAP-LABEL: udiv_si32_ui32_ui32:
491 ; LA64-TRAP: # %bb.0: # %entry
492 ; LA64-TRAP-NEXT: addi.w $a1, $a1, 0
493 ; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
494 ; LA64-TRAP-NEXT: div.wu $a0, $a0, $a1
495 ; LA64-TRAP-NEXT: bnez $a1, .LBB13_2
496 ; LA64-TRAP-NEXT: # %bb.1: # %entry
497 ; LA64-TRAP-NEXT: break 7
498 ; LA64-TRAP-NEXT: .LBB13_2: # %entry
499 ; LA64-TRAP-NEXT: ret
505 define signext i32 @udiv_si32_si32_si32(i32 signext %a, i32 signext %b) {
506 ; LA32-LABEL: udiv_si32_si32_si32:
507 ; LA32: # %bb.0: # %entry
508 ; LA32-NEXT: div.wu $a0, $a0, $a1
511 ; LA64-LABEL: udiv_si32_si32_si32:
512 ; LA64: # %bb.0: # %entry
513 ; LA64-NEXT: div.wu $a0, $a0, $a1
516 ; LA32-TRAP-LABEL: udiv_si32_si32_si32:
517 ; LA32-TRAP: # %bb.0: # %entry
518 ; LA32-TRAP-NEXT: div.wu $a0, $a0, $a1
519 ; LA32-TRAP-NEXT: bnez $a1, .LBB14_2
520 ; LA32-TRAP-NEXT: # %bb.1: # %entry
521 ; LA32-TRAP-NEXT: break 7
522 ; LA32-TRAP-NEXT: .LBB14_2: # %entry
523 ; LA32-TRAP-NEXT: ret
525 ; LA64-TRAP-LABEL: udiv_si32_si32_si32:
526 ; LA64-TRAP: # %bb.0: # %entry
527 ; LA64-TRAP-NEXT: div.wu $a0, $a0, $a1
528 ; LA64-TRAP-NEXT: bnez $a1, .LBB14_2
529 ; LA64-TRAP-NEXT: # %bb.1: # %entry
530 ; LA64-TRAP-NEXT: break 7
531 ; LA64-TRAP-NEXT: .LBB14_2: # %entry
532 ; LA64-TRAP-NEXT: ret
538 define i64 @udiv_i64(i64 %a, i64 %b) {
539 ; LA32-LABEL: udiv_i64:
540 ; LA32: # %bb.0: # %entry
541 ; LA32-NEXT: addi.w $sp, $sp, -16
542 ; LA32-NEXT: .cfi_def_cfa_offset 16
543 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
544 ; LA32-NEXT: .cfi_offset 1, -4
545 ; LA32-NEXT: bl %plt(__udivdi3)
546 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
547 ; LA32-NEXT: addi.w $sp, $sp, 16
550 ; LA64-LABEL: udiv_i64:
551 ; LA64: # %bb.0: # %entry
552 ; LA64-NEXT: div.du $a0, $a0, $a1
555 ; LA32-TRAP-LABEL: udiv_i64:
556 ; LA32-TRAP: # %bb.0: # %entry
557 ; LA32-TRAP-NEXT: addi.w $sp, $sp, -16
558 ; LA32-TRAP-NEXT: .cfi_def_cfa_offset 16
559 ; LA32-TRAP-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
560 ; LA32-TRAP-NEXT: .cfi_offset 1, -4
561 ; LA32-TRAP-NEXT: bl %plt(__udivdi3)
562 ; LA32-TRAP-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
563 ; LA32-TRAP-NEXT: addi.w $sp, $sp, 16
564 ; LA32-TRAP-NEXT: ret
566 ; LA64-TRAP-LABEL: udiv_i64:
567 ; LA64-TRAP: # %bb.0: # %entry
568 ; LA64-TRAP-NEXT: div.du $a0, $a0, $a1
569 ; LA64-TRAP-NEXT: bnez $a1, .LBB15_2
570 ; LA64-TRAP-NEXT: # %bb.1: # %entry
571 ; LA64-TRAP-NEXT: break 7
572 ; LA64-TRAP-NEXT: .LBB15_2: # %entry
573 ; LA64-TRAP-NEXT: ret
579 define i1 @srem_i1(i1 %a, i1 %b) {
580 ; LA32-LABEL: srem_i1:
581 ; LA32: # %bb.0: # %entry
582 ; LA32-NEXT: move $a0, $zero
585 ; LA64-LABEL: srem_i1:
586 ; LA64: # %bb.0: # %entry
587 ; LA64-NEXT: move $a0, $zero
590 ; LA32-TRAP-LABEL: srem_i1:
591 ; LA32-TRAP: # %bb.0: # %entry
592 ; LA32-TRAP-NEXT: move $a0, $zero
593 ; LA32-TRAP-NEXT: ret
595 ; LA64-TRAP-LABEL: srem_i1:
596 ; LA64-TRAP: # %bb.0: # %entry
597 ; LA64-TRAP-NEXT: move $a0, $zero
598 ; LA64-TRAP-NEXT: ret
604 define i8 @srem_i8(i8 %a, i8 %b) {
605 ; LA32-LABEL: srem_i8:
606 ; LA32: # %bb.0: # %entry
607 ; LA32-NEXT: ext.w.b $a1, $a1
608 ; LA32-NEXT: ext.w.b $a0, $a0
609 ; LA32-NEXT: mod.w $a0, $a0, $a1
612 ; LA64-LABEL: srem_i8:
613 ; LA64: # %bb.0: # %entry
614 ; LA64-NEXT: ext.w.b $a1, $a1
615 ; LA64-NEXT: ext.w.b $a0, $a0
616 ; LA64-NEXT: mod.d $a0, $a0, $a1
619 ; LA32-TRAP-LABEL: srem_i8:
620 ; LA32-TRAP: # %bb.0: # %entry
621 ; LA32-TRAP-NEXT: ext.w.b $a1, $a1
622 ; LA32-TRAP-NEXT: ext.w.b $a0, $a0
623 ; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
624 ; LA32-TRAP-NEXT: bnez $a1, .LBB17_2
625 ; LA32-TRAP-NEXT: # %bb.1: # %entry
626 ; LA32-TRAP-NEXT: break 7
627 ; LA32-TRAP-NEXT: .LBB17_2: # %entry
628 ; LA32-TRAP-NEXT: ret
630 ; LA64-TRAP-LABEL: srem_i8:
631 ; LA64-TRAP: # %bb.0: # %entry
632 ; LA64-TRAP-NEXT: ext.w.b $a1, $a1
633 ; LA64-TRAP-NEXT: ext.w.b $a0, $a0
634 ; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
635 ; LA64-TRAP-NEXT: bnez $a1, .LBB17_2
636 ; LA64-TRAP-NEXT: # %bb.1: # %entry
637 ; LA64-TRAP-NEXT: break 7
638 ; LA64-TRAP-NEXT: .LBB17_2: # %entry
639 ; LA64-TRAP-NEXT: ret
645 define i16 @srem_i16(i16 %a, i16 %b) {
646 ; LA32-LABEL: srem_i16:
647 ; LA32: # %bb.0: # %entry
648 ; LA32-NEXT: ext.w.h $a1, $a1
649 ; LA32-NEXT: ext.w.h $a0, $a0
650 ; LA32-NEXT: mod.w $a0, $a0, $a1
653 ; LA64-LABEL: srem_i16:
654 ; LA64: # %bb.0: # %entry
655 ; LA64-NEXT: ext.w.h $a1, $a1
656 ; LA64-NEXT: ext.w.h $a0, $a0
657 ; LA64-NEXT: mod.d $a0, $a0, $a1
660 ; LA32-TRAP-LABEL: srem_i16:
661 ; LA32-TRAP: # %bb.0: # %entry
662 ; LA32-TRAP-NEXT: ext.w.h $a1, $a1
663 ; LA32-TRAP-NEXT: ext.w.h $a0, $a0
664 ; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
665 ; LA32-TRAP-NEXT: bnez $a1, .LBB18_2
666 ; LA32-TRAP-NEXT: # %bb.1: # %entry
667 ; LA32-TRAP-NEXT: break 7
668 ; LA32-TRAP-NEXT: .LBB18_2: # %entry
669 ; LA32-TRAP-NEXT: ret
671 ; LA64-TRAP-LABEL: srem_i16:
672 ; LA64-TRAP: # %bb.0: # %entry
673 ; LA64-TRAP-NEXT: ext.w.h $a1, $a1
674 ; LA64-TRAP-NEXT: ext.w.h $a0, $a0
675 ; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
676 ; LA64-TRAP-NEXT: bnez $a1, .LBB18_2
677 ; LA64-TRAP-NEXT: # %bb.1: # %entry
678 ; LA64-TRAP-NEXT: break 7
679 ; LA64-TRAP-NEXT: .LBB18_2: # %entry
680 ; LA64-TRAP-NEXT: ret
686 define i32 @srem_i32(i32 %a, i32 %b) {
687 ; LA32-LABEL: srem_i32:
688 ; LA32: # %bb.0: # %entry
689 ; LA32-NEXT: mod.w $a0, $a0, $a1
692 ; LA64-LABEL: srem_i32:
693 ; LA64: # %bb.0: # %entry
694 ; LA64-NEXT: addi.w $a1, $a1, 0
695 ; LA64-NEXT: addi.w $a0, $a0, 0
696 ; LA64-NEXT: mod.d $a0, $a0, $a1
699 ; LA32-TRAP-LABEL: srem_i32:
700 ; LA32-TRAP: # %bb.0: # %entry
701 ; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
702 ; LA32-TRAP-NEXT: bnez $a1, .LBB19_2
703 ; LA32-TRAP-NEXT: # %bb.1: # %entry
704 ; LA32-TRAP-NEXT: break 7
705 ; LA32-TRAP-NEXT: .LBB19_2: # %entry
706 ; LA32-TRAP-NEXT: ret
708 ; LA64-TRAP-LABEL: srem_i32:
709 ; LA64-TRAP: # %bb.0: # %entry
710 ; LA64-TRAP-NEXT: addi.w $a1, $a1, 0
711 ; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
712 ; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
713 ; LA64-TRAP-NEXT: bnez $a1, .LBB19_2
714 ; LA64-TRAP-NEXT: # %bb.1: # %entry
715 ; LA64-TRAP-NEXT: break 7
716 ; LA64-TRAP-NEXT: .LBB19_2: # %entry
717 ; LA64-TRAP-NEXT: ret
723 define i32 @srem_ui32_si32_si32(i32 signext %a, i32 signext %b) {
724 ; LA32-LABEL: srem_ui32_si32_si32:
725 ; LA32: # %bb.0: # %entry
726 ; LA32-NEXT: mod.w $a0, $a0, $a1
729 ; LA64-LABEL: srem_ui32_si32_si32:
730 ; LA64: # %bb.0: # %entry
731 ; LA64-NEXT: mod.d $a0, $a0, $a1
734 ; LA32-TRAP-LABEL: srem_ui32_si32_si32:
735 ; LA32-TRAP: # %bb.0: # %entry
736 ; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
737 ; LA32-TRAP-NEXT: bnez $a1, .LBB20_2
738 ; LA32-TRAP-NEXT: # %bb.1: # %entry
739 ; LA32-TRAP-NEXT: break 7
740 ; LA32-TRAP-NEXT: .LBB20_2: # %entry
741 ; LA32-TRAP-NEXT: ret
743 ; LA64-TRAP-LABEL: srem_ui32_si32_si32:
744 ; LA64-TRAP: # %bb.0: # %entry
745 ; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
746 ; LA64-TRAP-NEXT: bnez $a1, .LBB20_2
747 ; LA64-TRAP-NEXT: # %bb.1: # %entry
748 ; LA64-TRAP-NEXT: break 7
749 ; LA64-TRAP-NEXT: .LBB20_2: # %entry
750 ; LA64-TRAP-NEXT: ret
756 define signext i32 @srem_si32_ui32_ui32(i32 %a, i32 %b) {
757 ; LA32-LABEL: srem_si32_ui32_ui32:
758 ; LA32: # %bb.0: # %entry
759 ; LA32-NEXT: mod.w $a0, $a0, $a1
762 ; LA64-LABEL: srem_si32_ui32_ui32:
763 ; LA64: # %bb.0: # %entry
764 ; LA64-NEXT: addi.w $a1, $a1, 0
765 ; LA64-NEXT: addi.w $a0, $a0, 0
766 ; LA64-NEXT: mod.d $a0, $a0, $a1
769 ; LA32-TRAP-LABEL: srem_si32_ui32_ui32:
770 ; LA32-TRAP: # %bb.0: # %entry
771 ; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
772 ; LA32-TRAP-NEXT: bnez $a1, .LBB21_2
773 ; LA32-TRAP-NEXT: # %bb.1: # %entry
774 ; LA32-TRAP-NEXT: break 7
775 ; LA32-TRAP-NEXT: .LBB21_2: # %entry
776 ; LA32-TRAP-NEXT: ret
778 ; LA64-TRAP-LABEL: srem_si32_ui32_ui32:
779 ; LA64-TRAP: # %bb.0: # %entry
780 ; LA64-TRAP-NEXT: addi.w $a1, $a1, 0
781 ; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
782 ; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
783 ; LA64-TRAP-NEXT: bnez $a1, .LBB21_2
784 ; LA64-TRAP-NEXT: # %bb.1: # %entry
785 ; LA64-TRAP-NEXT: break 7
786 ; LA64-TRAP-NEXT: .LBB21_2: # %entry
787 ; LA64-TRAP-NEXT: ret
793 define signext i32 @srem_si32_si32_si32(i32 signext %a, i32 signext %b) {
794 ; LA32-LABEL: srem_si32_si32_si32:
795 ; LA32: # %bb.0: # %entry
796 ; LA32-NEXT: mod.w $a0, $a0, $a1
799 ; LA64-LABEL: srem_si32_si32_si32:
800 ; LA64: # %bb.0: # %entry
801 ; LA64-NEXT: mod.d $a0, $a0, $a1
804 ; LA32-TRAP-LABEL: srem_si32_si32_si32:
805 ; LA32-TRAP: # %bb.0: # %entry
806 ; LA32-TRAP-NEXT: mod.w $a0, $a0, $a1
807 ; LA32-TRAP-NEXT: bnez $a1, .LBB22_2
808 ; LA32-TRAP-NEXT: # %bb.1: # %entry
809 ; LA32-TRAP-NEXT: break 7
810 ; LA32-TRAP-NEXT: .LBB22_2: # %entry
811 ; LA32-TRAP-NEXT: ret
813 ; LA64-TRAP-LABEL: srem_si32_si32_si32:
814 ; LA64-TRAP: # %bb.0: # %entry
815 ; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
816 ; LA64-TRAP-NEXT: bnez $a1, .LBB22_2
817 ; LA64-TRAP-NEXT: # %bb.1: # %entry
818 ; LA64-TRAP-NEXT: break 7
819 ; LA64-TRAP-NEXT: .LBB22_2: # %entry
820 ; LA64-TRAP-NEXT: ret
826 define i64 @srem_i64(i64 %a, i64 %b) {
827 ; LA32-LABEL: srem_i64:
828 ; LA32: # %bb.0: # %entry
829 ; LA32-NEXT: addi.w $sp, $sp, -16
830 ; LA32-NEXT: .cfi_def_cfa_offset 16
831 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
832 ; LA32-NEXT: .cfi_offset 1, -4
833 ; LA32-NEXT: bl %plt(__moddi3)
834 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
835 ; LA32-NEXT: addi.w $sp, $sp, 16
838 ; LA64-LABEL: srem_i64:
839 ; LA64: # %bb.0: # %entry
840 ; LA64-NEXT: mod.d $a0, $a0, $a1
843 ; LA32-TRAP-LABEL: srem_i64:
844 ; LA32-TRAP: # %bb.0: # %entry
845 ; LA32-TRAP-NEXT: addi.w $sp, $sp, -16
846 ; LA32-TRAP-NEXT: .cfi_def_cfa_offset 16
847 ; LA32-TRAP-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
848 ; LA32-TRAP-NEXT: .cfi_offset 1, -4
849 ; LA32-TRAP-NEXT: bl %plt(__moddi3)
850 ; LA32-TRAP-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
851 ; LA32-TRAP-NEXT: addi.w $sp, $sp, 16
852 ; LA32-TRAP-NEXT: ret
854 ; LA64-TRAP-LABEL: srem_i64:
855 ; LA64-TRAP: # %bb.0: # %entry
856 ; LA64-TRAP-NEXT: mod.d $a0, $a0, $a1
857 ; LA64-TRAP-NEXT: bnez $a1, .LBB23_2
858 ; LA64-TRAP-NEXT: # %bb.1: # %entry
859 ; LA64-TRAP-NEXT: break 7
860 ; LA64-TRAP-NEXT: .LBB23_2: # %entry
861 ; LA64-TRAP-NEXT: ret
867 define i1 @urem_i1(i1 %a, i1 %b) {
868 ; LA32-LABEL: urem_i1:
869 ; LA32: # %bb.0: # %entry
870 ; LA32-NEXT: move $a0, $zero
873 ; LA64-LABEL: urem_i1:
874 ; LA64: # %bb.0: # %entry
875 ; LA64-NEXT: move $a0, $zero
878 ; LA32-TRAP-LABEL: urem_i1:
879 ; LA32-TRAP: # %bb.0: # %entry
880 ; LA32-TRAP-NEXT: move $a0, $zero
881 ; LA32-TRAP-NEXT: ret
883 ; LA64-TRAP-LABEL: urem_i1:
884 ; LA64-TRAP: # %bb.0: # %entry
885 ; LA64-TRAP-NEXT: move $a0, $zero
886 ; LA64-TRAP-NEXT: ret
892 define i8 @urem_i8(i8 %a, i8 %b) {
893 ; LA32-LABEL: urem_i8:
894 ; LA32: # %bb.0: # %entry
895 ; LA32-NEXT: andi $a1, $a1, 255
896 ; LA32-NEXT: andi $a0, $a0, 255
897 ; LA32-NEXT: mod.wu $a0, $a0, $a1
900 ; LA64-LABEL: urem_i8:
901 ; LA64: # %bb.0: # %entry
902 ; LA64-NEXT: andi $a1, $a1, 255
903 ; LA64-NEXT: andi $a0, $a0, 255
904 ; LA64-NEXT: mod.du $a0, $a0, $a1
907 ; LA32-TRAP-LABEL: urem_i8:
908 ; LA32-TRAP: # %bb.0: # %entry
909 ; LA32-TRAP-NEXT: andi $a1, $a1, 255
910 ; LA32-TRAP-NEXT: andi $a0, $a0, 255
911 ; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
912 ; LA32-TRAP-NEXT: bnez $a1, .LBB25_2
913 ; LA32-TRAP-NEXT: # %bb.1: # %entry
914 ; LA32-TRAP-NEXT: break 7
915 ; LA32-TRAP-NEXT: .LBB25_2: # %entry
916 ; LA32-TRAP-NEXT: ret
918 ; LA64-TRAP-LABEL: urem_i8:
919 ; LA64-TRAP: # %bb.0: # %entry
920 ; LA64-TRAP-NEXT: andi $a1, $a1, 255
921 ; LA64-TRAP-NEXT: andi $a0, $a0, 255
922 ; LA64-TRAP-NEXT: mod.du $a0, $a0, $a1
923 ; LA64-TRAP-NEXT: bnez $a1, .LBB25_2
924 ; LA64-TRAP-NEXT: # %bb.1: # %entry
925 ; LA64-TRAP-NEXT: break 7
926 ; LA64-TRAP-NEXT: .LBB25_2: # %entry
927 ; LA64-TRAP-NEXT: ret
933 define i16 @urem_i16(i16 %a, i16 %b) {
934 ; LA32-LABEL: urem_i16:
935 ; LA32: # %bb.0: # %entry
936 ; LA32-NEXT: bstrpick.w $a1, $a1, 15, 0
937 ; LA32-NEXT: bstrpick.w $a0, $a0, 15, 0
938 ; LA32-NEXT: mod.wu $a0, $a0, $a1
941 ; LA64-LABEL: urem_i16:
942 ; LA64: # %bb.0: # %entry
943 ; LA64-NEXT: bstrpick.d $a1, $a1, 15, 0
944 ; LA64-NEXT: bstrpick.d $a0, $a0, 15, 0
945 ; LA64-NEXT: mod.du $a0, $a0, $a1
948 ; LA32-TRAP-LABEL: urem_i16:
949 ; LA32-TRAP: # %bb.0: # %entry
950 ; LA32-TRAP-NEXT: bstrpick.w $a1, $a1, 15, 0
951 ; LA32-TRAP-NEXT: bstrpick.w $a0, $a0, 15, 0
952 ; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
953 ; LA32-TRAP-NEXT: bnez $a1, .LBB26_2
954 ; LA32-TRAP-NEXT: # %bb.1: # %entry
955 ; LA32-TRAP-NEXT: break 7
956 ; LA32-TRAP-NEXT: .LBB26_2: # %entry
957 ; LA32-TRAP-NEXT: ret
959 ; LA64-TRAP-LABEL: urem_i16:
960 ; LA64-TRAP: # %bb.0: # %entry
961 ; LA64-TRAP-NEXT: bstrpick.d $a1, $a1, 15, 0
962 ; LA64-TRAP-NEXT: bstrpick.d $a0, $a0, 15, 0
963 ; LA64-TRAP-NEXT: mod.du $a0, $a0, $a1
964 ; LA64-TRAP-NEXT: bnez $a1, .LBB26_2
965 ; LA64-TRAP-NEXT: # %bb.1: # %entry
966 ; LA64-TRAP-NEXT: break 7
967 ; LA64-TRAP-NEXT: .LBB26_2: # %entry
968 ; LA64-TRAP-NEXT: ret
974 define i32 @urem_i32(i32 %a, i32 %b) {
975 ; LA32-LABEL: urem_i32:
976 ; LA32: # %bb.0: # %entry
977 ; LA32-NEXT: mod.wu $a0, $a0, $a1
980 ; LA64-LABEL: urem_i32:
981 ; LA64: # %bb.0: # %entry
982 ; LA64-NEXT: addi.w $a1, $a1, 0
983 ; LA64-NEXT: addi.w $a0, $a0, 0
984 ; LA64-NEXT: mod.wu $a0, $a0, $a1
987 ; LA32-TRAP-LABEL: urem_i32:
988 ; LA32-TRAP: # %bb.0: # %entry
989 ; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
990 ; LA32-TRAP-NEXT: bnez $a1, .LBB27_2
991 ; LA32-TRAP-NEXT: # %bb.1: # %entry
992 ; LA32-TRAP-NEXT: break 7
993 ; LA32-TRAP-NEXT: .LBB27_2: # %entry
994 ; LA32-TRAP-NEXT: ret
996 ; LA64-TRAP-LABEL: urem_i32:
997 ; LA64-TRAP: # %bb.0: # %entry
998 ; LA64-TRAP-NEXT: addi.w $a1, $a1, 0
999 ; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
1000 ; LA64-TRAP-NEXT: mod.wu $a0, $a0, $a1
1001 ; LA64-TRAP-NEXT: bnez $a1, .LBB27_2
1002 ; LA64-TRAP-NEXT: # %bb.1: # %entry
1003 ; LA64-TRAP-NEXT: break 7
1004 ; LA64-TRAP-NEXT: .LBB27_2: # %entry
1005 ; LA64-TRAP-NEXT: ret
1007 %r = urem i32 %a, %b
1011 define i32 @urem_ui32_si32_si32(i32 signext %a, i32 signext %b) {
1012 ; LA32-LABEL: urem_ui32_si32_si32:
1013 ; LA32: # %bb.0: # %entry
1014 ; LA32-NEXT: mod.wu $a0, $a0, $a1
1017 ; LA64-LABEL: urem_ui32_si32_si32:
1018 ; LA64: # %bb.0: # %entry
1019 ; LA64-NEXT: mod.wu $a0, $a0, $a1
1022 ; LA32-TRAP-LABEL: urem_ui32_si32_si32:
1023 ; LA32-TRAP: # %bb.0: # %entry
1024 ; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
1025 ; LA32-TRAP-NEXT: bnez $a1, .LBB28_2
1026 ; LA32-TRAP-NEXT: # %bb.1: # %entry
1027 ; LA32-TRAP-NEXT: break 7
1028 ; LA32-TRAP-NEXT: .LBB28_2: # %entry
1029 ; LA32-TRAP-NEXT: ret
1031 ; LA64-TRAP-LABEL: urem_ui32_si32_si32:
1032 ; LA64-TRAP: # %bb.0: # %entry
1033 ; LA64-TRAP-NEXT: mod.wu $a0, $a0, $a1
1034 ; LA64-TRAP-NEXT: bnez $a1, .LBB28_2
1035 ; LA64-TRAP-NEXT: # %bb.1: # %entry
1036 ; LA64-TRAP-NEXT: break 7
1037 ; LA64-TRAP-NEXT: .LBB28_2: # %entry
1038 ; LA64-TRAP-NEXT: ret
1040 %r = urem i32 %a, %b
1044 define signext i32 @urem_si32_ui32_ui32(i32 %a, i32 %b) {
1045 ; LA32-LABEL: urem_si32_ui32_ui32:
1046 ; LA32: # %bb.0: # %entry
1047 ; LA32-NEXT: mod.wu $a0, $a0, $a1
1050 ; LA64-LABEL: urem_si32_ui32_ui32:
1051 ; LA64: # %bb.0: # %entry
1052 ; LA64-NEXT: addi.w $a1, $a1, 0
1053 ; LA64-NEXT: addi.w $a0, $a0, 0
1054 ; LA64-NEXT: mod.wu $a0, $a0, $a1
1057 ; LA32-TRAP-LABEL: urem_si32_ui32_ui32:
1058 ; LA32-TRAP: # %bb.0: # %entry
1059 ; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
1060 ; LA32-TRAP-NEXT: bnez $a1, .LBB29_2
1061 ; LA32-TRAP-NEXT: # %bb.1: # %entry
1062 ; LA32-TRAP-NEXT: break 7
1063 ; LA32-TRAP-NEXT: .LBB29_2: # %entry
1064 ; LA32-TRAP-NEXT: ret
1066 ; LA64-TRAP-LABEL: urem_si32_ui32_ui32:
1067 ; LA64-TRAP: # %bb.0: # %entry
1068 ; LA64-TRAP-NEXT: addi.w $a1, $a1, 0
1069 ; LA64-TRAP-NEXT: addi.w $a0, $a0, 0
1070 ; LA64-TRAP-NEXT: mod.wu $a0, $a0, $a1
1071 ; LA64-TRAP-NEXT: bnez $a1, .LBB29_2
1072 ; LA64-TRAP-NEXT: # %bb.1: # %entry
1073 ; LA64-TRAP-NEXT: break 7
1074 ; LA64-TRAP-NEXT: .LBB29_2: # %entry
1075 ; LA64-TRAP-NEXT: ret
1077 %r = urem i32 %a, %b
1081 define signext i32 @urem_si32_si32_si32(i32 signext %a, i32 signext %b) {
1082 ; LA32-LABEL: urem_si32_si32_si32:
1083 ; LA32: # %bb.0: # %entry
1084 ; LA32-NEXT: mod.wu $a0, $a0, $a1
1087 ; LA64-LABEL: urem_si32_si32_si32:
1088 ; LA64: # %bb.0: # %entry
1089 ; LA64-NEXT: mod.wu $a0, $a0, $a1
1092 ; LA32-TRAP-LABEL: urem_si32_si32_si32:
1093 ; LA32-TRAP: # %bb.0: # %entry
1094 ; LA32-TRAP-NEXT: mod.wu $a0, $a0, $a1
1095 ; LA32-TRAP-NEXT: bnez $a1, .LBB30_2
1096 ; LA32-TRAP-NEXT: # %bb.1: # %entry
1097 ; LA32-TRAP-NEXT: break 7
1098 ; LA32-TRAP-NEXT: .LBB30_2: # %entry
1099 ; LA32-TRAP-NEXT: ret
1101 ; LA64-TRAP-LABEL: urem_si32_si32_si32:
1102 ; LA64-TRAP: # %bb.0: # %entry
1103 ; LA64-TRAP-NEXT: mod.wu $a0, $a0, $a1
1104 ; LA64-TRAP-NEXT: bnez $a1, .LBB30_2
1105 ; LA64-TRAP-NEXT: # %bb.1: # %entry
1106 ; LA64-TRAP-NEXT: break 7
1107 ; LA64-TRAP-NEXT: .LBB30_2: # %entry
1108 ; LA64-TRAP-NEXT: ret
1110 %r = urem i32 %a, %b
1114 define i64 @urem_i64(i64 %a, i64 %b) {
1115 ; LA32-LABEL: urem_i64:
1116 ; LA32: # %bb.0: # %entry
1117 ; LA32-NEXT: addi.w $sp, $sp, -16
1118 ; LA32-NEXT: .cfi_def_cfa_offset 16
1119 ; LA32-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
1120 ; LA32-NEXT: .cfi_offset 1, -4
1121 ; LA32-NEXT: bl %plt(__umoddi3)
1122 ; LA32-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
1123 ; LA32-NEXT: addi.w $sp, $sp, 16
1126 ; LA64-LABEL: urem_i64:
1127 ; LA64: # %bb.0: # %entry
1128 ; LA64-NEXT: mod.du $a0, $a0, $a1
1131 ; LA32-TRAP-LABEL: urem_i64:
1132 ; LA32-TRAP: # %bb.0: # %entry
1133 ; LA32-TRAP-NEXT: addi.w $sp, $sp, -16
1134 ; LA32-TRAP-NEXT: .cfi_def_cfa_offset 16
1135 ; LA32-TRAP-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
1136 ; LA32-TRAP-NEXT: .cfi_offset 1, -4
1137 ; LA32-TRAP-NEXT: bl %plt(__umoddi3)
1138 ; LA32-TRAP-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
1139 ; LA32-TRAP-NEXT: addi.w $sp, $sp, 16
1140 ; LA32-TRAP-NEXT: ret
1142 ; LA64-TRAP-LABEL: urem_i64:
1143 ; LA64-TRAP: # %bb.0: # %entry
1144 ; LA64-TRAP-NEXT: mod.du $a0, $a0, $a1
1145 ; LA64-TRAP-NEXT: bnez $a1, .LBB31_2
1146 ; LA64-TRAP-NEXT: # %bb.1: # %entry
1147 ; LA64-TRAP-NEXT: break 7
1148 ; LA64-TRAP-NEXT: .LBB31_2: # %entry
1149 ; LA64-TRAP-NEXT: ret
1151 %r = urem i64 %a, %b