xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/cf-stack-bug.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=redwood -debug-only=r600cf %s -o - 2>%t | FileCheck %s --check-prefix=FUNC
2*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck --check-prefix=BUG64 %s < %t
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=sumo -debug-only=r600cf %s -o - 2>%t | FileCheck %s --check-prefix=FUNC
5*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck --check-prefix=BUG64 %s < %t
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=barts -debug-only=r600cf %s -o - 2>%t | FileCheck %s --check-prefix=FUNC
8*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck --check-prefix=BUG64 %s < %t
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=turks -debug-only=r600cf %s -o - 2>%t | FileCheck %s --check-prefix=FUNC
11*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck --check-prefix=BUG64 %s < %t
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=caicos -debug-only=r600cf %s -o - 2>%t | FileCheck %s --check-prefix=FUNC
14*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck --check-prefix=BUG64 %s < %t
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=cedar -debug-only=r600cf %s -o - 2>%t | FileCheck %s --check-prefix=FUNC
17*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck --check-prefix=BUG32 %s < %t
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=juniper -debug-only=r600cf %s -o - 2>%t | FileCheck %s --check-prefix=FUNC
20*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck --check-prefix=NOBUG %s < %t
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=cypress -debug-only=r600cf %s -o - 2>%t | FileCheck %s --check-prefix=FUNC
23*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck --check-prefix=NOBUG %s < %t
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=cayman -debug-only=r600cf %s -o - 2>%t | FileCheck %s --check-prefix=FUNC
26*9880d681SAndroid Build Coastguard Worker; RUN: FileCheck --check-prefix=NOBUG %s < %t
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker; REQUIRES: asserts
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker; We are currently allocating 2 extra sub-entries on Evergreen / NI for
31*9880d681SAndroid Build Coastguard Worker; non-WQM push instructions if we change this to 1, then we will need to
32*9880d681SAndroid Build Coastguard Worker; add one level of depth to each of these tests.
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker; BUG64-NOT: Applying bug work-around
35*9880d681SAndroid Build Coastguard Worker; BUG32-NOT: Applying bug work-around
36*9880d681SAndroid Build Coastguard Worker; NOBUG-NOT: Applying bug work-around
37*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}nested3:
38*9880d681SAndroid Build Coastguard Workerdefine void @nested3(i32 addrspace(1)* %out, i32 %cond) {
39*9880d681SAndroid Build Coastguard Workerentry:
40*9880d681SAndroid Build Coastguard Worker  %0 = icmp sgt i32 %cond, 0
41*9880d681SAndroid Build Coastguard Worker  br i1 %0, label %if.1, label %end
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerif.1:
44*9880d681SAndroid Build Coastguard Worker  %1 = icmp sgt i32 %cond, 10
45*9880d681SAndroid Build Coastguard Worker  br i1 %1, label %if.2, label %if.store.1
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Workerif.store.1:
48*9880d681SAndroid Build Coastguard Worker  store i32 1, i32 addrspace(1)* %out
49*9880d681SAndroid Build Coastguard Worker  br label %end
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Workerif.2:
52*9880d681SAndroid Build Coastguard Worker  %2 = icmp sgt i32 %cond, 20
53*9880d681SAndroid Build Coastguard Worker  br i1 %2, label %if.3, label %if.2.store
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Workerif.2.store:
56*9880d681SAndroid Build Coastguard Worker  store i32 2, i32 addrspace(1)* %out
57*9880d681SAndroid Build Coastguard Worker  br label %end
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Workerif.3:
60*9880d681SAndroid Build Coastguard Worker  store i32 3, i32 addrspace(1)* %out
61*9880d681SAndroid Build Coastguard Worker  br label %end
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Workerend:
64*9880d681SAndroid Build Coastguard Worker  ret void
65*9880d681SAndroid Build Coastguard Worker}
66*9880d681SAndroid Build Coastguard Worker
67*9880d681SAndroid Build Coastguard Worker; BUG64: Applying bug work-around
68*9880d681SAndroid Build Coastguard Worker; BUG32-NOT: Applying bug work-around
69*9880d681SAndroid Build Coastguard Worker; NOBUG-NOT: Applying bug work-around
70*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}nested4:
71*9880d681SAndroid Build Coastguard Workerdefine void @nested4(i32 addrspace(1)* %out, i32 %cond) {
72*9880d681SAndroid Build Coastguard Workerentry:
73*9880d681SAndroid Build Coastguard Worker  %0 = icmp sgt i32 %cond, 0
74*9880d681SAndroid Build Coastguard Worker  br i1 %0, label %if.1, label %end
75*9880d681SAndroid Build Coastguard Worker
76*9880d681SAndroid Build Coastguard Workerif.1:
77*9880d681SAndroid Build Coastguard Worker  %1 = icmp sgt i32 %cond, 10
78*9880d681SAndroid Build Coastguard Worker  br i1 %1, label %if.2, label %if.1.store
79*9880d681SAndroid Build Coastguard Worker
80*9880d681SAndroid Build Coastguard Workerif.1.store:
81*9880d681SAndroid Build Coastguard Worker  store i32 1, i32 addrspace(1)* %out
82*9880d681SAndroid Build Coastguard Worker  br label %end
83*9880d681SAndroid Build Coastguard Worker
84*9880d681SAndroid Build Coastguard Workerif.2:
85*9880d681SAndroid Build Coastguard Worker  %2 = icmp sgt i32 %cond, 20
86*9880d681SAndroid Build Coastguard Worker  br i1 %2, label %if.3, label %if.2.store
87*9880d681SAndroid Build Coastguard Worker
88*9880d681SAndroid Build Coastguard Workerif.2.store:
89*9880d681SAndroid Build Coastguard Worker  store i32 2, i32 addrspace(1)* %out
90*9880d681SAndroid Build Coastguard Worker  br label %end
91*9880d681SAndroid Build Coastguard Worker
92*9880d681SAndroid Build Coastguard Workerif.3:
93*9880d681SAndroid Build Coastguard Worker  %3 = icmp sgt i32 %cond, 30
94*9880d681SAndroid Build Coastguard Worker  br i1 %3, label %if.4, label %if.3.store
95*9880d681SAndroid Build Coastguard Worker
96*9880d681SAndroid Build Coastguard Workerif.3.store:
97*9880d681SAndroid Build Coastguard Worker  store i32 3, i32 addrspace(1)* %out
98*9880d681SAndroid Build Coastguard Worker  br label %end
99*9880d681SAndroid Build Coastguard Worker
100*9880d681SAndroid Build Coastguard Workerif.4:
101*9880d681SAndroid Build Coastguard Worker  store i32 4, i32 addrspace(1)* %out
102*9880d681SAndroid Build Coastguard Worker  br label %end
103*9880d681SAndroid Build Coastguard Worker
104*9880d681SAndroid Build Coastguard Workerend:
105*9880d681SAndroid Build Coastguard Worker  ret void
106*9880d681SAndroid Build Coastguard Worker}
107*9880d681SAndroid Build Coastguard Worker
108*9880d681SAndroid Build Coastguard Worker; BUG64: Applying bug work-around
109*9880d681SAndroid Build Coastguard Worker; BUG32-NOT: Applying bug work-around
110*9880d681SAndroid Build Coastguard Worker; NOBUG-NOT: Applying bug work-around
111*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}nested7:
112*9880d681SAndroid Build Coastguard Workerdefine void @nested7(i32 addrspace(1)* %out, i32 %cond) {
113*9880d681SAndroid Build Coastguard Workerentry:
114*9880d681SAndroid Build Coastguard Worker  %0 = icmp sgt i32 %cond, 0
115*9880d681SAndroid Build Coastguard Worker  br i1 %0, label %if.1, label %end
116*9880d681SAndroid Build Coastguard Worker
117*9880d681SAndroid Build Coastguard Workerif.1:
118*9880d681SAndroid Build Coastguard Worker  %1 = icmp sgt i32 %cond, 10
119*9880d681SAndroid Build Coastguard Worker  br i1 %1, label %if.2, label %if.1.store
120*9880d681SAndroid Build Coastguard Worker
121*9880d681SAndroid Build Coastguard Workerif.1.store:
122*9880d681SAndroid Build Coastguard Worker  store i32 1, i32 addrspace(1)* %out
123*9880d681SAndroid Build Coastguard Worker  br label %end
124*9880d681SAndroid Build Coastguard Worker
125*9880d681SAndroid Build Coastguard Workerif.2:
126*9880d681SAndroid Build Coastguard Worker  %2 = icmp sgt i32 %cond, 20
127*9880d681SAndroid Build Coastguard Worker  br i1 %2, label %if.3, label %if.2.store
128*9880d681SAndroid Build Coastguard Worker
129*9880d681SAndroid Build Coastguard Workerif.2.store:
130*9880d681SAndroid Build Coastguard Worker  store i32 2, i32 addrspace(1)* %out
131*9880d681SAndroid Build Coastguard Worker  br label %end
132*9880d681SAndroid Build Coastguard Worker
133*9880d681SAndroid Build Coastguard Workerif.3:
134*9880d681SAndroid Build Coastguard Worker  %3 = icmp sgt i32 %cond, 30
135*9880d681SAndroid Build Coastguard Worker  br i1 %3, label %if.4, label %if.3.store
136*9880d681SAndroid Build Coastguard Worker
137*9880d681SAndroid Build Coastguard Workerif.3.store:
138*9880d681SAndroid Build Coastguard Worker  store i32 3, i32 addrspace(1)* %out
139*9880d681SAndroid Build Coastguard Worker  br label %end
140*9880d681SAndroid Build Coastguard Worker
141*9880d681SAndroid Build Coastguard Workerif.4:
142*9880d681SAndroid Build Coastguard Worker  %4 = icmp sgt i32 %cond, 40
143*9880d681SAndroid Build Coastguard Worker  br i1 %4, label %if.5, label %if.4.store
144*9880d681SAndroid Build Coastguard Worker
145*9880d681SAndroid Build Coastguard Workerif.4.store:
146*9880d681SAndroid Build Coastguard Worker  store i32 4, i32 addrspace(1)* %out
147*9880d681SAndroid Build Coastguard Worker  br label %end
148*9880d681SAndroid Build Coastguard Worker
149*9880d681SAndroid Build Coastguard Workerif.5:
150*9880d681SAndroid Build Coastguard Worker  %5 = icmp sgt i32 %cond, 50
151*9880d681SAndroid Build Coastguard Worker  br i1 %5, label %if.6, label %if.5.store
152*9880d681SAndroid Build Coastguard Worker
153*9880d681SAndroid Build Coastguard Workerif.5.store:
154*9880d681SAndroid Build Coastguard Worker  store i32 5, i32 addrspace(1)* %out
155*9880d681SAndroid Build Coastguard Worker  br label %end
156*9880d681SAndroid Build Coastguard Worker
157*9880d681SAndroid Build Coastguard Workerif.6:
158*9880d681SAndroid Build Coastguard Worker  %6 = icmp sgt i32 %cond, 60
159*9880d681SAndroid Build Coastguard Worker  br i1 %6, label %if.7, label %if.6.store
160*9880d681SAndroid Build Coastguard Worker
161*9880d681SAndroid Build Coastguard Workerif.6.store:
162*9880d681SAndroid Build Coastguard Worker  store i32 6, i32 addrspace(1)* %out
163*9880d681SAndroid Build Coastguard Worker  br label %end
164*9880d681SAndroid Build Coastguard Worker
165*9880d681SAndroid Build Coastguard Workerif.7:
166*9880d681SAndroid Build Coastguard Worker  store i32 7, i32 addrspace(1)* %out
167*9880d681SAndroid Build Coastguard Worker  br label %end
168*9880d681SAndroid Build Coastguard Worker
169*9880d681SAndroid Build Coastguard Workerend:
170*9880d681SAndroid Build Coastguard Worker  ret void
171*9880d681SAndroid Build Coastguard Worker}
172*9880d681SAndroid Build Coastguard Worker
173*9880d681SAndroid Build Coastguard Worker; BUG64: Applying bug work-around
174*9880d681SAndroid Build Coastguard Worker; BUG32: Applying bug work-around
175*9880d681SAndroid Build Coastguard Worker; NOBUG-NOT: Applying bug work-around
176*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}nested8:
177*9880d681SAndroid Build Coastguard Workerdefine void @nested8(i32 addrspace(1)* %out, i32 %cond) {
178*9880d681SAndroid Build Coastguard Workerentry:
179*9880d681SAndroid Build Coastguard Worker  %0 = icmp sgt i32 %cond, 0
180*9880d681SAndroid Build Coastguard Worker  br i1 %0, label %if.1, label %end
181*9880d681SAndroid Build Coastguard Worker
182*9880d681SAndroid Build Coastguard Workerif.1:
183*9880d681SAndroid Build Coastguard Worker  %1 = icmp sgt i32 %cond, 10
184*9880d681SAndroid Build Coastguard Worker  br i1 %1, label %if.2, label %if.1.store
185*9880d681SAndroid Build Coastguard Worker
186*9880d681SAndroid Build Coastguard Workerif.1.store:
187*9880d681SAndroid Build Coastguard Worker  store i32 1, i32 addrspace(1)* %out
188*9880d681SAndroid Build Coastguard Worker  br label %end
189*9880d681SAndroid Build Coastguard Worker
190*9880d681SAndroid Build Coastguard Workerif.2:
191*9880d681SAndroid Build Coastguard Worker  %2 = icmp sgt i32 %cond, 20
192*9880d681SAndroid Build Coastguard Worker  br i1 %2, label %if.3, label %if.2.store
193*9880d681SAndroid Build Coastguard Worker
194*9880d681SAndroid Build Coastguard Workerif.2.store:
195*9880d681SAndroid Build Coastguard Worker  store i32 2, i32 addrspace(1)* %out
196*9880d681SAndroid Build Coastguard Worker  br label %end
197*9880d681SAndroid Build Coastguard Worker
198*9880d681SAndroid Build Coastguard Workerif.3:
199*9880d681SAndroid Build Coastguard Worker  %3 = icmp sgt i32 %cond, 30
200*9880d681SAndroid Build Coastguard Worker  br i1 %3, label %if.4, label %if.3.store
201*9880d681SAndroid Build Coastguard Worker
202*9880d681SAndroid Build Coastguard Workerif.3.store:
203*9880d681SAndroid Build Coastguard Worker  store i32 3, i32 addrspace(1)* %out
204*9880d681SAndroid Build Coastguard Worker  br label %end
205*9880d681SAndroid Build Coastguard Worker
206*9880d681SAndroid Build Coastguard Workerif.4:
207*9880d681SAndroid Build Coastguard Worker  %4 = icmp sgt i32 %cond, 40
208*9880d681SAndroid Build Coastguard Worker  br i1 %4, label %if.5, label %if.4.store
209*9880d681SAndroid Build Coastguard Worker
210*9880d681SAndroid Build Coastguard Workerif.4.store:
211*9880d681SAndroid Build Coastguard Worker  store i32 4, i32 addrspace(1)* %out
212*9880d681SAndroid Build Coastguard Worker  br label %end
213*9880d681SAndroid Build Coastguard Worker
214*9880d681SAndroid Build Coastguard Workerif.5:
215*9880d681SAndroid Build Coastguard Worker  %5 = icmp sgt i32 %cond, 50
216*9880d681SAndroid Build Coastguard Worker  br i1 %5, label %if.6, label %if.5.store
217*9880d681SAndroid Build Coastguard Worker
218*9880d681SAndroid Build Coastguard Workerif.5.store:
219*9880d681SAndroid Build Coastguard Worker  store i32 5, i32 addrspace(1)* %out
220*9880d681SAndroid Build Coastguard Worker  br label %end
221*9880d681SAndroid Build Coastguard Worker
222*9880d681SAndroid Build Coastguard Workerif.6:
223*9880d681SAndroid Build Coastguard Worker  %6 = icmp sgt i32 %cond, 60
224*9880d681SAndroid Build Coastguard Worker  br i1 %6, label %if.7, label %if.6.store
225*9880d681SAndroid Build Coastguard Worker
226*9880d681SAndroid Build Coastguard Workerif.6.store:
227*9880d681SAndroid Build Coastguard Worker  store i32 6, i32 addrspace(1)* %out
228*9880d681SAndroid Build Coastguard Worker  br label %end
229*9880d681SAndroid Build Coastguard Worker
230*9880d681SAndroid Build Coastguard Workerif.7:
231*9880d681SAndroid Build Coastguard Worker  %7 = icmp sgt i32 %cond, 70
232*9880d681SAndroid Build Coastguard Worker  br i1 %7, label %if.8, label %if.7.store
233*9880d681SAndroid Build Coastguard Worker
234*9880d681SAndroid Build Coastguard Workerif.7.store:
235*9880d681SAndroid Build Coastguard Worker  store i32 7, i32 addrspace(1)* %out
236*9880d681SAndroid Build Coastguard Worker  br label %end
237*9880d681SAndroid Build Coastguard Worker
238*9880d681SAndroid Build Coastguard Workerif.8:
239*9880d681SAndroid Build Coastguard Worker  store i32 8, i32 addrspace(1)* %out
240*9880d681SAndroid Build Coastguard Worker  br label %end
241*9880d681SAndroid Build Coastguard Worker
242*9880d681SAndroid Build Coastguard Workerend:
243*9880d681SAndroid Build Coastguard Worker  ret void
244*9880d681SAndroid Build Coastguard Worker}
245