249 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -mattr=+m -mtriple=riscv64 -run-pass=legalizer %s -o - \3# RUN: | FileCheck %s4# RUN: llc -mattr=+zmmul -mtriple=riscv64 -run-pass=legalizer %s -o - \5# RUN: | FileCheck %s6---7name: mul_i88body: |9 bb.0.entry:10 ; CHECK-LABEL: name: mul_i811 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x1012 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1113 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[COPY]], [[COPY1]]14 ; CHECK-NEXT: $x10 = COPY [[MUL]](s64)15 ; CHECK-NEXT: PseudoRET implicit $x1016 %0:_(s64) = COPY $x1017 %1:_(s64) = COPY $x1118 %2:_(s8) = G_TRUNC %0(s64)19 %3:_(s8) = G_TRUNC %1(s64)20 %4:_(s8) = G_MUL %2, %321 %5:_(s64) = G_ANYEXT %4(s8)22 $x10 = COPY %5(s64)23 PseudoRET implicit $x1024 25...26---27name: mul_i1528body: |29 bb.0.entry:30 ; CHECK-LABEL: name: mul_i1531 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x1032 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1133 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[COPY]], [[COPY1]]34 ; CHECK-NEXT: $x10 = COPY [[MUL]](s64)35 ; CHECK-NEXT: PseudoRET implicit $x1036 %0:_(s64) = COPY $x1037 %1:_(s64) = COPY $x1138 %2:_(s15) = G_TRUNC %0(s64)39 %3:_(s15) = G_TRUNC %1(s64)40 %4:_(s15) = G_MUL %2, %341 %5:_(s64) = G_ANYEXT %4(s15)42 $x10 = COPY %5(s64)43 PseudoRET implicit $x1044 45...46---47name: mul_i1648body: |49 bb.0.entry:50 ; CHECK-LABEL: name: mul_i1651 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x1052 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1153 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[COPY]], [[COPY1]]54 ; CHECK-NEXT: $x10 = COPY [[MUL]](s64)55 ; CHECK-NEXT: PseudoRET implicit $x1056 %0:_(s64) = COPY $x1057 %1:_(s64) = COPY $x1158 %2:_(s16) = G_TRUNC %0(s64)59 %3:_(s16) = G_TRUNC %1(s64)60 %4:_(s16) = G_MUL %2, %361 %5:_(s64) = G_ANYEXT %4(s16)62 $x10 = COPY %5(s64)63 PseudoRET implicit $x1064 65...66---67name: mul_i3268body: |69 bb.0.entry:70 ; CHECK-LABEL: name: mul_i3271 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x1072 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1173 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[COPY]], [[COPY1]]74 ; CHECK-NEXT: $x10 = COPY [[MUL]](s64)75 ; CHECK-NEXT: PseudoRET implicit $x1076 %0:_(s64) = COPY $x1077 %1:_(s64) = COPY $x1178 %2:_(s32) = G_TRUNC %0(s64)79 %3:_(s32) = G_TRUNC %1(s64)80 %4:_(s32) = G_MUL %2, %381 %5:_(s64) = G_ANYEXT %4(s32)82 $x10 = COPY %5(s64)83 PseudoRET implicit $x1084 85...86---87name: mul_i6488body: |89 bb.0.entry:90 ; CHECK-LABEL: name: mul_i6491 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x1092 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1193 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[COPY]], [[COPY1]]94 ; CHECK-NEXT: $x10 = COPY [[MUL]](s64)95 ; CHECK-NEXT: PseudoRET implicit $x1096 %0:_(s64) = COPY $x1097 %1:_(s64) = COPY $x1198 %2:_(s64) = G_MUL %0, %199 $x10 = COPY %2(s64)100 PseudoRET implicit $x10101 102...103---104name: mul_i72105body: |106 bb.0.entry:107 ; CHECK-LABEL: name: mul_i72108 ; CHECK: %xlo:_(s64) = COPY $x10109 ; CHECK-NEXT: %xhi:_(s64) = COPY $x11110 ; CHECK-NEXT: %ylo:_(s64) = COPY $x12111 ; CHECK-NEXT: %yhi:_(s64) = COPY $x13112 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL %xlo, %ylo113 ; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(s64) = G_MUL %xhi, %ylo114 ; CHECK-NEXT: [[MUL2:%[0-9]+]]:_(s64) = G_MUL %xlo, %yhi115 ; CHECK-NEXT: [[UMULH:%[0-9]+]]:_(s64) = G_UMULH %xlo, %ylo116 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[MUL1]], [[MUL2]]117 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s64) = G_ADD [[ADD]], [[UMULH]]118 ; CHECK-NEXT: $x10 = COPY [[MUL]](s64)119 ; CHECK-NEXT: $x11 = COPY [[ADD1]](s64)120 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11121 %xlo:_(s64) = COPY $x10122 %xhi:_(s64) = COPY $x11123 %ylo:_(s64) = COPY $x12124 %yhi:_(s64) = COPY $x13125 %x0:_(s128) = G_MERGE_VALUES %xlo(s64), %xhi(s64)126 %y0:_(s128) = G_MERGE_VALUES %ylo(s64), %yhi(s64)127 %x:_(s72) = G_TRUNC %x0(s128)128 %y:_(s72) = G_TRUNC %y0(s128)129 %z:_(s72) = G_MUL %x, %y130 %z0:_(s128) = G_ANYEXT %z(s72)131 %zlo:_(s64), %zhi:_(s64) = G_UNMERGE_VALUES %z0(s128)132 $x10 = COPY %zlo(s64)133 $x11 = COPY %zhi(s64)134 PseudoRET implicit $x10, implicit $x11135 136...137---138name: mul_i128139body: |140 bb.0.entry:141 ; CHECK-LABEL: name: mul_i128142 ; CHECK: %lo1:_(s64) = COPY $x10143 ; CHECK-NEXT: %hi1:_(s64) = COPY $x11144 ; CHECK-NEXT: %lo2:_(s64) = COPY $x12145 ; CHECK-NEXT: %hi2:_(s64) = COPY $x13146 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL %lo1, %lo2147 ; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(s64) = G_MUL %hi1, %lo2148 ; CHECK-NEXT: [[MUL2:%[0-9]+]]:_(s64) = G_MUL %lo1, %hi2149 ; CHECK-NEXT: [[UMULH:%[0-9]+]]:_(s64) = G_UMULH %lo1, %lo2150 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[MUL1]], [[MUL2]]151 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s64) = G_ADD [[ADD]], [[UMULH]]152 ; CHECK-NEXT: $x10 = COPY [[MUL]](s64)153 ; CHECK-NEXT: $x11 = COPY [[ADD1]](s64)154 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11155 %lo1:_(s64) = COPY $x10156 %hi1:_(s64) = COPY $x11157 %lo2:_(s64) = COPY $x12158 %hi2:_(s64) = COPY $x13159 %x1:_(s128) = G_MERGE_VALUES %lo1(s64), %hi1(s64)160 %x2:_(s128) = G_MERGE_VALUES %lo2(s64), %hi2(s64)161 %y:_(s128) = G_MUL %x1, %x2162 %loy:_(s64), %hiy:_(s64) = G_UNMERGE_VALUES %y(s128)163 $x10 = COPY %loy(s64)164 $x11 = COPY %hiy(s64)165 PseudoRET implicit $x10, implicit $x11166 167...168---169name: mul_i192170body: |171 bb.0.entry:172 ; CHECK-LABEL: name: mul_i192173 ; CHECK: %lo1:_(s64) = COPY $x10174 ; CHECK-NEXT: %mid1:_(s64) = COPY $x11175 ; CHECK-NEXT: %hi1:_(s64) = COPY $x12176 ; CHECK-NEXT: %lo2:_(s64) = COPY $x13177 ; CHECK-NEXT: %mid2:_(s64) = COPY $x14178 ; CHECK-NEXT: %hi2:_(s64) = COPY $x15179 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL %lo1, %lo2180 ; CHECK-NEXT: [[MUL1:%[0-9]+]]:_(s64) = G_MUL %mid1, %lo2181 ; CHECK-NEXT: [[MUL2:%[0-9]+]]:_(s64) = G_MUL %lo1, %mid2182 ; CHECK-NEXT: [[UMULH:%[0-9]+]]:_(s64) = G_UMULH %lo1, %lo2183 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[MUL1]], [[MUL2]]184 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[ADD]](s64), [[MUL2]]185 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY [[ADD]](s64)186 ; CHECK-NEXT: [[ADD1:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[UMULH]]187 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), [[ADD1]](s64), [[UMULH]]188 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY [[ADD1]](s64)189 ; CHECK-NEXT: [[ADD2:%[0-9]+]]:_(s64) = G_ADD [[ICMP]], [[ICMP1]]190 ; CHECK-NEXT: [[MUL3:%[0-9]+]]:_(s64) = G_MUL %hi1, %lo2191 ; CHECK-NEXT: [[MUL4:%[0-9]+]]:_(s64) = G_MUL %mid1, %mid2192 ; CHECK-NEXT: [[MUL5:%[0-9]+]]:_(s64) = G_MUL %lo1, %hi2193 ; CHECK-NEXT: [[UMULH1:%[0-9]+]]:_(s64) = G_UMULH %mid1, %lo2194 ; CHECK-NEXT: [[UMULH2:%[0-9]+]]:_(s64) = G_UMULH %lo1, %mid2195 ; CHECK-NEXT: [[ADD3:%[0-9]+]]:_(s64) = G_ADD [[MUL3]], [[MUL4]]196 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY [[ADD3]](s64)197 ; CHECK-NEXT: [[ADD4:%[0-9]+]]:_(s64) = G_ADD [[COPY2]], [[MUL5]]198 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s64) = COPY [[ADD4]](s64)199 ; CHECK-NEXT: [[ADD5:%[0-9]+]]:_(s64) = G_ADD [[COPY3]], [[UMULH1]]200 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:_(s64) = COPY [[ADD5]](s64)201 ; CHECK-NEXT: [[ADD6:%[0-9]+]]:_(s64) = G_ADD [[COPY4]], [[UMULH2]]202 ; CHECK-NEXT: [[COPY5:%[0-9]+]]:_(s64) = COPY [[ADD6]](s64)203 ; CHECK-NEXT: [[ADD7:%[0-9]+]]:_(s64) = G_ADD [[COPY5]], [[ADD2]]204 ; CHECK-NEXT: [[COPY6:%[0-9]+]]:_(s64) = COPY [[ADD7]](s64)205 ; CHECK-NEXT: $x10 = COPY [[MUL]](s64)206 ; CHECK-NEXT: $x11 = COPY [[COPY1]](s64)207 ; CHECK-NEXT: $x12 = COPY [[COPY6]](s64)208 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12209 %lo1:_(s64) = COPY $x10210 %mid1:_(s64) = COPY $x11211 %hi1:_(s64) = COPY $x12212 %lo2:_(s64) = COPY $x13213 %mid2:_(s64) = COPY $x14214 %hi2:_(s64) = COPY $x15215 %x1:_(s192) = G_MERGE_VALUES %lo1(s64), %mid1(s64), %hi1(s64)216 %x2:_(s192) = G_MERGE_VALUES %lo2(s64), %mid2(s64), %hi2(s64)217 %y:_(s192) = G_MUL %x1, %x2218 %lo:_(s64), %mid:_(s64), %hi:_(s64) = G_UNMERGE_VALUES %y(s192)219 $x10 = COPY %lo(s64)220 $x11 = COPY %mid(s64)221 $x12 = COPY %hi(s64)222 PseudoRET implicit $x10, implicit $x11, implicit $x12223 224...225---226name: smulh_i32227body: |228 bb.0.entry:229 ; CHECK-LABEL: name: smulh_i32230 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10231 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11232 ; CHECK-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY]], 32233 ; CHECK-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s64) = G_SEXT_INREG [[COPY1]], 32234 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s64) = G_MUL [[SEXT_INREG]], [[SEXT_INREG1]]235 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 32236 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[MUL]], [[C]](s64)237 ; CHECK-NEXT: $x10 = COPY [[ASHR]](s64)238 ; CHECK-NEXT: PseudoRET implicit $x10239 %0:_(s64) = COPY $x10240 %1:_(s64) = COPY $x11241 %2:_(s32) = G_TRUNC %0(s64)242 %3:_(s32) = G_TRUNC %1(s64)243 %4:_(s32) = G_SMULH %2, %3244 %5:_(s64) = G_ANYEXT %4(s32)245 $x10 = COPY %5(s64)246 PseudoRET implicit $x10247 248...249