Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=mips -mcpu=mips2 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 2 | ; RUN: -check-prefixes=ALL,GP32,NOT-R6,NOT-R2-R6 |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 3 | ; RUN: llc < %s -march=mips -mcpu=mips32 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 4 | ; RUN: -check-prefixes=ALL,GP32,NOT-R6,NOT-R2-R6 |
Vasileios Kalintiris | d10ce39 | 2016-04-14 09:13:13 +0000 | [diff] [blame] | 5 | ; RUN: llc < %s -march=mips -mcpu=mips32r2 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 6 | ; RUN: -check-prefixes=ALL,GP32,R2-R5,R2-R6,NOT-R6 |
Vasileios Kalintiris | d10ce39 | 2016-04-14 09:13:13 +0000 | [diff] [blame] | 7 | ; RUN: llc < %s -march=mips -mcpu=mips32r3 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 8 | ; RUN: -check-prefixes=ALL,GP32,R2-R5,R2-R6,NOT-R6 |
Vasileios Kalintiris | d10ce39 | 2016-04-14 09:13:13 +0000 | [diff] [blame] | 9 | ; RUN: llc < %s -march=mips -mcpu=mips32r5 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 10 | ; RUN: -check-prefixes=ALL,GP32,R2-R5,R2-R6,NOT-R6 |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 11 | ; RUN: llc < %s -march=mips -mcpu=mips32r6 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 12 | ; RUN: -check-prefixes=ALL,GP32,R6,R2-R6 |
Vasileios Kalintiris | d10ce39 | 2016-04-14 09:13:13 +0000 | [diff] [blame] | 13 | |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 14 | ; RUN: llc < %s -march=mips64 -mcpu=mips3 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 15 | ; RUN: -check-prefixes=ALL,GP64-NOT-R6,NOT-R6,NOT-R2-R6 |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 16 | ; RUN: llc < %s -march=mips64 -mcpu=mips4 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 17 | ; RUN: -check-prefixes=ALL,GP64-NOT-R6,NOT-R6,NOT-R2-R6 |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 18 | ; RUN: llc < %s -march=mips64 -mcpu=mips64 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 19 | ; RUN: -check-prefixes=ALL,GP64-NOT-R6,NOT-R6,NOT-R2-R6 |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 20 | ; RUN: llc < %s -march=mips64 -mcpu=mips64r2 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 21 | ; RUN: -check-prefixes=ALL,R2-R5,R2-R6,GP64-NOT-R6,NOT-R6 |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 22 | ; RUN: llc < %s -march=mips64 -mcpu=mips64r3 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 23 | ; RUN: -check-prefixes=ALL,R2-R5,R2-R6,GP64-NOT-R6,NOT-R6 |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 24 | ; RUN: llc < %s -march=mips64 -mcpu=mips64r5 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 25 | ; RUN: -check-prefixes=ALL,R2-R5,R2-R6,GP64-NOT-R6,NOT-R6 |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 26 | ; RUN: llc < %s -march=mips64 -mcpu=mips64r6 -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 27 | ; RUN: -check-prefixes=ALL,64R6,R6,R2-R6 |
Vasileios Kalintiris | d10ce39 | 2016-04-14 09:13:13 +0000 | [diff] [blame] | 28 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 29 | ; RUN: llc < %s -march=mips -mcpu=mips32r3 -mattr=+micromips -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 30 | ; RUN: -check-prefixes=ALL,MMR3,MM32 |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 31 | ; RUN: llc < %s -march=mips -mcpu=mips32r6 -mattr=+micromips -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 32 | ; RUN: -check-prefixes=ALL,MMR6,MM32 |
Daniel Sanders | de39332 | 2016-06-23 12:42:53 +0000 | [diff] [blame] | 33 | ; RUN: llc < %s -march=mips -mcpu=mips64r6 -target-abi n64 -mattr=+micromips -relocation-model=pic | FileCheck %s \ |
Daniel Sanders | 0d97270 | 2016-06-24 12:23:17 +0000 | [diff] [blame] | 34 | ; RUN: -check-prefixes=ALL,MMR6,MM64 |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 35 | |
| 36 | define signext i1 @urem_i1(i1 signext %a, i1 signext %b) { |
| 37 | entry: |
| 38 | ; ALL-LABEL: urem_i1: |
| 39 | |
| 40 | ; NOT-R6: andi $[[T0:[0-9]+]], $5, 1 |
| 41 | ; NOT-R6: andi $[[T1:[0-9]+]], $4, 1 |
| 42 | ; NOT-R6: divu $zero, $[[T1]], $[[T0]] |
| 43 | ; NOT-R6: teq $[[T0]], $zero, 7 |
| 44 | ; NOT-R6: mfhi $[[T2:[0-9]+]] |
| 45 | ; NOT-R6: sll $[[T3:[0-9]+]], $[[T2]], 31 |
| 46 | ; NOT-R6: sra $2, $[[T3]], 31 |
| 47 | |
| 48 | ; R6: andi $[[T0:[0-9]+]], $5, 1 |
| 49 | ; R6: andi $[[T1:[0-9]+]], $4, 1 |
| 50 | ; R6: modu $[[T2:[0-9]+]], $[[T1]], $[[T0]] |
| 51 | ; R6: teq $[[T0]], $zero, 7 |
| 52 | ; R6: sll $[[T3:[0-9]+]], $[[T2]], 31 |
| 53 | ; R6: sra $2, $[[T3]], 31 |
| 54 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 55 | ; MMR3: andi16 $[[T0:[0-9]+]], $5, 1 |
| 56 | ; MMR3: andi16 $[[T1:[0-9]+]], $4, 1 |
| 57 | ; MMR3: divu $zero, $[[T1]], $[[T0]] |
| 58 | ; MMR3: teq $[[T0]], $zero, 7 |
| 59 | ; MMR3: mfhi $[[T2:[0-9]+]] |
| 60 | ; MMR3: sll $[[T3:[0-9]+]], $[[T2]], 31 |
| 61 | ; MMR3: sra $2, $[[T3]], 31 |
| 62 | |
| 63 | ; MMR6: andi16 $[[T0:[0-9]+]], $5, 1 |
| 64 | ; MMR6: andi16 $[[T1:[0-9]+]], $4, 1 |
| 65 | ; MMR6: modu $[[T2:[0-9]+]], $[[T1]], $[[T0]] |
| 66 | ; MMR6: teq $[[T0]], $zero, 7 |
| 67 | ; MMR6: sll $[[T3:[0-9]+]], $[[T2]], 31 |
| 68 | ; MMR6: sra $2, $[[T3]], 31 |
| 69 | |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 70 | %r = urem i1 %a, %b |
| 71 | ret i1 %r |
| 72 | } |
| 73 | |
| 74 | define signext i8 @urem_i8(i8 signext %a, i8 signext %b) { |
| 75 | entry: |
| 76 | ; ALL-LABEL: urem_i8: |
| 77 | |
| 78 | ; NOT-R2-R6: andi $[[T0:[0-9]+]], $5, 255 |
| 79 | ; NOT-R2-R6: andi $[[T1:[0-9]+]], $4, 255 |
| 80 | ; NOT-R2-R6: divu $zero, $[[T1]], $[[T0]] |
| 81 | ; NOT-R2-R6: teq $[[T0]], $zero, 7 |
| 82 | ; NOT-R2-R6: mfhi $[[T2:[0-9]+]] |
| 83 | ; NOT-R2-R6: sll $[[T3:[0-9]+]], $[[T2]], 24 |
| 84 | ; NOT-R2-R6: sra $2, $[[T3]], 24 |
| 85 | |
Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 86 | ; R2-R5: andi $[[T0:[0-9]+]], $5, 255 |
| 87 | ; R2-R5: andi $[[T1:[0-9]+]], $4, 255 |
| 88 | ; R2-R5: divu $zero, $[[T1]], $[[T0]] |
| 89 | ; R2-R5: teq $[[T0]], $zero, 7 |
| 90 | ; R2-R5: mfhi $[[T2:[0-9]+]] |
| 91 | ; R2-R5: seb $2, $[[T2]] |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 92 | |
| 93 | ; R6: andi $[[T0:[0-9]+]], $5, 255 |
| 94 | ; R6: andi $[[T1:[0-9]+]], $4, 255 |
| 95 | ; R6: modu $[[T2:[0-9]+]], $[[T1]], $[[T0]] |
| 96 | ; R6: teq $[[T0]], $zero, 7 |
| 97 | ; R6: seb $2, $[[T2]] |
| 98 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 99 | ; MMR3: andi16 $[[T0:[0-9]+]], $5, 255 |
| 100 | ; MMR3: andi16 $[[T1:[0-9]+]], $4, 255 |
| 101 | ; MMR3: divu $zero, $[[T1]], $[[T0]] |
| 102 | ; MMR3: teq $[[T0]], $zero, 7 |
| 103 | ; MMR3: mfhi $[[T2:[0-9]+]] |
| 104 | ; MMR3: seb $2, $[[T2]] |
| 105 | |
| 106 | ; MMR6: andi16 $[[T0:[0-9]+]], $5, 255 |
| 107 | ; MMR6: andi16 $[[T1:[0-9]+]], $4, 255 |
| 108 | ; MMR6: modu $[[T2:[0-9]+]], $[[T1]], $[[T0]] |
| 109 | ; MMR6: teq $[[T0]], $zero, 7 |
| 110 | ; MMR6: seb $2, $[[T2]] |
| 111 | |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 112 | %r = urem i8 %a, %b |
| 113 | ret i8 %r |
| 114 | } |
| 115 | |
| 116 | define signext i16 @urem_i16(i16 signext %a, i16 signext %b) { |
| 117 | entry: |
| 118 | ; ALL-LABEL: urem_i16: |
| 119 | |
| 120 | ; NOT-R2-R6: andi $[[T0:[0-9]+]], $5, 65535 |
| 121 | ; NOT-R2-R6: andi $[[T1:[0-9]+]], $4, 65535 |
| 122 | ; NOT-R2-R6: divu $zero, $[[T1]], $[[T0]] |
| 123 | ; NOT-R2-R6: teq $[[T0]], $zero, 7 |
| 124 | ; NOT-R2-R6: mfhi $[[T2:[0-9]+]] |
| 125 | ; NOT-R2-R6: sll $[[T3:[0-9]+]], $[[T2]], 16 |
| 126 | ; NOT-R2-R6: sra $2, $[[T3]], 16 |
| 127 | |
Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 128 | ; R2-R5: andi $[[T0:[0-9]+]], $5, 65535 |
| 129 | ; R2-R5: andi $[[T1:[0-9]+]], $4, 65535 |
| 130 | ; R2-R5: divu $zero, $[[T1]], $[[T0]] |
| 131 | ; R2-R5: teq $[[T0]], $zero, 7 |
| 132 | ; R2-R5: mfhi $[[T3:[0-9]+]] |
| 133 | ; R2-R5: seh $2, $[[T2]] |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 134 | |
| 135 | ; R6: andi $[[T0:[0-9]+]], $5, 65535 |
| 136 | ; R6: andi $[[T1:[0-9]+]], $4, 65535 |
| 137 | ; R6: modu $[[T2:[0-9]+]], $[[T1]], $[[T0]] |
| 138 | ; R6: teq $[[T0]], $zero, 7 |
| 139 | ; R6: seh $2, $[[T2]] |
| 140 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 141 | ; MMR3: andi16 $[[T0:[0-9]+]], $5, 65535 |
| 142 | ; MMR3: andi16 $[[T1:[0-9]+]], $4, 65535 |
| 143 | ; MMR3: divu $zero, $[[T1]], $[[T0]] |
| 144 | ; MMR3: teq $[[T0]], $zero, 7 |
| 145 | ; MMR3: mfhi $[[T2:[0-9]+]] |
| 146 | ; MMR3: seh $2, $[[T2]] |
| 147 | |
| 148 | ; MMR6: andi16 $[[T0:[0-9]+]], $5, 65535 |
| 149 | ; MMR6: andi16 $[[T1:[0-9]+]], $4, 65535 |
| 150 | ; MMR6: modu $[[T2:[0-9]+]], $[[T1]], $[[T0]] |
| 151 | ; MMR6: teq $[[T0]], $zero, 7 |
| 152 | ; MMR6: seh $2, $[[T2]] |
| 153 | |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 154 | %r = urem i16 %a, %b |
| 155 | ret i16 %r |
| 156 | } |
| 157 | |
| 158 | define signext i32 @urem_i32(i32 signext %a, i32 signext %b) { |
| 159 | entry: |
| 160 | ; ALL-LABEL: urem_i32: |
| 161 | |
| 162 | ; NOT-R6: divu $zero, $4, $5 |
| 163 | ; NOT-R6: teq $5, $zero, 7 |
| 164 | ; NOT-R6: mfhi $2 |
| 165 | |
| 166 | ; R6: modu $2, $4, $5 |
| 167 | ; R6: teq $5, $zero, 7 |
| 168 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 169 | ; MMR3: divu $zero, $4, $5 |
| 170 | ; MMR3: teq $5, $zero, 7 |
| 171 | ; MMR3: mfhi $2 |
| 172 | |
| 173 | ; MMR6: modu $2, $4, $5 |
| 174 | ; MMR6: teq $5, $zero, 7 |
| 175 | |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 176 | %r = urem i32 %a, %b |
| 177 | ret i32 %r |
| 178 | } |
| 179 | |
| 180 | define signext i64 @urem_i64(i64 signext %a, i64 signext %b) { |
| 181 | entry: |
| 182 | ; ALL-LABEL: urem_i64: |
| 183 | |
| 184 | ; GP32: lw $25, %call16(__umoddi3)($gp) |
| 185 | |
| 186 | ; GP64-NOT-R6: ddivu $zero, $4, $5 |
| 187 | ; GP64-NOT-R6: teq $5, $zero, 7 |
| 188 | ; GP64-NOT-R6: mfhi $2 |
| 189 | |
| 190 | ; 64R6: dmodu $2, $4, $5 |
| 191 | ; 64R6: teq $5, $zero, 7 |
| 192 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 193 | ; MM32: lw $25, %call16(__umoddi3)($2) |
| 194 | |
| 195 | ; MM64: dmodu $2, $4, $5 |
| 196 | ; MM64: teq $5, $zero, 7 |
| 197 | |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 198 | %r = urem i64 %a, %b |
| 199 | ret i64 %r |
| 200 | } |
Vasileios Kalintiris | ef96a8e | 2015-01-26 12:33:22 +0000 | [diff] [blame] | 201 | |
| 202 | define signext i128 @urem_i128(i128 signext %a, i128 signext %b) { |
| 203 | entry: |
| 204 | ; ALL-LABEL: urem_i128: |
| 205 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 206 | ; GP32: lw $25, %call16(__umodti3)($gp) |
Vasileios Kalintiris | ef96a8e | 2015-01-26 12:33:22 +0000 | [diff] [blame] | 207 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 208 | ; GP64-NOT-R6: ld $25, %call16(__umodti3)($gp) |
Vasileios Kalintiris | d10ce39 | 2016-04-14 09:13:13 +0000 | [diff] [blame] | 209 | ; 64R6: ld $25, %call16(__umodti3)($gp) |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 210 | |
Simon Dardis | f114820 | 2016-08-24 13:00:47 +0000 | [diff] [blame^] | 211 | ; MM32: lw $25, %call16(__umodti3)($16) |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 212 | |
| 213 | ; MM64: ld $25, %call16(__umodti3)($2) |
Vasileios Kalintiris | ef96a8e | 2015-01-26 12:33:22 +0000 | [diff] [blame] | 214 | |
| 215 | %r = urem i128 %a, %b |
| 216 | ret i128 %r |
| 217 | } |