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=NOT-R6 \ |
| 3 | ; RUN: -check-prefix=NOT-R2-R6 -check-prefix=GP32 |
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=NOT-R6 \ |
| 6 | ; RUN: -check-prefix=NOT-R2-R6 -check-prefix=GP32 |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 7 | ; RUN: llc < %s -march=mips -mcpu=mips32r2 -relocation-model=pic | FileCheck %s \ |
Vasileios Kalintiris | d10ce39 | 2016-04-14 09:13:13 +0000 | [diff] [blame] | 8 | ; RUN: -check-prefix=ALL -check-prefix=NOT-R6 \ |
| 9 | ; RUN: -check-prefix=R2-R5 -check-prefix=GP32 |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 10 | ; RUN: llc < %s -march=mips -mcpu=mips32r3 -relocation-model=pic | FileCheck %s \ |
Vasileios Kalintiris | d10ce39 | 2016-04-14 09:13:13 +0000 | [diff] [blame] | 11 | ; RUN: -check-prefix=ALL -check-prefix=NOT-R6 \ |
| 12 | ; RUN: -check-prefix=R2-R5 -check-prefix=GP32 |
Petar Jovanovic | e578e97 | 2016-04-11 15:24:23 +0000 | [diff] [blame] | 13 | ; RUN: llc < %s -march=mips -mcpu=mips32r5 -relocation-model=pic | FileCheck %s \ |
Vasileios Kalintiris | d10ce39 | 2016-04-14 09:13:13 +0000 | [diff] [blame] | 14 | ; RUN: -check-prefix=ALL -check-prefix=NOT-R6 \ |
| 15 | ; RUN: -check-prefix=R2-R5 -check-prefix=GP32 |
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=R6 \ |
| 18 | ; RUN: -check-prefix=GP32 |
| 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=NOT-R6 \ |
| 22 | ; RUN: -check-prefix=NOT-R2-R6 -check-prefix=GP64-NOT-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=NOT-R6 \ |
| 25 | ; RUN: -check-prefix=NOT-R2-R6 -check-prefix=GP64-NOT-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=NOT-R6 \ |
| 28 | ; RUN: -check-prefix=NOT-R2-R6 -check-prefix=GP64-NOT-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=NOT-R6 \ |
| 31 | ; RUN: -check-prefix=R2-R5 -check-prefix=GP64-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=NOT-R6 \ |
| 34 | ; RUN: -check-prefix=R2-R5 -check-prefix=GP64-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=NOT-R6 \ |
| 37 | ; RUN: -check-prefix=R2-R5 -check-prefix=GP64-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=R6 \ |
| 40 | ; RUN: -check-prefix=64R6 |
| 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 |
Daniel Sanders | de39332 | 2016-06-23 12:42:53 +0000 | [diff] [blame^] | 46 | ; RUN: llc < %s -march=mips -mcpu=mips64r6 -mattr=+micromips -target-abi n64 -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 @sdiv_i1(i1 signext %a, i1 signext %b) { |
| 50 | entry: |
| 51 | ; ALL-LABEL: sdiv_i1: |
| 52 | |
| 53 | ; NOT-R6: div $zero, $4, $5 |
| 54 | ; NOT-R6: teq $5, $zero, 7 |
| 55 | ; NOT-R6: mflo $[[T0:[0-9]+]] |
| 56 | ; FIXME: The sll/sra instructions are redundant since div is signed. |
| 57 | ; NOT-R6: sll $[[T1:[0-9]+]], $[[T0]], 31 |
| 58 | ; NOT-R6: sra $2, $[[T1]], 31 |
| 59 | |
| 60 | ; R6: div $[[T0:[0-9]+]], $4, $5 |
| 61 | ; R6: teq $5, $zero, 7 |
| 62 | ; FIXME: The sll/sra instructions are redundant since div is signed. |
| 63 | ; R6: sll $[[T1:[0-9]+]], $[[T0]], 31 |
| 64 | ; R6: sra $2, $[[T1]], 31 |
| 65 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 66 | ; MMR3: div $zero, $4, $5 |
| 67 | ; MMR3: teq $5, $zero, 7 |
| 68 | ; MMR3: mflo $[[T0:[0-9]+]] |
| 69 | ; MMR3: sll $[[T1:[0-9]+]], $[[T0]], 31 |
| 70 | ; MMR3: sra $2, $[[T1]], 31 |
| 71 | |
| 72 | ; MMR6: div $[[T0:[0-9]+]], $4, $5 |
| 73 | ; MMR6: teq $5, $zero, 7 |
| 74 | ; MMR6: sll $[[T1:[0-9]+]], $[[T0]], 31 |
| 75 | ; MMR6: sra $2, $[[T1]], 31 |
| 76 | |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 77 | %r = sdiv i1 %a, %b |
| 78 | ret i1 %r |
| 79 | } |
| 80 | |
| 81 | define signext i8 @sdiv_i8(i8 signext %a, i8 signext %b) { |
| 82 | entry: |
| 83 | ; ALL-LABEL: sdiv_i8: |
| 84 | |
| 85 | ; NOT-R2-R6: div $zero, $4, $5 |
| 86 | ; NOT-R2-R6: teq $5, $zero, 7 |
| 87 | ; NOT-R2-R6: mflo $[[T0:[0-9]+]] |
| 88 | ; FIXME: The sll/sra instructions are redundant since div is signed. |
| 89 | ; NOT-R2-R6: sll $[[T1:[0-9]+]], $[[T0]], 24 |
| 90 | ; NOT-R2-R6: sra $2, $[[T1]], 24 |
| 91 | |
Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 92 | ; R2-R5: div $zero, $4, $5 |
| 93 | ; R2-R5: teq $5, $zero, 7 |
| 94 | ; R2-R5: mflo $[[T0:[0-9]+]] |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 95 | ; FIXME: This instruction is redundant. |
Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 96 | ; R2-R5: seb $2, $[[T0]] |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 97 | |
| 98 | ; R6: div $[[T0:[0-9]+]], $4, $5 |
| 99 | ; R6: teq $5, $zero, 7 |
| 100 | ; FIXME: This instruction is redundant. |
| 101 | ; R6: seb $2, $[[T0]] |
| 102 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 103 | ; MMR3: div $zero, $4, $5 |
| 104 | ; MMR3: teq $5, $zero, 7 |
| 105 | ; MMR3: mflo $[[T0:[0-9]+]] |
| 106 | ; MMR3: seb $2, $[[T0]] |
| 107 | |
| 108 | ; MMR6: div $[[T0:[0-9]+]], $4, $5 |
| 109 | ; MMR6: teq $5, $zero, 7 |
| 110 | ; MMR6: seb $2, $[[T0]] |
| 111 | |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 112 | %r = sdiv i8 %a, %b |
| 113 | ret i8 %r |
| 114 | } |
| 115 | |
| 116 | define signext i16 @sdiv_i16(i16 signext %a, i16 signext %b) { |
| 117 | entry: |
| 118 | ; ALL-LABEL: sdiv_i16: |
| 119 | |
| 120 | ; NOT-R2-R6: div $zero, $4, $5 |
| 121 | ; NOT-R2-R6: teq $5, $zero, 7 |
| 122 | ; NOT-R2-R6: mflo $[[T0:[0-9]+]] |
| 123 | ; FIXME: The sll/sra instructions are redundant since div is signed. |
| 124 | ; NOT-R2-R6: sll $[[T1:[0-9]+]], $[[T0]], 16 |
| 125 | ; NOT-R2-R6: sra $2, $[[T1]], 16 |
| 126 | |
Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 127 | ; R2-R5: div $zero, $4, $5 |
| 128 | ; R2-R5: teq $5, $zero, 7 |
| 129 | ; R2-R5: mflo $[[T0:[0-9]+]] |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 130 | ; FIXME: This is instruction is redundant since div is signed. |
Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 131 | ; R2-R5: seh $2, $[[T0]] |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 132 | |
| 133 | ; R6: div $[[T0:[0-9]+]], $4, $5 |
| 134 | ; R6: teq $5, $zero, 7 |
| 135 | ; FIXME: This is instruction is redundant since div is signed. |
| 136 | ; R6: seh $2, $[[T0]] |
| 137 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 138 | ; MMR3: div $zero, $4, $5 |
| 139 | ; MMR3: teq $5, $zero, 7 |
| 140 | ; MMR3: mflo $[[T0:[0-9]+]] |
| 141 | ; MMR3: seh $2, $[[T0]] |
| 142 | |
| 143 | ; MMR6: div $[[T0:[0-9]+]], $4, $5 |
| 144 | ; MMR6: teq $5, $zero, 7 |
| 145 | ; MMR6: seh $2, $[[T0]] |
| 146 | |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 147 | %r = sdiv i16 %a, %b |
| 148 | ret i16 %r |
| 149 | } |
| 150 | |
| 151 | define signext i32 @sdiv_i32(i32 signext %a, i32 signext %b) { |
| 152 | entry: |
| 153 | ; ALL-LABEL: sdiv_i32: |
| 154 | |
| 155 | ; NOT-R6: div $zero, $4, $5 |
| 156 | ; NOT-R6: teq $5, $zero, 7 |
| 157 | ; NOT-R6: mflo $2 |
| 158 | |
| 159 | ; R6: div $2, $4, $5 |
| 160 | ; R6: teq $5, $zero, 7 |
| 161 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 162 | ; MMR3: div $zero, $4, $5 |
| 163 | ; MMR3: teq $5, $zero, 7 |
| 164 | ; MMR3: mflo $2 |
| 165 | |
| 166 | ; MMR6: div $2, $4, $5 |
| 167 | ; MMR6: teq $5, $zero, 7 |
| 168 | |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 169 | %r = sdiv i32 %a, %b |
| 170 | ret i32 %r |
| 171 | } |
| 172 | |
| 173 | define signext i64 @sdiv_i64(i64 signext %a, i64 signext %b) { |
| 174 | entry: |
| 175 | ; ALL-LABEL: sdiv_i64: |
| 176 | |
| 177 | ; GP32: lw $25, %call16(__divdi3)($gp) |
| 178 | |
| 179 | ; GP64-NOT-R6: ddiv $zero, $4, $5 |
| 180 | ; GP64-NOT-R6: teq $5, $zero, 7 |
| 181 | ; GP64-NOT-R6: mflo $2 |
| 182 | |
| 183 | ; 64R6: ddiv $2, $4, $5 |
| 184 | ; 64R6: teq $5, $zero, 7 |
| 185 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 186 | ; MM32: lw $25, %call16(__divdi3)($2) |
| 187 | |
| 188 | ; MM64: ddiv $2, $4, $5 |
| 189 | ; MM64: teq $5, $zero, 7 |
| 190 | |
Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 191 | %r = sdiv i64 %a, %b |
| 192 | ret i64 %r |
| 193 | } |
Vasileios Kalintiris | ef96a8e | 2015-01-26 12:33:22 +0000 | [diff] [blame] | 194 | |
| 195 | define signext i128 @sdiv_i128(i128 signext %a, i128 signext %b) { |
| 196 | entry: |
| 197 | ; ALL-LABEL: sdiv_i128: |
| 198 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 199 | ; GP32: lw $25, %call16(__divti3)($gp) |
Vasileios Kalintiris | ef96a8e | 2015-01-26 12:33:22 +0000 | [diff] [blame] | 200 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 201 | ; GP64-NOT-R6: ld $25, %call16(__divti3)($gp) |
| 202 | ; 64R6: ld $25, %call16(__divti3)($gp) |
Vasileios Kalintiris | ef96a8e | 2015-01-26 12:33:22 +0000 | [diff] [blame] | 203 | |
Zlatko Buljan | 58d6a95 | 2016-04-13 08:02:26 +0000 | [diff] [blame] | 204 | ; MM32: lw $25, %call16(__divti3)($2) |
| 205 | |
| 206 | ; MM64: ld $25, %call16(__divti3)($2) |
| 207 | |
| 208 | %r = sdiv i128 %a, %b |
| 209 | ret i128 %r |
| 210 | } |