1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -run-pass peephole-opt -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN %s
4 # Check that when we jump through several subregisters in sequence of
5 # reg_sequence we can still find a plain src for a copy.
6 # In this specific test, we want %4 to read directly from %1 and
7 # %5 from %0. These values come from the respective chains:
8 # %4 -> %3.sub0 -> %2.sub1 -> %1
9 # %5 -> %3.sub1 -> %2.sub0 -> %0
11 # We used to not simplify this because we were bailing when two
12 # subreg indices were in the same chain (%3.subX and %2.subY)
14 name: reg_sequence_removal
17 liveins: $vgpr0, $vgpr1
19 ; GCN-LABEL: name: reg_sequence_removal
20 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
21 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
22 ; GCN: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY]], %subreg.sub0, [[COPY1]], %subreg.sub1
23 ; GCN: [[REG_SEQUENCE1:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[REG_SEQUENCE]].sub1, %subreg.sub0, [[REG_SEQUENCE]].sub0, %subreg.sub1
24 ; GCN: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY1]]
25 ; GCN: [[COPY3:%[0-9]+]]:vgpr_32 = COPY [[COPY]]
26 ; GCN: KILL [[COPY3]], implicit [[COPY2]]
27 %0:vgpr_32 = COPY $vgpr0
28 %1:vgpr_32 = COPY $vgpr1
29 %2:vreg_64 = REG_SEQUENCE %0, %subreg.sub0, %1, %subreg.sub1
30 %3:vreg_64 = REG_SEQUENCE %2.sub1, %subreg.sub0, %2.sub0, %subreg.sub1
31 %4:vgpr_32 = COPY %3.sub0
32 %5:vgpr_32 = COPY %3.sub1