1; RUN: llc -march=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=CHECK -check-prefix=SI %s
2; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=CHECK -check-prefix=VI %s
3
4; Check that WQM isn't triggered by image load/store intrinsics.
5;
6;CHECK-LABEL: {{^}}test1:
7;CHECK-NOT: s_wqm
8define amdgpu_ps <4 x float> @test1(<8 x i32> inreg %rsrc, i32 %c) {
9main_body:
10  %tex = call <4 x float> @llvm.amdgcn.image.load.1d.v4f32.i32(i32 15, i32 %c, <8 x i32> %rsrc, i32 0, i32 0)
11  call void @llvm.amdgcn.image.store.1d.v4f32.i32(<4 x float> %tex, i32 15, i32 %c, <8 x i32> %rsrc, i32 0, i32 0)
12  ret <4 x float> %tex
13}
14
15; Check that WQM is triggered by code calculating inputs to image samples and is disabled as soon as possible
16;
17;CHECK-LABEL: {{^}}test2:
18;CHECK-NEXT: ; %main_body
19;CHECK-NEXT: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
20;CHECK-NEXT: s_wqm_b64 exec, exec
21;CHECK: interp
22;CHECK: s_and_b64 exec, exec, [[ORIG]]
23;CHECK-NOT: interp
24;CHECK: image_sample
25;CHECK-NOT: exec
26;CHECK: .size test2
27define amdgpu_ps <4 x float> @test2(i32 inreg, i32 inreg, i32 inreg, i32 inreg %m0, <8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, <2 x float> %pos) #6 {
28main_body:
29  %inst23 = extractelement <2 x float> %pos, i32 0
30  %inst24 = extractelement <2 x float> %pos, i32 1
31  %inst25 = tail call float @llvm.amdgcn.interp.p1(float %inst23, i32 0, i32 0, i32 %m0)
32  %inst26 = tail call float @llvm.amdgcn.interp.p2(float %inst25, float %inst24, i32 0, i32 0, i32 %m0)
33  %inst28 = tail call float @llvm.amdgcn.interp.p1(float %inst23, i32 1, i32 0, i32 %m0)
34  %inst29 = tail call float @llvm.amdgcn.interp.p2(float %inst28, float %inst24, i32 1, i32 0, i32 %m0)
35  %tex = call <4 x float> @llvm.amdgcn.image.sample.2d.v4f32.f32(i32 15, float %inst26, float %inst29, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
36  ret <4 x float> %tex
37}
38
39; ... but disabled for stores (and, in this simple case, not re-enabled) ...
40;
41;CHECK-LABEL: {{^}}test3:
42;CHECK-NEXT: ; %main_body
43;CHECK-NEXT: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
44;CHECK-NEXT: s_wqm_b64 exec, exec
45;CHECK: s_and_b64 exec, exec, [[ORIG]]
46;CHECK: image_sample
47;CHECK: store
48;CHECK-NOT: exec
49;CHECK: .size test3
50define amdgpu_ps <4 x float> @test3(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, float %c) {
51main_body:
52  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %c, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
53  %tex.1 = bitcast <4 x float> %tex to <4 x i32>
54  %tex.2 = extractelement <4 x i32> %tex.1, i32 0
55
56  call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %tex, <4 x i32> undef, i32 %tex.2, i32 0, i1 0, i1 0)
57
58  ret <4 x float> %tex
59}
60
61; ... and disabled for export.
62;
63;CHECK-LABEL: {{^}}test3x:
64;CHECK-NEXT: ; %main_body
65;CHECK-NEXT: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
66;CHECK-NEXT: s_wqm_b64 exec, exec
67;CHECK: s_and_b64 exec, exec, [[ORIG]]
68;CHECK: image_sample
69;CHECK: exp
70;CHECK-NOT: exec
71;CHECK: .size test3x
72define amdgpu_ps void @test3x(i32 inreg, i32 inreg, i32 inreg, i32 inreg %m0, <8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, <2 x float> %pos) #6 {
73main_body:
74  %inst23 = extractelement <2 x float> %pos, i32 0
75  %inst24 = extractelement <2 x float> %pos, i32 1
76  %inst25 = tail call float @llvm.amdgcn.interp.p1(float %inst23, i32 0, i32 0, i32 %m0)
77  %inst26 = tail call float @llvm.amdgcn.interp.p2(float %inst25, float %inst24, i32 0, i32 0, i32 %m0)
78  %inst28 = tail call float @llvm.amdgcn.interp.p1(float %inst23, i32 1, i32 0, i32 %m0)
79  %inst29 = tail call float @llvm.amdgcn.interp.p2(float %inst28, float %inst24, i32 1, i32 0, i32 %m0)
80  %tex = call <4 x float> @llvm.amdgcn.image.sample.2d.v4f32.f32(i32 15, float %inst26, float %inst29, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
81  %tex.0 = extractelement <4 x float> %tex, i32 0
82  %tex.1 = extractelement <4 x float> %tex, i32 1
83  %tex.2 = extractelement <4 x float> %tex, i32 2
84  %tex.3 = extractelement <4 x float> %tex, i32 3
85  call void @llvm.amdgcn.exp.f32(i32 0, i32 15, float %tex.0, float %tex.1, float %tex.2, float %tex.3, i1 true, i1 true)
86  ret void
87}
88
89; Check that WQM is re-enabled when required.
90;
91;CHECK-LABEL: {{^}}test4:
92;CHECK-NEXT: ; %main_body
93;CHECK-NEXT: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
94;CHECK-NEXT: s_wqm_b64 exec, exec
95;CHECK: v_mul_lo_i32 [[MUL:v[0-9]+]], v0, v1
96;CHECK: s_and_b64 exec, exec, [[ORIG]]
97;CHECK: store
98;CHECK: s_wqm_b64 exec, exec
99;CHECK: image_sample
100;CHECK: image_sample
101define amdgpu_ps <4 x float> @test4(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, float addrspace(1)* inreg %ptr, i32 %c, i32 %d, float %data) {
102main_body:
103  %c.1 = mul i32 %c, %d
104
105  call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> undef, <4 x i32> undef, i32 %c.1, i32 0, i1 0, i1 0)
106  %c.1.bc = bitcast i32 %c.1 to float
107  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %c.1.bc, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
108  %tex0 = extractelement <4 x float> %tex, i32 0
109  %dtex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %tex0, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
110  ret <4 x float> %dtex
111}
112
113; Check that WQM is triggered by the wqm intrinsic.
114;
115;CHECK-LABEL: {{^}}test5:
116;CHECK: s_wqm_b64 exec, exec
117;CHECK: buffer_load_dword
118;CHECK: buffer_load_dword
119;CHECK: v_add_f32_e32
120define amdgpu_ps float @test5(i32 inreg %idx0, i32 inreg %idx1) {
121main_body:
122  %src0 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx0, i32 0, i1 0, i1 0)
123  %src1 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx1, i32 0, i1 0, i1 0)
124  %out = fadd float %src0, %src1
125  %out.0 = call float @llvm.amdgcn.wqm.f32(float %out)
126  ret float %out.0
127}
128
129; Check that the wqm intrinsic works correctly for integers.
130;
131;CHECK-LABEL: {{^}}test6:
132;CHECK: s_wqm_b64 exec, exec
133;CHECK: buffer_load_dword
134;CHECK: buffer_load_dword
135;CHECK: v_add_f32_e32
136define amdgpu_ps float @test6(i32 inreg %idx0, i32 inreg %idx1) {
137main_body:
138  %src0 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx0, i32 0, i1 0, i1 0)
139  %src1 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx1, i32 0, i1 0, i1 0)
140  %out = fadd float %src0, %src1
141  %out.0 = bitcast float %out to i32
142  %out.1 = call i32 @llvm.amdgcn.wqm.i32(i32 %out.0)
143  %out.2 = bitcast i32 %out.1 to float
144  ret float %out.2
145}
146
147; Check that WWM is triggered by the wwm intrinsic.
148;
149;CHECK-LABEL: {{^}}test_wwm1:
150;CHECK: s_or_saveexec_b64 s{{\[[0-9]+:[0-9]+\]}}, -1
151;CHECK: buffer_load_dword
152;CHECK: buffer_load_dword
153;CHECK: v_add_f32_e32
154define amdgpu_ps float @test_wwm1(i32 inreg %idx0, i32 inreg %idx1) {
155main_body:
156  %src0 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx0, i32 0, i1 0, i1 0)
157  %src1 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx1, i32 0, i1 0, i1 0)
158  %out = fadd float %src0, %src1
159  %out.0 = call float @llvm.amdgcn.wwm.f32(float %out)
160  ret float %out.0
161}
162
163; Same as above, but with an integer type.
164;
165;CHECK-LABEL: {{^}}test_wwm2:
166;CHECK: s_or_saveexec_b64 s{{\[[0-9]+:[0-9]+\]}}, -1
167;CHECK: buffer_load_dword
168;CHECK: buffer_load_dword
169;CHECK: v_add_{{[iu]}}32_e32
170define amdgpu_ps float @test_wwm2(i32 inreg %idx0, i32 inreg %idx1) {
171main_body:
172  %src0 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx0, i32 0, i1 0, i1 0)
173  %src1 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx1, i32 0, i1 0, i1 0)
174  %src0.0 = bitcast float %src0 to i32
175  %src1.0 = bitcast float %src1 to i32
176  %out = add i32 %src0.0, %src1.0
177  %out.0 = call i32 @llvm.amdgcn.wwm.i32(i32 %out)
178  %out.1 = bitcast i32 %out.0 to float
179  ret float %out.1
180}
181
182; Check that we don't leave WWM on for computations that don't require WWM,
183; since that will lead clobbering things that aren't supposed to be clobbered
184; in cases like this.
185;
186;CHECK-LABEL: {{^}}test_wwm3:
187;CHECK: s_or_saveexec_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], -1
188;CHECK: buffer_load_dword
189;CHECK: v_add_f32_e32
190;CHECK: s_mov_b64 exec, [[ORIG]]
191;CHECK: v_add_f32_e32
192define amdgpu_ps float @test_wwm3(i32 inreg %idx) {
193main_body:
194  ; use mbcnt to make sure the branch is divergent
195  %lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 -1, i32 0)
196  %hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 -1, i32 %lo)
197  %cc = icmp uge i32 %hi, 32
198  br i1 %cc, label %endif, label %if
199
200if:
201  %src = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx, i32 0, i1 0, i1 0)
202  %out = fadd float %src, %src
203  %out.0 = call float @llvm.amdgcn.wwm.f32(float %out)
204  %out.1 = fadd float %src, %out.0
205  br label %endif
206
207endif:
208  %out.2 = phi float [ %out.1, %if ], [ 0.0, %main_body ]
209  ret float %out.2
210}
211
212; Check that WWM writes aren't coalesced with non-WWM writes, since the WWM
213; write could clobber disabled channels in the non-WWM one.
214;
215;CHECK-LABEL: {{^}}test_wwm4:
216;CHECK: s_or_saveexec_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], -1
217;CHECK: buffer_load_dword
218;CHECK: v_add_f32_e32
219;CHECK: s_mov_b64 exec, [[ORIG]]
220;CHECK-NEXT: v_mov_b32_e32
221define amdgpu_ps float @test_wwm4(i32 inreg %idx) {
222main_body:
223  ; use mbcnt to make sure the branch is divergent
224  %lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 -1, i32 0)
225  %hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 -1, i32 %lo)
226  %cc = icmp uge i32 %hi, 32
227  br i1 %cc, label %endif, label %if
228
229if:
230  %src = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx, i32 0, i1 0, i1 0)
231  %out = fadd float %src, %src
232  %out.0 = call float @llvm.amdgcn.wwm.f32(float %out)
233  br label %endif
234
235endif:
236  %out.1 = phi float [ %out.0, %if ], [ 0.0, %main_body ]
237  ret float %out.1
238}
239
240; Make sure the transition from Exact to WWM then WQM works properly.
241;
242;CHECK-LABEL: {{^}}test_wwm5:
243;CHECK: buffer_load_dword
244;CHECK: buffer_store_dword
245;CHECK: s_or_saveexec_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], -1
246;CHECK: buffer_load_dword
247;CHECK: v_add_f32_e32
248;CHECK: s_mov_b64 exec, [[ORIG]]
249;CHECK: s_wqm_b64 exec, exec
250define amdgpu_ps float @test_wwm5(i32 inreg %idx0, i32 inreg %idx1) {
251main_body:
252  %src0 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx0, i32 0, i1 0, i1 0)
253  call void @llvm.amdgcn.buffer.store.f32(float %src0, <4 x i32> undef, i32 %idx0, i32 0, i1 0, i1 0)
254  %src1 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx1, i32 0, i1 0, i1 0)
255  %temp = fadd float %src1, %src1
256  %temp.0 = call float @llvm.amdgcn.wwm.f32(float %temp)
257  %out = fadd float %temp.0, %temp.0
258  %out.0 = call float @llvm.amdgcn.wqm.f32(float %out)
259  ret float %out.0
260}
261
262; Check that WWM is turned on correctly across basic block boundaries.
263; if..then..endif version
264;
265;CHECK-LABEL: {{^}}test_wwm6_then:
266;CHECK: s_or_saveexec_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], -1
267;SI-CHECK: buffer_load_dword
268;VI-CHECK: flat_load_dword
269;CHECK: s_mov_b64 exec, [[ORIG]]
270;CHECK: %if
271;CHECK: s_or_saveexec_b64 [[ORIG2:s\[[0-9]+:[0-9]+\]]], -1
272;SI-CHECK: buffer_load_dword
273;VI-CHECK: flat_load_dword
274;CHECK: v_add_f32_e32
275;CHECK: s_mov_b64 exec, [[ORIG2]]
276define amdgpu_ps float @test_wwm6_then() {
277main_body:
278  %src0 = load volatile float, float addrspace(1)* undef
279  ; use mbcnt to make sure the branch is divergent
280  %lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 -1, i32 0)
281  %hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 -1, i32 %lo)
282  %cc = icmp uge i32 %hi, 32
283  br i1 %cc, label %endif, label %if
284
285if:
286  %src1 = load volatile float, float addrspace(1)* undef
287  %out = fadd float %src0, %src1
288  %out.0 = call float @llvm.amdgcn.wwm.f32(float %out)
289  br label %endif
290
291endif:
292  %out.1 = phi float [ %out.0, %if ], [ 0.0, %main_body ]
293  ret float %out.1
294}
295
296; Check that WWM is turned on correctly across basic block boundaries.
297; loop version
298;
299;CHECK-LABEL: {{^}}test_wwm6_loop:
300;CHECK: s_or_saveexec_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], -1
301;SI-CHECK: buffer_load_dword
302;VI-CHECK: flat_load_dword
303;CHECK: s_mov_b64 exec, [[ORIG]]
304;CHECK: %loop
305;CHECK: s_or_saveexec_b64 [[ORIG2:s\[[0-9]+:[0-9]+\]]], -1
306;SI-CHECK: buffer_load_dword
307;VI-CHECK: flat_load_dword
308;CHECK: s_mov_b64 exec, [[ORIG2]]
309define amdgpu_ps float @test_wwm6_loop() {
310main_body:
311  %src0 = load volatile float, float addrspace(1)* undef
312  ; use mbcnt to make sure the branch is divergent
313  %lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 -1, i32 0)
314  %hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 -1, i32 %lo)
315  br label %loop
316
317loop:
318  %counter = phi i32 [ %lo, %main_body ], [ %counter.1, %loop ]
319  %src1 = load volatile float, float addrspace(1)* undef
320  %out = fadd float %src0, %src1
321  %out.0 = call float @llvm.amdgcn.wwm.f32(float %out)
322  %counter.1 = sub i32 %counter, 1
323  %cc = icmp ne i32 %counter.1, 0
324  br i1 %cc, label %loop, label %endloop
325
326endloop:
327  ret float %out.0
328}
329
330; Check that @llvm.amdgcn.set.inactive disables WWM.
331;
332;CHECK-LABEL: {{^}}test_set_inactive1:
333;CHECK: buffer_load_dword
334;CHECK: s_not_b64 exec, exec
335;CHECK: v_mov_b32_e32
336;CHECK: s_not_b64 exec, exec
337;CHECK: s_or_saveexec_b64 s{{\[[0-9]+:[0-9]+\]}}, -1
338;CHECK: v_add_{{[iu]}}32_e32
339define amdgpu_ps void @test_set_inactive1(i32 inreg %idx) {
340main_body:
341  %src = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx, i32 0, i1 0, i1 0)
342  %src.0 = bitcast float %src to i32
343  %src.1 = call i32 @llvm.amdgcn.set.inactive.i32(i32 %src.0, i32 0)
344  %out = add i32 %src.1, %src.1
345  %out.0 = call i32 @llvm.amdgcn.wwm.i32(i32 %out)
346  %out.1 = bitcast i32 %out.0 to float
347  call void @llvm.amdgcn.buffer.store.f32(float %out.1, <4 x i32> undef, i32 %idx, i32 0, i1 0, i1 0)
348  ret void
349}
350
351; Check that enabling WQM anywhere enables WQM for the set.inactive source.
352;
353;CHECK-LABEL: {{^}}test_set_inactive2:
354;CHECK: s_wqm_b64 exec, exec
355;CHECK: buffer_load_dword
356;CHECK: buffer_load_dword
357define amdgpu_ps void @test_set_inactive2(i32 inreg %idx0, i32 inreg %idx1) {
358main_body:
359  %src1 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx1, i32 0, i1 0, i1 0)
360  %src1.0 = bitcast float %src1 to i32
361  %src1.1 = call i32 @llvm.amdgcn.set.inactive.i32(i32 %src1.0, i32 undef)
362  %src0 = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx0, i32 0, i1 0, i1 0)
363  %src0.0 = bitcast float %src0 to i32
364  %src0.1 = call i32 @llvm.amdgcn.wqm.i32(i32 %src0.0)
365  %out = add i32 %src0.1, %src1.1
366  %out.0 = bitcast i32 %out to float
367  call void @llvm.amdgcn.buffer.store.f32(float %out.0, <4 x i32> undef, i32 %idx1, i32 0, i1 0, i1 0)
368  ret void
369}
370
371; Check a case of one branch of an if-else requiring WQM, the other requiring
372; exact.
373;
374; Note: In this particular case, the save-and-restore could be avoided if the
375; analysis understood that the two branches of the if-else are mutually
376; exclusive.
377;
378;CHECK-LABEL: {{^}}test_control_flow_0:
379;CHECK-NEXT: ; %main_body
380;CHECK-NEXT: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
381;CHECK-NEXT: s_wqm_b64 exec, exec
382;CHECK: %ELSE
383;CHECK: s_and_saveexec_b64 [[SAVED:s\[[0-9]+:[0-9]+\]]], [[ORIG]]
384;CHECK: store
385;CHECK: s_mov_b64 exec, [[SAVED]]
386;CHECK: %IF
387;CHECK: image_sample
388;CHECK: image_sample
389define amdgpu_ps float @test_control_flow_0(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, i32 %c, i32 %z, float %data) {
390main_body:
391  %cmp = icmp eq i32 %z, 0
392  br i1 %cmp, label %IF, label %ELSE
393
394IF:
395  %c.bc = bitcast i32 %c to float
396  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %c.bc, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
397  %tex0 = extractelement <4 x float> %tex, i32 0
398  %dtex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %tex0, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
399  %data.if = extractelement <4 x float> %dtex, i32 0
400  br label %END
401
402ELSE:
403  call void @llvm.amdgcn.buffer.store.f32(float %data, <4 x i32> undef, i32 %c, i32 0, i1 0, i1 0)
404  br label %END
405
406END:
407  %r = phi float [ %data.if, %IF ], [ %data, %ELSE ]
408  ret float %r
409}
410
411; Reverse branch order compared to the previous test.
412;
413;CHECK-LABEL: {{^}}test_control_flow_1:
414;CHECK-NEXT: ; %main_body
415;CHECK-NEXT: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
416;CHECK-NEXT: s_wqm_b64 exec, exec
417;CHECK: %IF
418;CHECK: image_sample
419;CHECK: image_sample
420;CHECK: %Flow
421;CHECK-NEXT: s_or_saveexec_b64 [[SAVED:s\[[0-9]+:[0-9]+\]]],
422;CHECK-NEXT: s_and_b64 exec, exec, [[ORIG]]
423;CHECK-NEXT: s_and_b64 [[SAVED]], exec, [[SAVED]]
424;CHECK-NEXT: s_xor_b64 exec, exec, [[SAVED]]
425;CHECK-NEXT: mask branch [[END_BB:BB[0-9]+_[0-9]+]]
426;CHECK-NEXT: BB{{[0-9]+_[0-9]+}}: ; %ELSE
427;CHECK: store_dword
428;CHECK: [[END_BB]]: ; %END
429;CHECK: s_or_b64 exec, exec,
430;CHECK: v_mov_b32_e32 v0
431;CHECK: ; return
432define amdgpu_ps float @test_control_flow_1(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, i32 %c, i32 %z, float %data) {
433main_body:
434  %cmp = icmp eq i32 %z, 0
435  br i1 %cmp, label %ELSE, label %IF
436
437IF:
438  %c.bc = bitcast i32 %c to float
439  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %c.bc, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
440  %tex0 = extractelement <4 x float> %tex, i32 0
441  %dtex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %tex0, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
442  %data.if = extractelement <4 x float> %dtex, i32 0
443  br label %END
444
445ELSE:
446  call void @llvm.amdgcn.buffer.store.f32(float %data, <4 x i32> undef, i32 %c, i32 0, i1 0, i1 0)
447  br label %END
448
449END:
450  %r = phi float [ %data.if, %IF ], [ %data, %ELSE ]
451  ret float %r
452}
453
454; Check that branch conditions are properly marked as needing WQM...
455;
456;CHECK-LABEL: {{^}}test_control_flow_2:
457;CHECK-NEXT: ; %main_body
458;CHECK-NEXT: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
459;CHECK-NEXT: s_wqm_b64 exec, exec
460;CHECK: s_and_b64 exec, exec, [[ORIG]]
461;CHECK: store
462;CHECK: s_wqm_b64 exec, exec
463;CHECK: load
464;CHECK: s_and_b64 exec, exec, [[ORIG]]
465;CHECK: store
466;CHECK: s_wqm_b64 exec, exec
467;CHECK: v_cmp
468define amdgpu_ps <4 x float> @test_control_flow_2(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, <3 x i32> %idx, <2 x float> %data, i32 %coord) {
469main_body:
470  %idx.1 = extractelement <3 x i32> %idx, i32 0
471  %data.1 = extractelement <2 x float> %data, i32 0
472  call void @llvm.amdgcn.buffer.store.f32(float %data.1, <4 x i32> undef, i32 %idx.1, i32 0, i1 0, i1 0)
473
474  ; The load that determines the branch (and should therefore be WQM) is
475  ; surrounded by stores that require disabled WQM.
476  %idx.2 = extractelement <3 x i32> %idx, i32 1
477  %z = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 %idx.2, i32 0, i1 0, i1 0)
478
479  %idx.3 = extractelement <3 x i32> %idx, i32 2
480  %data.3 = extractelement <2 x float> %data, i32 1
481  call void @llvm.amdgcn.buffer.store.f32(float %data.3, <4 x i32> undef, i32 %idx.3, i32 0, i1 0, i1 0)
482
483  %cc = fcmp ogt float %z, 0.0
484  br i1 %cc, label %IF, label %ELSE
485
486IF:
487  %coord.IF = mul i32 %coord, 3
488  br label %END
489
490ELSE:
491  %coord.ELSE = mul i32 %coord, 4
492  br label %END
493
494END:
495  %coord.END = phi i32 [ %coord.IF, %IF ], [ %coord.ELSE, %ELSE ]
496  %coord.END.bc = bitcast i32 %coord.END to float
497  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %coord.END.bc, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
498  ret <4 x float> %tex
499}
500
501; ... but only if they really do need it.
502;
503;CHECK-LABEL: {{^}}test_control_flow_3:
504;CHECK-NEXT: ; %main_body
505;CHECK-NEXT: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
506;CHECK-NEXT: s_wqm_b64 exec, exec
507;CHECK: image_sample
508;CHECK: s_and_b64 exec, exec, [[ORIG]]
509;CHECK: image_sample
510;CHECK-DAG: v_cmp
511;CHECK-DAG: store
512define amdgpu_ps float @test_control_flow_3(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, i32 %idx, float %coord) {
513main_body:
514  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %coord, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
515  %tex0 = extractelement <4 x float> %tex, i32 0
516  %dtex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %tex0, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
517  %dtex.1 = extractelement <4 x float> %dtex, i32 0
518  call void @llvm.amdgcn.buffer.store.f32(float %dtex.1, <4 x i32> undef, i32 %idx, i32 0, i1 0, i1 0)
519
520  %cc = fcmp ogt float %dtex.1, 0.0
521  br i1 %cc, label %IF, label %ELSE
522
523IF:
524  %tex.IF = fmul float %dtex.1, 3.0
525  br label %END
526
527ELSE:
528  %tex.ELSE = fmul float %dtex.1, 4.0
529  br label %END
530
531END:
532  %tex.END = phi float [ %tex.IF, %IF ], [ %tex.ELSE, %ELSE ]
533  ret float %tex.END
534}
535
536; Another test that failed at some point because of terminator handling.
537;
538;CHECK-LABEL: {{^}}test_control_flow_4:
539;CHECK-NEXT: ; %main_body
540;CHECK-NEXT: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
541;CHECK-NEXT: s_wqm_b64 exec, exec
542;CHECK: %IF
543;CHECK: s_and_saveexec_b64 [[SAVE:s\[[0-9]+:[0-9]+\]]],  [[ORIG]]
544;CHECK: load
545;CHECK: store
546;CHECK: s_mov_b64 exec, [[SAVE]]
547;CHECK: %END
548;CHECK: image_sample
549;CHECK: image_sample
550define amdgpu_ps <4 x float> @test_control_flow_4(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, float %coord, i32 %y, float %z) {
551main_body:
552  %cond = icmp eq i32 %y, 0
553  br i1 %cond, label %IF, label %END
554
555IF:
556  %data = call float @llvm.amdgcn.buffer.load.f32(<4 x i32> undef, i32 0, i32 0, i1 0, i1 0)
557  call void @llvm.amdgcn.buffer.store.f32(float %data, <4 x i32> undef, i32 1, i32 0, i1 0, i1 0)
558  br label %END
559
560END:
561  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %coord, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
562  %tex0 = extractelement <4 x float> %tex, i32 0
563  %dtex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %tex0, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
564  ret <4 x float> %dtex
565}
566
567; Kill is performed in WQM mode so that uniform kill behaves correctly ...
568;
569;CHECK-LABEL: {{^}}test_kill_0:
570;CHECK-NEXT: ; %main_body
571;CHECK-NEXT: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
572;CHECK-NEXT: s_wqm_b64 exec, exec
573;CHECK: s_and_b64 exec, exec, [[ORIG]]
574;CHECK: image_sample
575;CHECK: buffer_store_dword
576;CHECK: s_wqm_b64 exec, exec
577;CHECK: v_cmpx_
578;CHECK: s_and_saveexec_b64 [[SAVE:s\[[0-9]+:[0-9]+\]]], [[ORIG]]
579;CHECK: buffer_store_dword
580;CHECK: s_mov_b64 exec, [[SAVE]]
581;CHECK: image_sample
582define amdgpu_ps <4 x float> @test_kill_0(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, float addrspace(1)* inreg %ptr, <2 x i32> %idx, <2 x float> %data, float %coord, float %coord2, float %z) {
583main_body:
584  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %coord, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
585  %idx.0 = extractelement <2 x i32> %idx, i32 0
586  %data.0 = extractelement <2 x float> %data, i32 0
587  call void @llvm.amdgcn.buffer.store.f32(float %data.0, <4 x i32> undef, i32 %idx.0, i32 0, i1 0, i1 0)
588
589  call void @llvm.AMDGPU.kill(float %z)
590
591  %idx.1 = extractelement <2 x i32> %idx, i32 1
592  %data.1 = extractelement <2 x float> %data, i32 1
593  call void @llvm.amdgcn.buffer.store.f32(float %data.1, <4 x i32> undef, i32 %idx.1, i32 0, i1 0, i1 0)
594  %tex2 = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %coord2, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
595  %tex2.0 = extractelement <4 x float> %tex2, i32 0
596  %dtex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %tex2.0, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
597  %out = fadd <4 x float> %tex, %dtex
598
599  ret <4 x float> %out
600}
601
602; ... but only if WQM is necessary.
603;
604; CHECK-LABEL: {{^}}test_kill_1:
605; CHECK-NEXT: ; %main_body
606; CHECK: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
607; CHECK: s_wqm_b64 exec, exec
608; CHECK: image_sample
609; CHECK: s_and_b64 exec, exec, [[ORIG]]
610; CHECK: image_sample
611; CHECK: buffer_store_dword
612; CHECK-NOT: wqm
613; CHECK: v_cmpx_
614define amdgpu_ps <4 x float> @test_kill_1(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, i32 %idx, float %data, float %coord, float %coord2, float %z) {
615main_body:
616  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %coord, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
617  %tex0 = extractelement <4 x float> %tex, i32 0
618  %dtex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %tex0, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
619
620  call void @llvm.amdgcn.buffer.store.f32(float %data, <4 x i32> undef, i32 0, i32 0, i1 0, i1 0)
621
622  call void @llvm.AMDGPU.kill(float %z)
623
624  ret <4 x float> %dtex
625}
626
627; Check prolog shaders.
628;
629; CHECK-LABEL: {{^}}test_prolog_1:
630; CHECK: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
631; CHECK: s_wqm_b64 exec, exec
632; CHECK: v_add_f32_e32 v0,
633; CHECK: s_and_b64 exec, exec, [[ORIG]]
634define amdgpu_ps float @test_prolog_1(float %a, float %b) #5 {
635main_body:
636  %s = fadd float %a, %b
637  ret float %s
638}
639
640; CHECK-LABEL: {{^}}test_loop_vcc:
641; CHECK-NEXT: ; %entry
642; CHECK-NEXT: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec
643; CHECK: s_wqm_b64 exec, exec
644; CHECK: s_and_b64 exec, exec, [[LIVE]]
645; CHECK: image_store
646; CHECK: s_wqm_b64 exec, exec
647; CHECK-DAG: v_mov_b32_e32 [[CTR:v[0-9]+]], 0
648; CHECK-DAG: s_mov_b32 [[SEVEN:s[0-9]+]], 0x40e00000
649
650; CHECK: [[LOOPHDR:BB[0-9]+_[0-9]+]]: ; %body
651; CHECK: v_add_f32_e32 [[CTR]], 2.0, [[CTR]]
652; CHECK: v_cmp_lt_f32_e32 vcc, [[SEVEN]], [[CTR]]
653; CHECK: s_cbranch_vccz [[LOOPHDR]]
654; CHECK: ; %break
655
656; CHECK: ; return
657define amdgpu_ps <4 x float> @test_loop_vcc(<4 x float> %in) nounwind {
658entry:
659  call void @llvm.amdgcn.image.store.1d.v4f32.i32(<4 x float> %in, i32 15, i32 undef, <8 x i32> undef, i32 0, i32 0)
660  br label %loop
661
662loop:
663  %ctr.iv = phi float [ 0.0, %entry ], [ %ctr.next, %body ]
664  %c.iv = phi <4 x float> [ %in, %entry ], [ %c.next, %body ]
665  %cc = fcmp ogt float %ctr.iv, 7.0
666  br i1 %cc, label %break, label %body
667
668body:
669  %c.iv0 = extractelement <4 x float> %c.iv, i32 0
670  %c.next = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %c.iv0, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0) #0
671  %ctr.next = fadd float %ctr.iv, 2.0
672  br label %loop
673
674break:
675  ret <4 x float> %c.iv
676}
677
678; Only intrinsic stores need exact execution -- other stores do not have
679; externally visible effects and may require WQM for correctness.
680;
681; CHECK-LABEL: {{^}}test_alloca:
682; CHECK: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec
683; CHECK: s_wqm_b64 exec, exec
684
685; CHECK: s_and_b64 exec, exec, [[LIVE]]
686; CHECK: buffer_store_dword {{v[0-9]+}}, off, {{s\[[0-9]+:[0-9]+\]}}, 0
687; CHECK: s_wqm_b64 exec, exec
688; CHECK: buffer_store_dword {{v[0-9]+}}, off, {{s\[[0-9]+:[0-9]+\]}}, {{s[0-9]+}} offset:4{{$}}
689; CHECK: s_and_b64 exec, exec, [[LIVE]]
690; CHECK: buffer_store_dword {{v[0-9]+}}, {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}, 0 idxen
691; CHECK: s_wqm_b64 exec, exec
692; CHECK: buffer_load_dword {{v[0-9]+}}, {{v[0-9]+}}, {{s\[[0-9]+:[0-9]+\]}}, {{s[0-9]+}} offen
693
694; CHECK: s_and_b64 exec, exec, [[LIVE]]
695; CHECK: image_sample
696; CHECK: buffer_store_dwordx4
697define amdgpu_ps void @test_alloca(float %data, i32 %a, i32 %idx) nounwind {
698entry:
699  %array = alloca [32 x i32], align 4, addrspace(5)
700
701  call void @llvm.amdgcn.buffer.store.f32(float %data, <4 x i32> undef, i32 0, i32 0, i1 0, i1 0)
702
703  %s.gep = getelementptr [32 x i32], [32 x i32] addrspace(5)* %array, i32 0, i32 0
704  store volatile i32 %a, i32 addrspace(5)* %s.gep, align 4
705
706  call void @llvm.amdgcn.buffer.store.f32(float %data, <4 x i32> undef, i32 1, i32 0, i1 0, i1 0)
707
708  %c.gep = getelementptr [32 x i32], [32 x i32] addrspace(5)* %array, i32 0, i32 %idx
709  %c = load i32, i32 addrspace(5)* %c.gep, align 4
710  %c.bc = bitcast i32 %c to float
711  %t = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %c.bc, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0) #0
712  call void @llvm.amdgcn.buffer.store.v4f32(<4 x float> %t, <4 x i32> undef, i32 0, i32 0, i1 0, i1 0)
713
714  ret void
715}
716
717; Must return to exact at the end of a non-void returning shader,
718; otherwise the EXEC mask exported by the epilog will be wrong. This is true
719; even if the shader has no kills, because a kill could have happened in a
720; previous shader fragment.
721;
722; CHECK-LABEL: {{^}}test_nonvoid_return:
723; CHECK: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec
724; CHECK: s_wqm_b64 exec, exec
725;
726; CHECK: s_and_b64 exec, exec, [[LIVE]]
727; CHECK-NOT: exec
728define amdgpu_ps <4 x float> @test_nonvoid_return() nounwind {
729  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float undef, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0) #0
730  %tex0 = extractelement <4 x float> %tex, i32 0
731  %dtex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %tex0, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0) #0
732  ret <4 x float> %dtex
733}
734
735; CHECK-LABEL: {{^}}test_nonvoid_return_unreachable:
736; CHECK: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec
737; CHECK: s_wqm_b64 exec, exec
738;
739; CHECK: s_and_b64 exec, exec, [[LIVE]]
740; CHECK-NOT: exec
741define amdgpu_ps <4 x float> @test_nonvoid_return_unreachable(i32 inreg %c) nounwind {
742entry:
743  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float undef, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0) #0
744  %tex0 = extractelement <4 x float> %tex, i32 0
745  %dtex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %tex0, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0) #0
746  %cc = icmp sgt i32 %c, 0
747  br i1 %cc, label %if, label %else
748
749if:
750  store volatile <4 x float> %dtex, <4 x float> addrspace(1)* undef
751  unreachable
752
753else:
754  ret <4 x float> %dtex
755}
756
757; Test awareness that s_wqm_b64 clobbers SCC.
758;
759; CHECK-LABEL: {{^}}test_scc:
760; CHECK: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec
761; CHECK: s_wqm_b64 exec, exec
762; CHECK: s_cmp_
763; CHECK-NEXT: s_cbranch_scc
764; CHECK: ; %if
765; CHECK: s_and_b64 exec, exec, [[ORIG]]
766; CHECK: image_sample
767; CHECK: ; %else
768; CHECK: s_and_b64 exec, exec, [[ORIG]]
769; CHECK: image_sample
770; CHECK: ; %end
771define amdgpu_ps <4 x float> @test_scc(i32 inreg %sel, i32 %idx) #1 {
772main_body:
773  %cc = icmp sgt i32 %sel, 0
774  br i1 %cc, label %if, label %else
775
776if:
777  %r.if = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float 0.0, <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0) #0
778  br label %end
779
780else:
781  %r.else = call <4 x float> @llvm.amdgcn.image.sample.2d.v4f32.f32(i32 15, float 0.0, float bitcast (i32 1 to float), <8 x i32> undef, <4 x i32> undef, i1 0, i32 0, i32 0) #0
782  br label %end
783
784end:
785  %r = phi <4 x float> [ %r.if, %if ], [ %r.else, %else ]
786  call void @llvm.amdgcn.buffer.store.f32(float 1.0, <4 x i32> undef, i32 %idx, i32 0, i1 0, i1 0)
787  ret <4 x float> %r
788}
789
790; Check a case of a block being entirely WQM except for a bit of WWM.
791; There was a bug where it forgot to enter and leave WWM.
792;
793;CHECK-LABEL: {{^}}test_wwm_within_wqm:
794;CHECK: %IF
795;CHECK: s_or_saveexec_b64 {{.*}}, -1
796;CHECK: ds_swizzle
797;
798define amdgpu_ps float @test_wwm_within_wqm(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, i32 %c, i32 %z, float %data) {
799main_body:
800  %c.bc = bitcast i32 %c to float
801  %tex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %c.bc, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
802  %tex0 = extractelement <4 x float> %tex, i32 0
803  %dtex = call <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32 15, float %tex0, <8 x i32> %rsrc, <4 x i32> %sampler, i1 0, i32 0, i32 0) #0
804  %cmp = icmp eq i32 %z, 0
805  br i1 %cmp, label %IF, label %ENDIF
806
807IF:
808  %dataf = extractelement <4 x float> %dtex, i32 0
809  %data1 = fptosi float %dataf to i32
810  %data2 = call i32 @llvm.amdgcn.set.inactive.i32(i32 %data1, i32 0)
811  %data3 = call i32 @llvm.amdgcn.ds.swizzle(i32 %data2, i32 2079)
812  %data4 = call i32 @llvm.amdgcn.wwm.i32(i32 %data3)
813  %data4f = sitofp i32 %data4 to float
814  br label %ENDIF
815
816ENDIF:
817  %r = phi float [ %data4f, %IF ], [ 0.0, %main_body ]
818  ret float %r
819}
820
821declare void @llvm.amdgcn.exp.f32(i32, i32, float, float, float, float, i1, i1) #1
822declare void @llvm.amdgcn.image.store.1d.v4f32.i32(<4 x float>, i32, i32, <8 x i32>, i32, i32) #1
823declare void @llvm.amdgcn.buffer.store.f32(float, <4 x i32>, i32, i32, i1, i1) #2
824declare void @llvm.amdgcn.buffer.store.v4f32(<4 x float>, <4 x i32>, i32, i32, i1, i1) #2
825declare <4 x float> @llvm.amdgcn.image.load.1d.v4f32.i32(i32, i32, <8 x i32>, i32, i32) #3
826declare float @llvm.amdgcn.buffer.load.f32(<4 x i32>, i32, i32, i1, i1) #3
827declare <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32, float, <8 x i32>, <4 x i32>, i1, i32, i32) #3
828declare <4 x float> @llvm.amdgcn.image.sample.2d.v4f32.f32(i32, float, float, <8 x i32>, <4 x i32>, i1, i32, i32) #3
829declare void @llvm.AMDGPU.kill(float) #1
830declare float @llvm.amdgcn.wqm.f32(float) #3
831declare i32 @llvm.amdgcn.wqm.i32(i32) #3
832declare float @llvm.amdgcn.wwm.f32(float) #3
833declare i32 @llvm.amdgcn.wwm.i32(i32) #3
834declare i32 @llvm.amdgcn.set.inactive.i32(i32, i32) #4
835declare i32 @llvm.amdgcn.mbcnt.lo(i32, i32) #3
836declare i32 @llvm.amdgcn.mbcnt.hi(i32, i32) #3
837declare <2 x half> @llvm.amdgcn.cvt.pkrtz(float, float) #3
838declare void @llvm.amdgcn.exp.compr.v2f16(i32, i32, <2 x half>, <2 x half>, i1, i1) #1
839declare float @llvm.amdgcn.interp.p1(float, i32, i32, i32) #2
840declare float @llvm.amdgcn.interp.p2(float, float, i32, i32, i32) #2
841declare i32 @llvm.amdgcn.ds.swizzle(i32, i32)
842
843attributes #1 = { nounwind }
844attributes #2 = { nounwind readonly }
845attributes #3 = { nounwind readnone }
846attributes #4 = { nounwind readnone convergent }
847attributes #5 = { "amdgpu-ps-wqm-outputs" }
848attributes #6 = { nounwind "InitialPSInputAddr"="2" }
849