367 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 52# RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve2 -run-pass=peephole-opt -verify-machineinstrs %s -o - | FileCheck %s3 4# Test instruction sequences where PTEST is redundant and thus gets removed.5---6name: whilewr_b8_s647alignment: 28tracksRegLiveness: true9registers:10 - { id: 0, class: gpr64 }11 - { id: 1, class: gpr64 }12 - { id: 2, class: ppr }13 - { id: 3, class: ppr }14 - { id: 4, class: gpr32 }15 - { id: 5, class: gpr32 }16liveins:17 - { reg: '$x0', virtual-reg: '%0' }18 - { reg: '$x1', virtual-reg: '%1' }19frameInfo:20 maxCallFrameSize: 021body: |22 bb.0.entry:23 liveins: $x0, $x124 25 ; CHECK-LABEL: name: whilewr_b8_s6426 ; CHECK: liveins: $x0, $x127 ; CHECK-NEXT: {{ $}}28 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x129 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x030 ; CHECK-NEXT: [[PTRUE_B:%[0-9]+]]:ppr = PTRUE_B 31, implicit $vg31 ; CHECK-NEXT: [[WHILEWR_PXX_B:%[0-9]+]]:ppr = WHILEWR_PXX_B [[COPY1]], [[COPY]], implicit-def $nzcv32 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $wzr33 ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr [[COPY2]], $wzr, 0, implicit $nzcv34 ; CHECK-NEXT: $w0 = COPY [[CSINCWr]]35 ; CHECK-NEXT: RET_ReallyLR implicit $w036 %1:gpr64 = COPY $x137 %0:gpr64 = COPY $x038 %2:ppr = PTRUE_B 31, implicit $vg39 %3:ppr = WHILEWR_PXX_B %0, %1, implicit-def dead $nzcv40 PTEST_PP killed %2, killed %3, implicit-def $nzcv41 %4:gpr32 = COPY $wzr42 %5:gpr32 = CSINCWr %4, $wzr, 0, implicit $nzcv43 $w0 = COPY %544 RET_ReallyLR implicit $w045 46...47---48name: whilewr_b16_s6449alignment: 250tracksRegLiveness: true51registers:52 - { id: 0, class: gpr64 }53 - { id: 1, class: gpr64 }54 - { id: 2, class: ppr }55 - { id: 3, class: ppr }56 - { id: 4, class: ppr }57 - { id: 5, class: ppr }58 - { id: 6, class: gpr32 }59 - { id: 7, class: gpr32 }60liveins:61 - { reg: '$x0', virtual-reg: '%0' }62 - { reg: '$x1', virtual-reg: '%1' }63frameInfo:64 maxCallFrameSize: 065body: |66 bb.0.entry:67 liveins: $x0, $x168 69 ; CHECK-LABEL: name: whilewr_b16_s6470 ; CHECK: liveins: $x0, $x171 ; CHECK-NEXT: {{ $}}72 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x173 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x074 ; CHECK-NEXT: [[PTRUE_H:%[0-9]+]]:ppr = PTRUE_H 31, implicit $vg75 ; CHECK-NEXT: [[WHILEWR_PXX_H:%[0-9]+]]:ppr = WHILEWR_PXX_H [[COPY1]], [[COPY]], implicit-def $nzcv76 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $wzr77 ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr [[COPY2]], $wzr, 0, implicit $nzcv78 ; CHECK-NEXT: $w0 = COPY [[CSINCWr]]79 ; CHECK-NEXT: RET_ReallyLR implicit $w080 %1:gpr64 = COPY $x181 %0:gpr64 = COPY $x082 %2:ppr = PTRUE_H 31, implicit $vg83 %4:ppr = WHILEWR_PXX_H %0, %1, implicit-def dead $nzcv84 PTEST_PP %2, %4, implicit-def $nzcv85 %6:gpr32 = COPY $wzr86 %7:gpr32 = CSINCWr %6, $wzr, 0, implicit $nzcv87 $w0 = COPY %788 RET_ReallyLR implicit $w089 90...91---92name: whilewr_b32_s6493alignment: 294tracksRegLiveness: true95registers:96 - { id: 0, class: gpr64 }97 - { id: 1, class: gpr64 }98 - { id: 2, class: ppr }99 - { id: 3, class: ppr }100 - { id: 4, class: ppr }101 - { id: 5, class: ppr }102 - { id: 6, class: gpr32 }103 - { id: 7, class: gpr32 }104liveins:105 - { reg: '$x0', virtual-reg: '%0' }106 - { reg: '$x1', virtual-reg: '%1' }107frameInfo:108 maxCallFrameSize: 0109body: |110 bb.0.entry:111 liveins: $x0, $x1112 113 ; CHECK-LABEL: name: whilewr_b32_s64114 ; CHECK: liveins: $x0, $x1115 ; CHECK-NEXT: {{ $}}116 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x1117 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x0118 ; CHECK-NEXT: [[PTRUE_S:%[0-9]+]]:ppr = PTRUE_S 31, implicit $vg119 ; CHECK-NEXT: [[WHILEWR_PXX_S:%[0-9]+]]:ppr = WHILEWR_PXX_S [[COPY1]], [[COPY]], implicit-def $nzcv120 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $wzr121 ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr [[COPY2]], $wzr, 0, implicit $nzcv122 ; CHECK-NEXT: $w0 = COPY [[CSINCWr]]123 ; CHECK-NEXT: RET_ReallyLR implicit $w0124 %1:gpr64 = COPY $x1125 %0:gpr64 = COPY $x0126 %2:ppr = PTRUE_S 31, implicit $vg127 %4:ppr = WHILEWR_PXX_S %0, %1, implicit-def dead $nzcv128 PTEST_PP %2, %4, implicit-def $nzcv129 %6:gpr32 = COPY $wzr130 %7:gpr32 = CSINCWr %6, $wzr, 0, implicit $nzcv131 $w0 = COPY %7132 RET_ReallyLR implicit $w0133 134...135---136name: whilewr_b64_s64137alignment: 2138tracksRegLiveness: true139registers:140 - { id: 0, class: gpr64 }141 - { id: 1, class: gpr64 }142 - { id: 2, class: ppr }143 - { id: 3, class: ppr }144 - { id: 4, class: ppr }145 - { id: 5, class: ppr }146 - { id: 6, class: gpr32 }147 - { id: 7, class: gpr32 }148liveins:149 - { reg: '$x0', virtual-reg: '%0' }150 - { reg: '$x1', virtual-reg: '%1' }151frameInfo:152 maxCallFrameSize: 0153body: |154 bb.0.entry:155 liveins: $x0, $x1156 157 ; CHECK-LABEL: name: whilewr_b64_s64158 ; CHECK: liveins: $x0, $x1159 ; CHECK-NEXT: {{ $}}160 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x1161 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x0162 ; CHECK-NEXT: [[PTRUE_D:%[0-9]+]]:ppr = PTRUE_D 31, implicit $vg163 ; CHECK-NEXT: [[WHILEWR_PXX_D:%[0-9]+]]:ppr = WHILEWR_PXX_D [[COPY1]], [[COPY]], implicit-def $nzcv164 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $wzr165 ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr [[COPY2]], $wzr, 0, implicit $nzcv166 ; CHECK-NEXT: $w0 = COPY [[CSINCWr]]167 ; CHECK-NEXT: RET_ReallyLR implicit $w0168 %1:gpr64 = COPY $x1169 %0:gpr64 = COPY $x0170 %2:ppr = PTRUE_D 31, implicit $vg171 %4:ppr = WHILEWR_PXX_D %0, %1, implicit-def dead $nzcv172 PTEST_PP %2, %4, implicit-def $nzcv173 %6:gpr32 = COPY $wzr174 %7:gpr32 = CSINCWr %6, $wzr, 0, implicit $nzcv175 $w0 = COPY %7176 RET_ReallyLR implicit $w0177 178...179 180# PTEST is not redundant when it's Pg operand is not an all active predicate181# of element size matching the WHILEGE, which is the implicitly predicate182# used by WHILE when calculating the condition codes.183---184name: whilewr_b8_s64_keep_ptest_not_all_active185alignment: 2186tracksRegLiveness: true187registers:188 - { id: 0, class: gpr64 }189 - { id: 1, class: gpr64 }190 - { id: 2, class: ppr }191 - { id: 3, class: ppr }192 - { id: 4, class: gpr32 }193 - { id: 5, class: gpr32 }194liveins:195 - { reg: '$x0', virtual-reg: '%0' }196 - { reg: '$x1', virtual-reg: '%1' }197frameInfo:198 maxCallFrameSize: 0199body: |200 bb.0.entry:201 liveins: $x0, $x1202 203 ; CHECK-LABEL: name: whilewr_b8_s64_keep_ptest_not_all_active204 ; CHECK: liveins: $x0, $x1205 ; CHECK-NEXT: {{ $}}206 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x1207 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x0208 ; CHECK-NEXT: [[PTRUE_B:%[0-9]+]]:ppr = PTRUE_B 0, implicit $vg209 ; CHECK-NEXT: [[WHILEWR_PXX_B:%[0-9]+]]:ppr = WHILEWR_PXX_B [[COPY1]], [[COPY]], implicit-def dead $nzcv210 ; CHECK-NEXT: PTEST_PP killed [[PTRUE_B]], killed [[WHILEWR_PXX_B]], implicit-def $nzcv211 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $wzr212 ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr [[COPY2]], $wzr, 0, implicit $nzcv213 ; CHECK-NEXT: $w0 = COPY [[CSINCWr]]214 ; CHECK-NEXT: RET_ReallyLR implicit $w0215 %1:gpr64 = COPY $x1216 %0:gpr64 = COPY $x0217 %2:ppr = PTRUE_B 0, implicit $vg218 %3:ppr = WHILEWR_PXX_B %0, %1, implicit-def dead $nzcv219 PTEST_PP killed %2, killed %3, implicit-def $nzcv220 %4:gpr32 = COPY $wzr221 %5:gpr32 = CSINCWr %4, $wzr, 0, implicit $nzcv222 $w0 = COPY %5223 RET_ReallyLR implicit $w0224 225...226 227# PTEST is not redundant when it's Pg operand is not an all active predicate228# of element size matching the WHILEGE, which is the implicitly predicate229# used by WHILE when calculating the condition codes.230---231name: whilewr_b8_s64_keep_ptest_of_halfs232alignment: 2233tracksRegLiveness: true234registers:235 - { id: 0, class: gpr64 }236 - { id: 1, class: gpr64 }237 - { id: 2, class: ppr }238 - { id: 3, class: ppr }239 - { id: 4, class: gpr32 }240 - { id: 5, class: gpr32 }241liveins:242 - { reg: '$x0', virtual-reg: '%0' }243 - { reg: '$x1', virtual-reg: '%1' }244frameInfo:245 maxCallFrameSize: 0246body: |247 bb.0.entry:248 liveins: $x0, $x1249 250 ; CHECK-LABEL: name: whilewr_b8_s64_keep_ptest_of_halfs251 ; CHECK: liveins: $x0, $x1252 ; CHECK-NEXT: {{ $}}253 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x1254 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x0255 ; CHECK-NEXT: [[PTRUE_H:%[0-9]+]]:ppr = PTRUE_H 31, implicit $vg256 ; CHECK-NEXT: [[WHILEWR_PXX_B:%[0-9]+]]:ppr = WHILEWR_PXX_B [[COPY1]], [[COPY]], implicit-def dead $nzcv257 ; CHECK-NEXT: PTEST_PP killed [[PTRUE_H]], killed [[WHILEWR_PXX_B]], implicit-def $nzcv258 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $wzr259 ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr [[COPY2]], $wzr, 0, implicit $nzcv260 ; CHECK-NEXT: $w0 = COPY [[CSINCWr]]261 ; CHECK-NEXT: RET_ReallyLR implicit $w0262 %1:gpr64 = COPY $x1263 %0:gpr64 = COPY $x0264 %2:ppr = PTRUE_H 31, implicit $vg265 %3:ppr = WHILEWR_PXX_B %0, %1, implicit-def dead $nzcv266 PTEST_PP killed %2, killed %3, implicit-def $nzcv267 %4:gpr32 = COPY $wzr268 %5:gpr32 = CSINCWr %4, $wzr, 0, implicit $nzcv269 $w0 = COPY %5270 RET_ReallyLR implicit $w0271 272...273 274# PTEST is not redundant when it's Pg operand is not an all active predicate275# of element size matching the WHILEGE, which is the implicitly predicate276# used by WHILE when calculating the condition codes.277---278name: whilewr_b8_s64_keep_ptest_of_words279alignment: 2280tracksRegLiveness: true281registers:282 - { id: 0, class: gpr64 }283 - { id: 1, class: gpr64 }284 - { id: 2, class: ppr }285 - { id: 3, class: ppr }286 - { id: 4, class: gpr32 }287 - { id: 5, class: gpr32 }288liveins:289 - { reg: '$x0', virtual-reg: '%0' }290 - { reg: '$x1', virtual-reg: '%1' }291frameInfo:292 maxCallFrameSize: 0293body: |294 bb.0.entry:295 liveins: $x0, $x1296 297 ; CHECK-LABEL: name: whilewr_b8_s64_keep_ptest_of_words298 ; CHECK: liveins: $x0, $x1299 ; CHECK-NEXT: {{ $}}300 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x1301 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x0302 ; CHECK-NEXT: [[PTRUE_S:%[0-9]+]]:ppr = PTRUE_S 31, implicit $vg303 ; CHECK-NEXT: [[WHILEWR_PXX_B:%[0-9]+]]:ppr = WHILEWR_PXX_B [[COPY1]], [[COPY]], implicit-def dead $nzcv304 ; CHECK-NEXT: PTEST_PP killed [[PTRUE_S]], killed [[WHILEWR_PXX_B]], implicit-def $nzcv305 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $wzr306 ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr [[COPY2]], $wzr, 0, implicit $nzcv307 ; CHECK-NEXT: $w0 = COPY [[CSINCWr]]308 ; CHECK-NEXT: RET_ReallyLR implicit $w0309 %1:gpr64 = COPY $x1310 %0:gpr64 = COPY $x0311 %2:ppr = PTRUE_S 31, implicit $vg312 %3:ppr = WHILEWR_PXX_B %0, %1, implicit-def dead $nzcv313 PTEST_PP killed %2, killed %3, implicit-def $nzcv314 %4:gpr32 = COPY $wzr315 %5:gpr32 = CSINCWr %4, $wzr, 0, implicit $nzcv316 $w0 = COPY %5317 RET_ReallyLR implicit $w0318 319...320 321# PTEST is not redundant when it's Pg operand is not an all active predicate322# of element size matching the WHILEGE, which is the implicitly predicate323# used by WHILE when calculating the condition codes.324---325name: whilewr_b8_s64_keep_ptest_of_doublewords326alignment: 2327tracksRegLiveness: true328registers:329 - { id: 0, class: gpr64 }330 - { id: 1, class: gpr64 }331 - { id: 2, class: ppr }332 - { id: 3, class: ppr }333 - { id: 4, class: gpr32 }334 - { id: 5, class: gpr32 }335liveins:336 - { reg: '$x0', virtual-reg: '%0' }337 - { reg: '$x1', virtual-reg: '%1' }338frameInfo:339 maxCallFrameSize: 0340body: |341 bb.0.entry:342 liveins: $x0, $x1343 344 ; CHECK-LABEL: name: whilewr_b8_s64_keep_ptest_of_doublewords345 ; CHECK: liveins: $x0, $x1346 ; CHECK-NEXT: {{ $}}347 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY $x1348 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x0349 ; CHECK-NEXT: [[PTRUE_D:%[0-9]+]]:ppr = PTRUE_D 31, implicit $vg350 ; CHECK-NEXT: [[WHILEWR_PXX_B:%[0-9]+]]:ppr = WHILEWR_PXX_B [[COPY1]], [[COPY]], implicit-def dead $nzcv351 ; CHECK-NEXT: PTEST_PP killed [[PTRUE_D]], killed [[WHILEWR_PXX_B]], implicit-def $nzcv352 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY $wzr353 ; CHECK-NEXT: [[CSINCWr:%[0-9]+]]:gpr32 = CSINCWr [[COPY2]], $wzr, 0, implicit $nzcv354 ; CHECK-NEXT: $w0 = COPY [[CSINCWr]]355 ; CHECK-NEXT: RET_ReallyLR implicit $w0356 %1:gpr64 = COPY $x1357 %0:gpr64 = COPY $x0358 %2:ppr = PTRUE_D 31, implicit $vg359 %3:ppr = WHILEWR_PXX_B %0, %1, implicit-def dead $nzcv360 PTEST_PP killed %2, killed %3, implicit-def $nzcv361 %4:gpr32 = COPY $wzr362 %5:gpr32 = CSINCWr %4, $wzr, 0, implicit $nzcv363 $w0 = COPY %5364 RET_ReallyLR implicit $w0365 366...367