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