1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -start-after=phi-node-elimination -stop-before=greedy -o - %s | FileCheck -check-prefix=GFX9 %s
3 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -start-after=phi-node-elimination -stop-before=greedy -early-live-intervals -o - %s | FileCheck -check-prefix=GFX9 %s
5 # Make sure that the V_MOV_B32 isn't rematerialized out of the loop. This was also breaking RenameIndependentSubregisters which missed the use of all subregisters.
8 name: index_vgpr_waterfall_loop
9 tracksRegLiveness: true
11 - { reg: '$vgpr0', virtual-reg: '%0' }
12 - { reg: '$vgpr1', virtual-reg: '%1' }
13 - { reg: '$vgpr2', virtual-reg: '%2' }
14 - { reg: '$vgpr3', virtual-reg: '%3' }
15 - { reg: '$vgpr4', virtual-reg: '%4' }
16 - { reg: '$vgpr5', virtual-reg: '%5' }
17 - { reg: '$vgpr6', virtual-reg: '%6' }
18 - { reg: '$vgpr7', virtual-reg: '%7' }
19 - { reg: '$vgpr8', virtual-reg: '%8' }
20 - { reg: '$vgpr9', virtual-reg: '%9' }
21 - { reg: '$vgpr10', virtual-reg: '%10' }
22 - { reg: '$vgpr11', virtual-reg: '%11' }
23 - { reg: '$vgpr12', virtual-reg: '%12' }
24 - { reg: '$vgpr13', virtual-reg: '%13' }
25 - { reg: '$vgpr14', virtual-reg: '%14' }
26 - { reg: '$vgpr15', virtual-reg: '%15' }
27 - { reg: '$vgpr16', virtual-reg: '%16' }
28 - { reg: '$sgpr30_sgpr31', virtual-reg: '%17' }
30 ; GFX9-LABEL: name: index_vgpr_waterfall_loop
32 ; GFX9-NEXT: successors: %bb.1(0x80000000)
33 ; GFX9-NEXT: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7, $vgpr8, $vgpr9, $vgpr10, $vgpr11, $vgpr12, $vgpr13, $vgpr14, $vgpr15, $vgpr16, $sgpr30_sgpr31
35 ; GFX9-NEXT: [[COPY:%[0-9]+]]:sreg_64 = COPY $sgpr30_sgpr31
36 ; GFX9-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr16
37 ; GFX9-NEXT: undef [[COPY2:%[0-9]+]].sub15:vreg_512 = COPY $vgpr15
38 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub14:vreg_512 = COPY $vgpr14
39 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub13:vreg_512 = COPY $vgpr13
40 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub12:vreg_512 = COPY $vgpr12
41 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub11:vreg_512 = COPY $vgpr11
42 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub10:vreg_512 = COPY $vgpr10
43 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub9:vreg_512 = COPY $vgpr9
44 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub8:vreg_512 = COPY $vgpr8
45 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub7:vreg_512 = COPY $vgpr7
46 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub6:vreg_512 = COPY $vgpr6
47 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub5:vreg_512 = COPY $vgpr5
48 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub4:vreg_512 = COPY $vgpr4
49 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub3:vreg_512 = COPY $vgpr3
50 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub2:vreg_512 = COPY $vgpr2
51 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub1:vreg_512 = COPY $vgpr1
52 ; GFX9-NEXT: [[COPY2:%[0-9]+]].sub0:vreg_512 = COPY $vgpr0
53 ; GFX9-NEXT: [[V_AND_B32_e32_:%[0-9]+]]:vgpr_32 = V_AND_B32_e32 15, [[COPY1]], implicit $exec
54 ; GFX9-NEXT: [[S_MOV_B64_:%[0-9]+]]:sreg_64_xexec = S_MOV_B64 $exec
57 ; GFX9-NEXT: successors: %bb.1(0x40000000), %bb.2(0x40000000)
59 ; GFX9-NEXT: [[V_READFIRSTLANE_B32_:%[0-9]+]]:sgpr_32 = V_READFIRSTLANE_B32 [[V_AND_B32_e32_]], implicit $exec
60 ; GFX9-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64 = V_CMP_EQ_U32_e64 [[V_READFIRSTLANE_B32_]], [[V_AND_B32_e32_]], implicit $exec
61 ; GFX9-NEXT: [[S_AND_SAVEEXEC_B64_:%[0-9]+]]:sreg_64 = S_AND_SAVEEXEC_B64 [[V_CMP_EQ_U32_e64_]], implicit-def $exec, implicit-def dead $scc, implicit $exec
62 ; GFX9-NEXT: S_SET_GPR_IDX_ON [[V_READFIRSTLANE_B32_]], 1, implicit-def $m0, implicit-def $mode, implicit undef $m0, implicit $mode
63 ; GFX9-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 undef [[COPY2]].sub0, implicit $exec, implicit [[COPY2]], implicit $m0
64 ; GFX9-NEXT: S_SET_GPR_IDX_OFF implicit-def $mode, implicit $mode
65 ; GFX9-NEXT: $exec = S_XOR_B64_term $exec, [[S_AND_SAVEEXEC_B64_]], implicit-def dead $scc
66 ; GFX9-NEXT: S_CBRANCH_EXECNZ %bb.1, implicit $exec
69 ; GFX9-NEXT: $exec = S_MOV_B64 [[S_MOV_B64_]]
70 ; GFX9-NEXT: $sgpr30_sgpr31 = COPY [[COPY]]
71 ; GFX9-NEXT: $vgpr0 = COPY [[V_MOV_B32_e32_]]
72 ; GFX9-NEXT: S_SETPC_B64_return $sgpr30_sgpr31, implicit $vgpr0, implicit undef $vgpr1, implicit undef $vgpr2, implicit undef $vgpr3
75 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7, $vgpr8, $vgpr9, $vgpr10, $vgpr11, $vgpr12, $vgpr13, $vgpr14, $vgpr15, $vgpr16, $sgpr30_sgpr31
77 %17:sreg_64 = COPY killed $sgpr30_sgpr31
78 %16:vgpr_32 = COPY killed $vgpr16
79 %15:vgpr_32 = COPY killed $vgpr15
80 %14:vgpr_32 = COPY killed $vgpr14
81 %13:vgpr_32 = COPY killed $vgpr13
82 %12:vgpr_32 = COPY killed $vgpr12
83 %11:vgpr_32 = COPY killed $vgpr11
84 %10:vgpr_32 = COPY killed $vgpr10
85 %9:vgpr_32 = COPY killed $vgpr9
86 %8:vgpr_32 = COPY killed $vgpr8
87 %7:vgpr_32 = COPY killed $vgpr7
88 %6:vgpr_32 = COPY killed $vgpr6
89 %5:vgpr_32 = COPY killed $vgpr5
90 %4:vgpr_32 = COPY killed $vgpr4
91 %3:vgpr_32 = COPY killed $vgpr3
92 %2:vgpr_32 = COPY killed $vgpr2
93 %1:vgpr_32 = COPY killed $vgpr1
94 %0:vgpr_32 = COPY killed $vgpr0
95 %18:vreg_512 = REG_SEQUENCE killed %0, %subreg.sub0, killed %1, %subreg.sub1, killed %2, %subreg.sub2, killed %3, %subreg.sub3, killed %4, %subreg.sub4, killed %5, %subreg.sub5, killed %6, %subreg.sub6, killed %7, %subreg.sub7, killed %8, %subreg.sub8, killed %9, %subreg.sub9, killed %10, %subreg.sub10, killed %11, %subreg.sub11, killed %12, %subreg.sub12, killed %13, %subreg.sub13, killed %14, %subreg.sub14, killed %15, %subreg.sub15
96 %19:vgpr_32 = V_AND_B32_e32 15, killed %16, implicit $exec
97 %20:sreg_64_xexec = S_MOV_B64 $exec
100 successors: %bb.1, %bb.2
102 %21:sgpr_32 = V_READFIRSTLANE_B32 %19, implicit $exec
103 %22:sreg_64 = V_CMP_EQ_U32_e64 %21, %19, implicit $exec
104 %23:sreg_64 = S_AND_SAVEEXEC_B64 killed %22, implicit-def $exec, implicit-def dead $scc, implicit $exec
105 S_SET_GPR_IDX_ON killed %21, 1, implicit-def $m0, implicit-def $mode, implicit undef $m0, implicit $mode
106 %24:vgpr_32 = V_MOV_B32_e32 undef %18.sub0, implicit $exec, implicit %18, implicit $m0
107 S_SET_GPR_IDX_OFF implicit-def $mode, implicit $mode
108 $exec = S_XOR_B64_term $exec, killed %23, implicit-def dead $scc
109 S_CBRANCH_EXECNZ %bb.1, implicit $exec
112 $exec = S_MOV_B64 killed %20
113 $sgpr30_sgpr31 = COPY killed %17
114 $vgpr0 = COPY killed %24
115 S_SETPC_B64_return killed $sgpr30_sgpr31, implicit killed $vgpr0, implicit undef $vgpr1, implicit undef $vgpr2, implicit undef $vgpr3