| 1 |
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py |
| 2 |
# RUN: llc -mattr=+m -mtriple=riscv32 -run-pass=legalizer %s -o - \ |
| 3 |
# RUN: | FileCheck %s |
| 4 |
# RUN: llc -mattr=+zmmul -mtriple=riscv32 -run-pass=legalizer %s -o - \ |
| 5 |
# RUN: | FileCheck %s |
| 6 |
--- |
| 7 |
name: mul_i7 |
| 8 |
body: | |
| 9 |
bb.0.entry: |
| 10 |
; CHECK-LABEL: name: mul_i7 |
| 11 |
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 12 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 13 |
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[COPY]], [[COPY1]] |
| 14 |
; CHECK-NEXT: $x10 = COPY [[MUL]](s32) |
| 15 |
; CHECK-NEXT: PseudoRET implicit $x10 |
| 16 |
%0:_(s32) = COPY $x10 |
| 17 |
%1:_(s32) = COPY $x11 |
| 18 |
%2:_(s7) = G_TRUNC %0(s32) |
| 19 |
%3:_(s7) = G_TRUNC %1(s32) |
| 20 |
%4:_(s7) = G_MUL %2, %3 |
| 21 |
%5:_(s32) = G_ANYEXT %4(s7) |
| 22 |
$x10 = COPY %5(s32) |
| 23 |
PseudoRET implicit $x10 |
| 24 |
|
| 25 |
... |
| 26 |
--- |
| 27 |
name: mul_i8 |
| 28 |
body: | |
| 29 |
bb.0.entry: |
| 30 |
; CHECK-LABEL: name: mul_i8 |
| 31 |
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 32 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 33 |
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[COPY]], [[COPY1]] |
| 34 |
; CHECK-NEXT: $x10 = COPY [[MUL]](s32) |
| 35 |
; CHECK-NEXT: PseudoRET implicit $x10 |
| 36 |
%0:_(s32) = COPY $x10 |
| 37 |
%1:_(s32) = COPY $x11 |
| 38 |
%2:_(s8) = G_TRUNC %0(s32) |
| 39 |
%3:_(s8) = G_TRUNC %1(s32) |
| 40 |
%4:_(s8) = G_MUL %2, %3 |
| 41 |
%5:_(s32) = G_ANYEXT %4(s8) |
| 42 |
$x10 = COPY %5(s32) |
| 43 |
PseudoRET implicit $x10 |
| 44 |
|
| 45 |
... |
| 46 |
--- |
| 47 |
name: mul_i16 |
| 48 |
body: | |
| 49 |
bb.0.entry: |
| 50 |
; CHECK-LABEL: name: mul_i16 |
| 51 |
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 52 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 53 |
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[COPY]], [[COPY1]] |
| 54 |
; CHECK-NEXT: $x10 = COPY [[MUL]](s32) |
| 55 |
; CHECK-NEXT: PseudoRET implicit $x10 |
| 56 |
%0:_(s32) = COPY $x10 |
| 57 |
%1:_(s32) = COPY $x11 |
| 58 |
%2:_(s16) = G_TRUNC %0(s32) |
| 59 |
%3:_(s16) = G_TRUNC %1(s32) |
| 60 |
%4:_(s16) = G_MUL %2, %3 |
| 61 |
%5:_(s32) = G_ANYEXT %4(s16) |
| 62 |
$x10 = COPY %5(s32) |
| 63 |
PseudoRET implicit $x10 |
| 64 |
|
| 65 |
... |
| 66 |
--- |
| 67 |
name: mul_i32 |
| 68 |
body: | |
| 69 |
bb.0.entry: |
| 70 |
; CHECK-LABEL: name: mul_i32 |
| 71 |
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 72 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 73 |
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[COPY]], [[COPY1]] |
| 74 |
; CHECK-NEXT: $x10 = COPY [[MUL]](s32) |
| 75 |
; CHECK-NEXT: PseudoRET implicit $x10 |
| 76 |
%0:_(s32) = COPY $x10 |
| 77 |
%1:_(s32) = COPY $x11 |
| 78 |
%2:_(s32) = G_MUL %0, %1 |
| 79 |
$x10 = COPY %2(s32) |
| 80 |
PseudoRET implicit $x10 |
| 81 |
|
| 82 |
... |
| 83 |
--- |
| 84 |
name: mul_i48 |
| 85 |
body: | |
| 86 |
bb.0.entry: |
| 87 |
; CHECK-LABEL: name: mul_i48 |
| 88 |
; CHECK: %xlo:_(s32) = COPY $x10 |
| 89 |
; CHECK-NEXT: %xhi:_(s32) = COPY $x11 |
| 90 |
; CHECK-NEXT: %ylo:_(s32) = COPY $x12 |
| 91 |
; CHECK-NEXT: %yhi:_(s32) = COPY $x13 |
| 92 |
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL %xlo, %ylo |
| 93 |
; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(s32) = G_MUL %xhi, %ylo |
| 94 |
; CHECK-NEXT: [[MUL2:%[0-9]+]]:_(s32) = G_MUL %xlo, %yhi |
| 95 |
; CHECK-NEXT: [[UMULH:%[0-9]+]]:_(s32) = G_UMULH %xlo, %ylo |
| 96 |
; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[MUL1]], [[MUL2]] |
| 97 |
; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[ADD]], [[UMULH]] |
| 98 |
; CHECK-NEXT: $x10 = COPY [[MUL]](s32) |
| 99 |
; CHECK-NEXT: $x11 = COPY [[ADD1]](s32) |
| 100 |
; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 |
| 101 |
%xlo:_(s32) = COPY $x10 |
| 102 |
%xhi:_(s32) = COPY $x11 |
| 103 |
%ylo:_(s32) = COPY $x12 |
| 104 |
%yhi:_(s32) = COPY $x13 |
| 105 |
%x0:_(s64) = G_MERGE_VALUES %xlo(s32), %xhi(s32) |
| 106 |
%y0:_(s64) = G_MERGE_VALUES %ylo(s32), %yhi(s32) |
| 107 |
%x:_(s48) = G_TRUNC %x0(s64) |
| 108 |
%y:_(s48) = G_TRUNC %y0(s64) |
| 109 |
%z:_(s48) = G_MUL %x, %y |
| 110 |
%z0:_(s64) = G_ANYEXT %z(s48) |
| 111 |
%zlo:_(s32), %zhi:_(s32) = G_UNMERGE_VALUES %z0(s64) |
| 112 |
$x10 = COPY %zlo(s32) |
| 113 |
$x11 = COPY %zhi(s32) |
| 114 |
PseudoRET implicit $x10, implicit $x11 |
| 115 |
|
| 116 |
... |
| 117 |
--- |
| 118 |
name: mul_i64 |
| 119 |
body: | |
| 120 |
bb.0.entry: |
| 121 |
; CHECK-LABEL: name: mul_i64 |
| 122 |
; CHECK: %lo1:_(s32) = COPY $x10 |
| 123 |
; CHECK-NEXT: %hi1:_(s32) = COPY $x11 |
| 124 |
; CHECK-NEXT: %lo2:_(s32) = COPY $x12 |
| 125 |
; CHECK-NEXT: %hi2:_(s32) = COPY $x13 |
| 126 |
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL %lo1, %lo2 |
| 127 |
; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(s32) = G_MUL %hi1, %lo2 |
| 128 |
; CHECK-NEXT: [[MUL2:%[0-9]+]]:_(s32) = G_MUL %lo1, %hi2 |
| 129 |
; CHECK-NEXT: [[UMULH:%[0-9]+]]:_(s32) = G_UMULH %lo1, %lo2 |
| 130 |
; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[MUL1]], [[MUL2]] |
| 131 |
; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[ADD]], [[UMULH]] |
| 132 |
; CHECK-NEXT: $x10 = COPY [[MUL]](s32) |
| 133 |
; CHECK-NEXT: $x11 = COPY [[ADD1]](s32) |
| 134 |
; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 |
| 135 |
%lo1:_(s32) = COPY $x10 |
| 136 |
%hi1:_(s32) = COPY $x11 |
| 137 |
%lo2:_(s32) = COPY $x12 |
| 138 |
%hi2:_(s32) = COPY $x13 |
| 139 |
%x1:_(s64) = G_MERGE_VALUES %lo1(s32), %hi1(s32) |
| 140 |
%x2:_(s64) = G_MERGE_VALUES %lo2(s32), %hi2(s32) |
| 141 |
%y:_(s64) = G_MUL %x1, %x2 |
| 142 |
%loy:_(s32), %hiy:_(s32) = G_UNMERGE_VALUES %y(s64) |
| 143 |
$x10 = COPY %loy(s32) |
| 144 |
$x11 = COPY %hiy(s32) |
| 145 |
PseudoRET implicit $x10, implicit $x11 |
| 146 |
|
| 147 |
... |
| 148 |
--- |
| 149 |
name: mul_i96 |
| 150 |
body: | |
| 151 |
bb.0.entry: |
| 152 |
; CHECK-LABEL: name: mul_i96 |
| 153 |
; CHECK: %lo1:_(s32) = COPY $x10 |
| 154 |
; CHECK-NEXT: %mid1:_(s32) = COPY $x11 |
| 155 |
; CHECK-NEXT: %hi1:_(s32) = COPY $x12 |
| 156 |
; CHECK-NEXT: %lo2:_(s32) = COPY $x13 |
| 157 |
; CHECK-NEXT: %mid2:_(s32) = COPY $x14 |
| 158 |
; CHECK-NEXT: %hi2:_(s32) = COPY $x15 |
| 159 |
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL %lo1, %lo2 |
| 160 |
; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(s32) = G_MUL %mid1, %lo2 |
| 161 |
; CHECK-NEXT: [[MUL2:%[0-9]+]]:_(s32) = G_MUL %lo1, %mid2 |
| 162 |
; CHECK-NEXT: [[UMULH:%[0-9]+]]:_(s32) = G_UMULH %lo1, %lo2 |
| 163 |
; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[MUL1]], [[MUL2]] |
| 164 |
; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD]](s32), [[MUL2]] |
| 165 |
; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY [[ADD]](s32) |
| 166 |
; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[UMULH]] |
| 167 |
; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[ADD1]](s32), [[UMULH]] |
| 168 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[ADD1]](s32) |
| 169 |
; CHECK-NEXT: [[ADD2:%[0-9]+]]:_(s32) = G_ADD [[ICMP]], [[ICMP1]] |
| 170 |
; CHECK-NEXT: [[MUL3:%[0-9]+]]:_(s32) = G_MUL %hi1, %lo2 |
| 171 |
; CHECK-NEXT: [[MUL4:%[0-9]+]]:_(s32) = G_MUL %mid1, %mid2 |
| 172 |
; CHECK-NEXT: [[MUL5:%[0-9]+]]:_(s32) = G_MUL %lo1, %hi2 |
| 173 |
; CHECK-NEXT: [[UMULH1:%[0-9]+]]:_(s32) = G_UMULH %mid1, %lo2 |
| 174 |
; CHECK-NEXT: [[UMULH2:%[0-9]+]]:_(s32) = G_UMULH %lo1, %mid2 |
| 175 |
; CHECK-NEXT: [[ADD3:%[0-9]+]]:_(s32) = G_ADD [[MUL3]], [[MUL4]] |
| 176 |
; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ADD3]](s32) |
| 177 |
; CHECK-NEXT: [[ADD4:%[0-9]+]]:_(s32) = G_ADD [[COPY2]], [[MUL5]] |
| 178 |
; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY [[ADD4]](s32) |
| 179 |
; CHECK-NEXT: [[ADD5:%[0-9]+]]:_(s32) = G_ADD [[COPY3]], [[UMULH1]] |
| 180 |
; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY [[ADD5]](s32) |
| 181 |
; CHECK-NEXT: [[ADD6:%[0-9]+]]:_(s32) = G_ADD [[COPY4]], [[UMULH2]] |
| 182 |
; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s32) = COPY [[ADD6]](s32) |
| 183 |
; CHECK-NEXT: [[ADD7:%[0-9]+]]:_(s32) = G_ADD [[COPY5]], [[ADD2]] |
| 184 |
; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s32) = COPY [[ADD7]](s32) |
| 185 |
; CHECK-NEXT: $x10 = COPY [[MUL]](s32) |
| 186 |
; CHECK-NEXT: $x11 = COPY [[COPY1]](s32) |
| 187 |
; CHECK-NEXT: $x12 = COPY [[COPY6]](s32) |
| 188 |
; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12 |
| 189 |
%lo1:_(s32) = COPY $x10 |
| 190 |
%mid1:_(s32) = COPY $x11 |
| 191 |
%hi1:_(s32) = COPY $x12 |
| 192 |
%lo2:_(s32) = COPY $x13 |
| 193 |
%mid2:_(s32) = COPY $x14 |
| 194 |
%hi2:_(s32) = COPY $x15 |
| 195 |
%x1:_(s96) = G_MERGE_VALUES %lo1(s32), %mid1(s32), %hi1(s32) |
| 196 |
%x2:_(s96) = G_MERGE_VALUES %lo2(s32), %mid2(s32), %hi2(s32) |
| 197 |
%y:_(s96) = G_MUL %x1, %x2 |
| 198 |
%lo:_(s32), %mid:_(s32), %hi:_(s32) = G_UNMERGE_VALUES %y(s96) |
| 199 |
$x10 = COPY %lo(s32) |
| 200 |
$x11 = COPY %mid(s32) |
| 201 |
$x12 = COPY %hi(s32) |
| 202 |
PseudoRET implicit $x10, implicit $x11, implicit $x12 |
| 203 |
|
| 204 |
... |
| 205 |
--- |
| 206 |
name: smulh_i16 |
| 207 |
body: | |
| 208 |
bb.0.entry: |
| 209 |
; CHECK-LABEL: name: smulh_i16 |
| 210 |
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 211 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 212 |
; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 |
| 213 |
; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32) |
| 214 |
; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32) |
| 215 |
; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32) |
| 216 |
; CHECK-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32) |
| 217 |
; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[ASHR]], [[ASHR1]] |
| 218 |
; CHECK-NEXT: [[ASHR2:%[0-9]+]]:_(s32) = G_ASHR [[MUL]], [[C]](s32) |
| 219 |
; CHECK-NEXT: $x10 = COPY [[ASHR2]](s32) |
| 220 |
; CHECK-NEXT: PseudoRET implicit $x10 |
| 221 |
%0:_(s32) = COPY $x10 |
| 222 |
%1:_(s32) = COPY $x11 |
| 223 |
%2:_(s16) = G_TRUNC %0(s32) |
| 224 |
%3:_(s16) = G_TRUNC %1(s32) |
| 225 |
%4:_(s16) = G_SMULH %2, %3 |
| 226 |
%5:_(s32) = G_ANYEXT %4(s16) |
| 227 |
$x10 = COPY %5(s32) |
| 228 |
PseudoRET implicit $x10 |
| 229 |
|
| 230 |
... |