1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=mips -mcpu=mips2 -relocation-model=pic \
3 ; RUN: -mips-jalr-reloc=false | FileCheck %s -check-prefixes=MIPS2
4 ; RUN: llc < %s -mtriple=mips -mcpu=mips32 -relocation-model=pic \
5 ; RUN: -mips-jalr-reloc=false | FileCheck %s -check-prefixes=MIPS32
7 ; RUN: llc < %s -mtriple=mips64 -mcpu=mips3 -relocation-model=pic \
8 ; RUN: -mips-jalr-reloc=false | FileCheck %s -check-prefixes=MIPS3
9 ; RUN: llc < %s -mtriple=mips64 -mcpu=mips64 -relocation-model=pic \
10 ; RUN: -mips-jalr-reloc=false | FileCheck %s -check-prefixes=MIPS64
12 ; RUN: llc < %s -mtriple=mips -mcpu=mips2 -O0 -relocation-model=pic \
13 ; RUN: -mips-jalr-reloc=false | FileCheck %s -check-prefixes=MIPS2-O0
14 ; RUN: llc < %s -mtriple=mips -mcpu=mips32 -O0 -relocation-model=pic \
15 ; RUN: -mips-jalr-reloc=false | FileCheck %s -check-prefixes=MIPS32-O0
17 define signext i32 @urem_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
18 ; MIPS2-LABEL: urem_i32:
19 ; MIPS2: # %bb.0: # %entry
20 ; MIPS2-NEXT: divu $zero, $4, $5
21 ; MIPS2-NEXT: teq $5, $zero, 7
25 ; MIPS2-NEXT: divu $zero, $1, $6
26 ; MIPS2-NEXT: teq $6, $zero, 7
31 ; MIPS32-LABEL: urem_i32:
32 ; MIPS32: # %bb.0: # %entry
33 ; MIPS32-NEXT: divu $zero, $4, $5
34 ; MIPS32-NEXT: teq $5, $zero, 7
35 ; MIPS32-NEXT: mfhi $1
36 ; MIPS32-NEXT: divu $zero, $1, $6
37 ; MIPS32-NEXT: teq $6, $zero, 7
39 ; MIPS32-NEXT: mfhi $2
42 %urem = urem i32 %a, %b
43 %urem1 = urem i32 %urem, %c
47 define signext i64 @urem_i64(i64 signext %a, i64 signext %b, i64 signext %c) {
48 ; MIPS3-LABEL: urem_i64:
49 ; MIPS3: # %bb.0: # %entry
50 ; MIPS3-NEXT: ddivu $zero, $4, $5
51 ; MIPS3-NEXT: teq $5, $zero, 7
55 ; MIPS3-NEXT: ddivu $zero, $1, $6
56 ; MIPS3-NEXT: teq $6, $zero, 7
61 ; MIPS64-LABEL: urem_i64:
62 ; MIPS64: # %bb.0: # %entry
63 ; MIPS64-NEXT: ddivu $zero, $4, $5
64 ; MIPS64-NEXT: teq $5, $zero, 7
65 ; MIPS64-NEXT: mfhi $1
66 ; MIPS64-NEXT: ddivu $zero, $1, $6
67 ; MIPS64-NEXT: teq $6, $zero, 7
69 ; MIPS64-NEXT: mfhi $2
72 %urem = urem i64 %a, %b
73 %urem1 = urem i64 %urem, %c
77 define signext i32 @urem_lw_urem_i32(i32 signext %a, i32 signext %b, i32 signext %c) {
78 ; MIPS2-O0-LABEL: urem_lw_urem_i32:
79 ; MIPS2-O0: # %bb.0: # %entry
80 ; MIPS2-O0-NEXT: addiu $sp, $sp, -16
81 ; MIPS2-O0-NEXT: .cfi_def_cfa_offset 16
82 ; MIPS2-O0-NEXT: sw $4, 12($sp)
83 ; MIPS2-O0-NEXT: sw $5, 8($sp)
84 ; MIPS2-O0-NEXT: sw $6, 4($sp)
85 ; MIPS2-O0-NEXT: lw $2, 12($sp)
86 ; MIPS2-O0-NEXT: lw $1, 8($sp)
87 ; MIPS2-O0-NEXT: divu $zero, $2, $1
88 ; MIPS2-O0-NEXT: teq $1, $zero, 7
89 ; MIPS2-O0-NEXT: mfhi $2
90 ; MIPS2-O0-NEXT: lw $1, 4($sp)
92 ; MIPS2-O0-NEXT: divu $zero, $2, $1
93 ; MIPS2-O0-NEXT: teq $1, $zero, 7
94 ; MIPS2-O0-NEXT: mfhi $2
95 ; MIPS2-O0-NEXT: addiu $sp, $sp, 16
96 ; MIPS2-O0-NEXT: jr $ra
99 ; MIPS32-O0-LABEL: urem_lw_urem_i32:
100 ; MIPS32-O0: # %bb.0: # %entry
101 ; MIPS32-O0-NEXT: addiu $sp, $sp, -16
102 ; MIPS32-O0-NEXT: .cfi_def_cfa_offset 16
103 ; MIPS32-O0-NEXT: sw $4, 12($sp)
104 ; MIPS32-O0-NEXT: sw $5, 8($sp)
105 ; MIPS32-O0-NEXT: sw $6, 4($sp)
106 ; MIPS32-O0-NEXT: lw $2, 12($sp)
107 ; MIPS32-O0-NEXT: lw $1, 8($sp)
108 ; MIPS32-O0-NEXT: divu $zero, $2, $1
109 ; MIPS32-O0-NEXT: teq $1, $zero, 7
110 ; MIPS32-O0-NEXT: mfhi $2
111 ; MIPS32-O0-NEXT: lw $1, 4($sp)
112 ; MIPS32-O0-NEXT: divu $zero, $2, $1
113 ; MIPS32-O0-NEXT: teq $1, $zero, 7
114 ; MIPS32-O0-NEXT: mfhi $2
115 ; MIPS32-O0-NEXT: addiu $sp, $sp, 16
116 ; MIPS32-O0-NEXT: jr $ra
117 ; MIPS32-O0-NEXT: nop
120 %a.addr = alloca i32, align 4
121 %b.addr = alloca i32, align 4
122 %c.addr = alloca i32, align 4
123 store i32 %a, ptr %a.addr, align 4
124 store i32 %b, ptr %b.addr, align 4
125 store i32 %c, ptr %c.addr, align 4
126 %0 = load i32, ptr %a.addr, align 4
127 %1 = load i32, ptr %b.addr, align 4
128 %rem = urem i32 %0, %1
129 %2 = load i32, ptr %c.addr, align 4
130 %urem1 = urem i32 %rem, %2