1# RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs -run-pass post-RA-hazard-rec -o - %s | FileCheck -check-prefix=GCN %s
2
3# GCN-LABEL: name: vmem_vcc_fallthrough
4# GCN:      bb.1:
5# GCN-NEXT: S_NOP 4
6# GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
7---
8name:            vmem_vcc_fallthrough
9body:             |
10  bb.0:
11    successors: %bb.1
12
13    $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
14    $vgpr0 = IMPLICIT_DEF
15    $vgpr1 = V_ADDC_U32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $vcc, implicit $exec
16
17  bb.1:
18    $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $vcc_lo, 0, 0, 0, 0, 0, 0, implicit $exec
19...
20# GCN-LABEL: name: vmem_vcc_branch_to_next
21# GCN:      bb.1:
22# GCN-NEXT: S_NOP 3
23# GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
24---
25name:            vmem_vcc_branch_to_next
26body:             |
27  bb.0:
28    successors: %bb.1
29
30    $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
31    $vgpr0 = IMPLICIT_DEF
32    $vgpr1 = V_ADDC_U32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $vcc, implicit $exec
33    S_BRANCH %bb.1
34
35  bb.1:
36    $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $vcc_lo, 0, 0, 0, 0, 0, 0, implicit $exec
37...
38# GCN-LABEL: name: vmem_vcc_fallthrough_no_hazard_too_far
39# GCN:      bb.1:
40# GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
41---
42name:            vmem_vcc_fallthrough_no_hazard_too_far
43body:             |
44  bb.0:
45    successors: %bb.1
46
47    $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
48    $vgpr0 = IMPLICIT_DEF
49    $vgpr1 = V_ADDC_U32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $vcc, implicit $exec
50    $sgpr0 = S_MOV_B32 0
51    $sgpr0 = S_MOV_B32 0
52    $sgpr0 = S_MOV_B32 0
53    $sgpr0 = S_MOV_B32 0
54    $sgpr0 = S_MOV_B32 0
55
56  bb.1:
57    $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $vcc_lo, 0, 0, 0, 0, 0, 0, implicit $exec
58...
59# GCN-LABEL: name: vmem_vcc_fallthrough_no_hazard_nops
60# GCN:      bb.1:
61# GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
62---
63name:            vmem_vcc_fallthrough_no_hazard_nops
64body:             |
65  bb.0:
66    successors: %bb.1
67
68    $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
69    $vgpr0 = IMPLICIT_DEF
70    $vgpr1 = V_ADDC_U32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $vcc, implicit $exec
71    S_NOP 4
72
73  bb.1:
74    $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $vcc_lo, 0, 0, 0, 0, 0, 0, implicit $exec
75...
76# GCN-LABEL: name: vmem_vcc_branch_around
77# GCN:      bb.2:
78# GCN-NEXT: S_NOP 3
79# GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
80---
81name:            vmem_vcc_branch_around
82body:             |
83  bb.0:
84    successors: %bb.2
85
86    $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
87    $vgpr0 = IMPLICIT_DEF
88    $vgpr1 = V_ADDC_U32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $vcc, implicit $exec
89    S_BRANCH %bb.2
90
91  bb.1:
92    successors: %bb.2
93
94    S_NOP 0
95    S_NOP 0
96    S_NOP 0
97    S_NOP 0
98
99  bb.2:
100    $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $vcc_lo, 0, 0, 0, 0, 0, 0, implicit $exec
101...
102# GCN-LABEL: name: vmem_vcc_branch_backedge
103# GCN:      S_NOP 3
104# GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
105---
106name:            vmem_vcc_branch_backedge
107body:             |
108  bb.0:
109    successors: %bb.1
110
111    $vgpr0 = IMPLICIT_DEF
112    $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
113    $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $vcc_lo, 0, 0, 0, 0, 0, 0, implicit $exec
114
115  bb.1:
116    $vgpr0 = IMPLICIT_DEF
117    $vgpr1 = V_ADDC_U32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $vcc, implicit $exec
118    S_BRANCH %bb.0
119...
120# GCN-LABEL: name: vmem_vcc_min_of_two
121# GCN:      bb.2:
122# GCN-NEXT: S_NOP 4
123# GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
124---
125name:            vmem_vcc_min_of_two
126body:             |
127  bb.0:
128    successors: %bb.2
129
130    $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
131    $vgpr0 = IMPLICIT_DEF
132    $vgpr1 = V_ADDC_U32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $vcc, implicit $exec
133    S_NOP 0
134    S_BRANCH %bb.2
135
136  bb.1:
137    successors: %bb.2
138
139    $vgpr1 = V_ADDC_U32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $vcc, implicit $exec
140
141  bb.2:
142    $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $vcc_lo, 0, 0, 0, 0, 0, 0, implicit $exec
143...
144# GCN-LABEL: name: vmem_vcc_self_loop
145# GCN:      S_NOP 3
146# GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
147---
148name:            vmem_vcc_self_loop
149body:             |
150  bb.0:
151    successors: %bb.0
152
153    $vgpr0 = IMPLICIT_DEF
154    $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
155    $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $vcc_lo, 0, 0, 0, 0, 0, 0, implicit $exec
156    $vgpr1 = V_ADDC_U32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $vcc, implicit $exec
157    S_BRANCH %bb.0
158...
159# GCN-LABEL: name: vmem_vcc_min_of_two_self_loop1
160# GCN:      bb.1:
161# GCN:      $sgpr0 = S_MOV_B32 0
162# GCN-NEXT: S_NOP 3
163# GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
164---
165name:            vmem_vcc_min_of_two_self_loop1
166body:             |
167  bb.0:
168    successors: %bb.1
169
170    $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
171    $vgpr0 = IMPLICIT_DEF
172    $vgpr1 = V_ADDC_U32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $vcc, implicit $exec
173
174  bb.1:
175    successors: %bb.1
176
177    $sgpr0 = S_MOV_B32 0
178    $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $vcc_lo, 0, 0, 0, 0, 0, 0, implicit $exec
179    $vgpr1 = V_ADDC_U32_e32 $vgpr1, $vgpr1, implicit-def $vcc, implicit $vcc, implicit $exec
180    S_BRANCH %bb.1
181...
182# GCN-LABEL: name: vmem_vcc_min_of_two_self_loop2
183# GCN:      bb.1:
184# GCN:      $sgpr0 = S_MOV_B32 0
185# GCN-NEXT: S_NOP 2
186# GCN-NEXT: BUFFER_LOAD_DWORD_OFFEN
187---
188name:            vmem_vcc_min_of_two_self_loop2
189body:             |
190  bb.0:
191    successors: %bb.1
192
193    $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF
194    $vgpr0 = IMPLICIT_DEF
195    $vgpr1 = V_ADDC_U32_e32 $vgpr0, $vgpr0, implicit-def $vcc, implicit $vcc, implicit $exec
196    S_NOP 0
197
198  bb.1:
199    successors: %bb.1
200
201    $sgpr0 = S_MOV_B32 0
202    $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $vcc_lo, 0, 0, 0, 0, 0, 0, implicit $exec
203    $vgpr1 = V_ADDC_U32_e32 $vgpr1, $vgpr1, implicit-def $vcc, implicit $vcc, implicit $exec
204    S_BRANCH %bb.1
205...
206