| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=mips -mcpu=mips2 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 2 | ; RUN: -check-prefix=NOT-R2-R6 -check-prefix=GP32 -check-prefix=GP32-NOT-MM \ |
| 3 | ; RUN: -check-prefix=NOT-MM |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 4 | ; RUN: llc < %s -march=mips -mcpu=mips32 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 5 | ; RUN: -check-prefix=NOT-R2-R6 -check-prefix=GP32 -check-prefix=GP32-NOT-MM \ |
| 6 | ; RUN: -check-prefix=NOT-MM |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 7 | ; RUN: llc < %s -march=mips -mcpu=mips32r2 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 8 | ; RUN: -check-prefix=R2-R6 -check-prefix=GP32 -check-prefix=GP32-NOT-MM \ |
| 9 | ; RUN: -check-prefix=NOT-MM |
| Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 10 | ; RUN: llc < %s -march=mips -mcpu=mips32r3 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 11 | ; RUN: -check-prefix=R2-R6 -check-prefix=GP32 -check-prefix=GP32-NOT-MM \ |
| 12 | ; RUN: -check-prefix=NOT-MM |
| Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 13 | ; RUN: llc < %s -march=mips -mcpu=mips32r5 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 14 | ; RUN: -check-prefix=R2-R6 -check-prefix=GP32 -check-prefix=GP32-NOT-MM \ |
| 15 | ; RUN: -check-prefix=NOT-MM |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 16 | ; RUN: llc < %s -march=mips -mcpu=mips32r6 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 17 | ; RUN: -check-prefix=R2-R6 -check-prefix=GP32 -check-prefix=GP32-NOT-MM \ |
| 18 | ; RUN: -check-prefix=NOT-MM |
| 19 | ; RUN: llc < %s -march=mips -mcpu=mips32r3 -mattr=+micromips | FileCheck %s \ |
| 20 | ; RUN: -check-prefix=GP32-MM -check-prefix=GP32 -check-prefix=MM |
| 21 | ; RUN: llc < %s -march=mips -mcpu=mips32r6 -mattr=+micromips | FileCheck %s \ |
| 22 | ; RUN: -check-prefix=GP32-MM -check-prefix=GP32 -check-prefix=MM |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 23 | ; RUN: llc < %s -march=mips64 -mcpu=mips3 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 24 | ; RUN: -check-prefix=NOT-R2-R6 -check-prefix=GP64 -check-prefix=NOT-MM |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 25 | ; RUN: llc < %s -march=mips64 -mcpu=mips4 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 26 | ; RUN: -check-prefix=NOT-R2-R6 -check-prefix=GP64 -check-prefix=NOT-MM |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 27 | ; RUN: llc < %s -march=mips64 -mcpu=mips64 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 28 | ; RUN: -check-prefix=NOT-R2-R6 -check-prefix=GP64 -check-prefix=NOT-MM |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 29 | ; RUN: llc < %s -march=mips64 -mcpu=mips64r2 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 30 | ; RUN: -check-prefix=R2-R6 -check-prefix=GP64 -check-prefix=NOT-MM |
| Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 31 | ; RUN: llc < %s -march=mips64 -mcpu=mips64r3 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 32 | ; RUN: -check-prefix=R2-R6 -check-prefix=GP64 -check-prefix=NOT-MM |
| Daniel Sanders | 1779314 | 2015-02-18 16:24:50 +0000 | [diff] [blame] | 33 | ; RUN: llc < %s -march=mips64 -mcpu=mips64r5 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 34 | ; RUN: -check-prefix=R2-R6 -check-prefix=GP64 -check-prefix=NOT-MM |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 35 | ; RUN: llc < %s -march=mips64 -mcpu=mips64r6 | FileCheck %s \ |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 36 | ; RUN: -check-prefix=R2-R6 -check-prefix=GP64 -check-prefix=NOT-MM |
| 37 | ; RUN: llc < %s -march=mips64 -mcpu=mips64r6 -mattr=+micromips | FileCheck %s \ |
| 38 | ; RUN: -check-prefix=GP64 -check-prefix=MM |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 39 | |
| 40 | define signext i1 @sub_i1(i1 signext %a, i1 signext %b) { |
| 41 | entry: |
| 42 | ; ALL-LABEL: sub_i1: |
| 43 | |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 44 | ; NOT-MM: subu $[[T0:[0-9]+]], $4, $5 |
| 45 | ; NOT-MM: sll $[[T0]], $[[T0]], 31 |
| 46 | ; NOT-MM: sra $2, $[[T0]], 31 |
| 47 | |
| 48 | ; MM: subu16 $[[T0:[0-9]+]], $4, $5 |
| 49 | ; MM: sll $[[T1:[0-9]+]], $[[T0]], 31 |
| 50 | ; MM: sra $[[T0]], $[[T1]], 31 |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 51 | |
| 52 | %r = sub i1 %a, %b |
| 53 | ret i1 %r |
| 54 | } |
| 55 | |
| 56 | define signext i8 @sub_i8(i8 signext %a, i8 signext %b) { |
| 57 | entry: |
| 58 | ; ALL-LABEL: sub_i8: |
| 59 | |
| 60 | ; NOT-R2-R6: subu $[[T0:[0-9]+]], $4, $5 |
| 61 | ; NOT-R2-R6: sll $[[T0]], $[[T0]], 24 |
| 62 | ; NOT-R2-R6: sra $2, $[[T0]], 24 |
| 63 | |
| 64 | ; R2-R6: subu $[[T0:[0-9]+]], $4, $5 |
| 65 | ; R2-R6: seb $2, $[[T0:[0-9]+]] |
| 66 | |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 67 | ; MM: subu16 $[[T0:[0-9]+]], $4, $5 |
| 68 | ; MM: seb $[[T0]], $[[T0]] |
| 69 | |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 70 | %r = sub i8 %a, %b |
| 71 | ret i8 %r |
| 72 | } |
| 73 | |
| 74 | define signext i16 @sub_i16(i16 signext %a, i16 signext %b) { |
| 75 | entry: |
| 76 | ; ALL-LABEL: sub_i16: |
| 77 | |
| 78 | ; NOT-R2-R6: subu $[[T0:[0-9]+]], $4, $5 |
| 79 | ; NOT-R2-R6: sll $[[T0]], $[[T0]], 16 |
| 80 | ; NOT-R2-R6: sra $2, $[[T0]], 16 |
| 81 | |
| 82 | ; R2-R6: subu $[[T0:[0-9]+]], $4, $5 |
| 83 | ; R2-R6: seh $2, $[[T0:[0-9]+]] |
| 84 | |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 85 | ; MM: subu16 $[[T0:[0-9]+]], $4, $5 |
| 86 | ; MM: seh $[[T0]], $[[T0]] |
| 87 | |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 88 | %r = sub i16 %a, %b |
| 89 | ret i16 %r |
| 90 | } |
| 91 | |
| 92 | define signext i32 @sub_i32(i32 signext %a, i32 signext %b) { |
| 93 | entry: |
| 94 | ; ALL-LABEL: sub_i32: |
| 95 | |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 96 | ; NOT-MM: subu $2, $4, $5 |
| 97 | |
| 98 | ; MM: subu16 $2, $4, $5 |
| Vasileios Kalintiris | 2ed214f | 2015-01-26 12:04:40 +0000 | [diff] [blame] | 99 | |
| 100 | %r = sub i32 %a, %b |
| 101 | ret i32 %r |
| 102 | } |
| 103 | |
| 104 | define signext i64 @sub_i64(i64 signext %a, i64 signext %b) { |
| 105 | entry: |
| 106 | ; ALL-LABEL: sub_i64: |
| 107 | |
| 108 | ; GP32: subu $3, $5, $7 |
| 109 | ; GP32: sltu $[[T0:[0-9]+]], $5, $7 |
| 110 | ; GP32: addu $[[T1:[0-9]+]], $[[T0]], $6 |
| 111 | ; GP32: subu $2, $4, $[[T1]] |
| 112 | |
| 113 | ; GP64: dsubu $2, $4, $5 |
| 114 | |
| 115 | %r = sub i64 %a, %b |
| 116 | ret i64 %r |
| 117 | } |
| Vasileios Kalintiris | ef96a8e | 2015-01-26 12:33:22 +0000 | [diff] [blame] | 118 | |
| 119 | define signext i128 @sub_i128(i128 signext %a, i128 signext %b) { |
| 120 | entry: |
| 121 | ; ALL-LABEL: sub_i128: |
| 122 | |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 123 | ; GP32-NOT-MM: lw $[[T0:[0-9]+]], 20($sp) |
| 124 | ; GP32-NOT-MM: sltu $[[T1:[0-9]+]], $5, $[[T0]] |
| 125 | ; GP32-NOT-MM: lw $[[T2:[0-9]+]], 16($sp) |
| 126 | ; GP32-NOT-MM: addu $[[T3:[0-9]+]], $[[T1]], $[[T2]] |
| 127 | ; GP32-NOT-MM: lw $[[T4:[0-9]+]], 24($sp) |
| 128 | ; GP32-NOT-MM: lw $[[T5:[0-9]+]], 28($sp) |
| 129 | ; GP32-NOT-MM: subu $[[T6:[0-9]+]], $7, $[[T5]] |
| 130 | ; GP32-NOT-MM: subu $2, $4, $[[T3]] |
| 131 | ; GP32-NOT-MM: sltu $[[T8:[0-9]+]], $6, $[[T4]] |
| 132 | ; GP32-NOT-MM: addu $[[T9:[0-9]+]], $[[T8]], $[[T0]] |
| 133 | ; GP32-NOT-MM: subu $3, $5, $[[T9]] |
| 134 | ; GP32-NOT-MM: sltu $[[T10:[0-9]+]], $7, $[[T5]] |
| 135 | ; GP32-NOT-MM: addu $[[T11:[0-9]+]], $[[T10]], $[[T4]] |
| 136 | ; GP32-NOT-MM: subu $4, $6, $[[T11]] |
| 137 | ; GP32-NOT-MM: move $5, $[[T6]] |
| Vasileios Kalintiris | ef96a8e | 2015-01-26 12:33:22 +0000 | [diff] [blame] | 138 | |
| Zlatko Buljan | de0bbe6 | 2016-04-27 11:31:44 +0000 | [diff] [blame^] | 139 | ; GP32-MM: lw $[[T0:[0-9]+]], 20($sp) |
| 140 | ; GP32-MM: sltu $[[T1:[0-9]+]], $[[T2:[0-9]+]], $[[T0]] |
| 141 | ; GP32-MM: lw $[[T3:[0-9]+]], 16($sp) |
| 142 | ; GP32-MM: addu $[[T3]], $[[T1]], $[[T3]] |
| 143 | ; GP32-MM: lw $[[T4:[0-9]+]], 28($sp) |
| 144 | ; GP32-MM: subu $[[T1]], $7, $[[T4]] |
| 145 | ; GP32-MM: subu $[[T3]], $[[T5:[0-9]+]], $[[T3]] |
| 146 | ; GP32-MM: lw $[[T5]], 24($sp) |
| 147 | ; GP32-MM: sltu $[[T6:[0-9]+]], $6, $[[T5]] |
| 148 | ; GP32-MM: addu $[[T0]], $[[T6]], $[[T0]] |
| 149 | ; GP32-MM: subu $[[T0]], $5, $[[T0]] |
| 150 | ; GP32-MM: sltu $[[T2]], $7, $[[T4]] |
| 151 | ; GP32-MM: addu $[[T5]], $[[T2]], $[[T5]] |
| 152 | ; GP32-MM: subu $[[T5]], $6, $[[T5]] |
| 153 | ; GP32-MM: move $[[T2]], $[[T1]] |
| 154 | |
| 155 | ; GP64: dsubu $3, $5, $7 |
| 156 | ; GP64: sltu $[[T0:[0-9]+]], $5, $7 |
| 157 | ; GP64: daddu $[[T1:[0-9]+]], $[[T0]], $6 |
| 158 | ; GP64: dsubu $2, $4, $[[T1]] |
| Vasileios Kalintiris | ef96a8e | 2015-01-26 12:33:22 +0000 | [diff] [blame] | 159 | |
| 160 | %r = sub i128 %a, %b |
| 161 | ret i128 %r |
| 162 | } |