1; RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=+wavefrontsize32,-wavefrontsize64 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX1032 %s
2; RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX1064 %s
3; RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=+wavefrontsize32,-wavefrontsize64 -amdgpu-early-ifcvt=1 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX1032 %s
4; RUN: llc -march=amdgcn -mcpu=gfx1010 -mattr=-wavefrontsize32,+wavefrontsize64 -amdgpu-early-ifcvt=1 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX1064 %s
5; RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,GFX1032,GFX10DEFWAVE %s
6
7; GCN-LABEL: {{^}}test_vopc_i32:
8; GFX1032: v_cmp_lt_i32_e32 vcc_lo, 0, v{{[0-9]+}}
9; GFX1032: v_cndmask_b32_e64 v{{[0-9]+}}, 2, 1, vcc_lo
10; GFX1064: v_cmp_lt_i32_e32 vcc, 0, v{{[0-9]+}}
11; GFX1064: v_cndmask_b32_e64 v{{[0-9]+}}, 2, 1, vcc{{$}}
12define amdgpu_kernel void @test_vopc_i32(i32 addrspace(1)* %arg) {
13  %lid = tail call i32 @llvm.amdgcn.workitem.id.x()
14  %gep = getelementptr inbounds i32, i32 addrspace(1)* %arg, i32 %lid
15  %load = load i32, i32 addrspace(1)* %gep, align 4
16  %cmp = icmp sgt i32 %load, 0
17  %sel = select i1 %cmp, i32 1, i32 2
18  store i32 %sel, i32 addrspace(1)* %gep, align 4
19  ret void
20}
21
22; GCN-LABEL: {{^}}test_vopc_f32:
23; GFX1032: v_cmp_nge_f32_e32 vcc_lo, 0, v{{[0-9]+}}
24; GFX1032: v_cndmask_b32_e64 v{{[0-9]+}}, 2.0, 1.0, vcc_lo
25; GFX1064: v_cmp_nge_f32_e32 vcc, 0, v{{[0-9]+}}
26; GFX1064: v_cndmask_b32_e64 v{{[0-9]+}}, 2.0, 1.0, vcc{{$}}
27define amdgpu_kernel void @test_vopc_f32(float addrspace(1)* %arg) {
28  %lid = tail call i32 @llvm.amdgcn.workitem.id.x()
29  %gep = getelementptr inbounds float, float addrspace(1)* %arg, i32 %lid
30  %load = load float, float addrspace(1)* %gep, align 4
31  %cmp = fcmp ugt float %load, 0.0
32  %sel = select i1 %cmp, float 1.0, float 2.0
33  store float %sel, float addrspace(1)* %gep, align 4
34  ret void
35}
36
37; GCN-LABEL: {{^}}test_vopc_vcmpx:
38; GFX1032: v_cmpx_le_f32_e32 0, v{{[0-9]+}}
39; GFX1064: v_cmpx_le_f32_e32 0, v{{[0-9]+}}
40define amdgpu_ps void @test_vopc_vcmpx(float %x) {
41  %cmp = fcmp oge float %x, 0.0
42  call void @llvm.amdgcn.kill(i1 %cmp)
43  ret void
44}
45
46; GCN-LABEL: {{^}}test_vopc_2xf16:
47; GFX1032: v_cmp_le_f16_sdwa [[SC:vcc_lo|s[0-9]+]], {{[vs][0-9]+}}, v{{[0-9]+}} src0_sel:WORD_1 src1_sel:DWORD
48; GFX1032: v_cndmask_b32_e32 v{{[0-9]+}}, 0x3c003c00, v{{[0-9]+}}, [[SC]]
49; GFX1064: v_cmp_le_f16_sdwa [[SC:vcc|s\[[0-9:]+\]]], {{[vs][0-9]+}}, v{{[0-9]+}} src0_sel:WORD_1 src1_sel:DWORD
50; GFX1064: v_cndmask_b32_e32 v{{[0-9]+}}, 0x3c003c00, v{{[0-9]+}}, [[SC]]
51define amdgpu_kernel void @test_vopc_2xf16(<2 x half> addrspace(1)* %arg) {
52  %lid = tail call i32 @llvm.amdgcn.workitem.id.x()
53  %gep = getelementptr inbounds <2 x half>, <2 x half> addrspace(1)* %arg, i32 %lid
54  %load = load <2 x half>, <2 x half> addrspace(1)* %gep, align 4
55  %elt = extractelement <2 x half> %load, i32 1
56  %cmp = fcmp ugt half %elt, 0.0
57  %sel = select i1 %cmp, <2 x half> <half 1.0, half 1.0>, <2 x half> %load
58  store <2 x half> %sel, <2 x half> addrspace(1)* %gep, align 4
59  ret void
60}
61
62; GCN-LABEL: {{^}}test_vopc_class:
63; GFX1032: v_cmp_class_f32_e64 [[C:vcc_lo|s[0-9:]+]], s{{[0-9]+}}, 0x204
64; GFX1032: v_cndmask_b32_e64 v{{[0-9]+}}, 0, 1, [[C]]
65; GFX1064: v_cmp_class_f32_e64 [[C:vcc|s\[[0-9:]+\]]], s{{[0-9]+}}, 0x204
66; GFX1064: v_cndmask_b32_e64 v{{[0-9]+}}, 0, 1, [[C]]{{$}}
67define amdgpu_kernel void @test_vopc_class(i32 addrspace(1)* %out, float %x) #0 {
68  %fabs = tail call float @llvm.fabs.f32(float %x)
69  %cmp = fcmp oeq float %fabs, 0x7FF0000000000000
70  %ext = zext i1 %cmp to i32
71  store i32 %ext, i32 addrspace(1)* %out, align 4
72  ret void
73}
74
75; GCN-LABEL: {{^}}test_vcmp_vcnd_f16:
76; GFX1032: v_cmp_neq_f16_e64 [[C:vcc_lo|s\[[0-9:]+\]]], 0x7c00, s{{[0-9]+}}
77; GFX1032: v_cndmask_b32_e32 v{{[0-9]+}}, 0x3c00, v{{[0-9]+}}, [[C]]
78
79; GFX1064: v_cmp_neq_f16_e64 [[C:vcc|s\[[0-9:]+\]]], 0x7c00, s{{[0-9]+}}
80; GFX1064: v_cndmask_b32_e32 v{{[0-9]+}}, 0x3c00, v{{[0-9]+}}, [[C]]{{$}}
81define amdgpu_kernel void @test_vcmp_vcnd_f16(half addrspace(1)* %out, half %x) #0 {
82  %cmp = fcmp oeq half %x, 0x7FF0000000000000
83  %sel = select i1 %cmp, half 1.0, half %x
84  store half %sel, half addrspace(1)* %out, align 2
85  ret void
86}
87
88; GCN-LABEL: {{^}}test_vop3_cmp_f32_sop_and:
89; GFX1032: v_cmp_nge_f32_e32 vcc_lo, 0, v{{[0-9]+}}
90; GFX1032: v_cmp_nle_f32_e64 [[C2:s[0-9]+]], 1.0, v{{[0-9]+}}
91; GFX1032: s_and_b32 [[AND:s[0-9]+]], vcc_lo, [[C2]]
92; GFX1032: v_cndmask_b32_e64 v{{[0-9]+}}, 2.0, 1.0, [[AND]]
93; GFX1064: v_cmp_nge_f32_e32 vcc, 0, v{{[0-9]+}}
94; GFX1064: v_cmp_nle_f32_e64 [[C2:s\[[0-9:]+\]]], 1.0, v{{[0-9]+}}
95; GFX1064: s_and_b64 [[AND:s\[[0-9:]+\]]], vcc, [[C2]]
96; GFX1064: v_cndmask_b32_e64 v{{[0-9]+}}, 2.0, 1.0, [[AND]]
97define amdgpu_kernel void @test_vop3_cmp_f32_sop_and(float addrspace(1)* %arg) {
98  %lid = tail call i32 @llvm.amdgcn.workitem.id.x()
99  %gep = getelementptr inbounds float, float addrspace(1)* %arg, i32 %lid
100  %load = load float, float addrspace(1)* %gep, align 4
101  %cmp = fcmp ugt float %load, 0.0
102  %cmp2 = fcmp ult float %load, 1.0
103  %and = and i1 %cmp, %cmp2
104  %sel = select i1 %and, float 1.0, float 2.0
105  store float %sel, float addrspace(1)* %gep, align 4
106  ret void
107}
108
109; GCN-LABEL: {{^}}test_vop3_cmp_i32_sop_xor:
110; GFX1032: v_cmp_lt_i32_e32 vcc_lo, 0, v{{[0-9]+}}
111; GFX1032: v_cmp_gt_i32_e64 [[C2:s[0-9]+]], 1, v{{[0-9]+}}
112; GFX1032: s_xor_b32 [[AND:s[0-9]+]], vcc_lo, [[C2]]
113; GFX1032: v_cndmask_b32_e64 v{{[0-9]+}}, 2, 1, [[AND]]
114; GFX1064: v_cmp_lt_i32_e32 vcc, 0, v{{[0-9]+}}
115; GFX1064: v_cmp_gt_i32_e64 [[C2:s\[[0-9:]+\]]], 1, v{{[0-9]+}}
116; GFX1064: s_xor_b64 [[AND:s\[[0-9:]+\]]], vcc, [[C2]]
117; GFX1064: v_cndmask_b32_e64 v{{[0-9]+}}, 2, 1, [[AND]]
118define amdgpu_kernel void @test_vop3_cmp_i32_sop_xor(i32 addrspace(1)* %arg) {
119  %lid = tail call i32 @llvm.amdgcn.workitem.id.x()
120  %gep = getelementptr inbounds i32, i32 addrspace(1)* %arg, i32 %lid
121  %load = load i32, i32 addrspace(1)* %gep, align 4
122  %cmp = icmp sgt i32 %load, 0
123  %cmp2 = icmp slt i32 %load, 1
124  %xor = xor i1 %cmp, %cmp2
125  %sel = select i1 %xor, i32 1, i32 2
126  store i32 %sel, i32 addrspace(1)* %gep, align 4
127  ret void
128}
129
130; GCN-LABEL: {{^}}test_vop3_cmp_u32_sop_or:
131; GFX1032: v_cmp_lt_u32_e32 vcc_lo, 3, v{{[0-9]+}}
132; GFX1032: v_cmp_gt_u32_e64 [[C2:s[0-9]+]], 2, v{{[0-9]+}}
133; GFX1032: s_or_b32 [[AND:s[0-9]+]], vcc_lo, [[C2]]
134; GFX1032: v_cndmask_b32_e64 v{{[0-9]+}}, 2, 1, [[AND]]
135; GFX1064: v_cmp_lt_u32_e32 vcc, 3, v{{[0-9]+}}
136; GFX1064: v_cmp_gt_u32_e64 [[C2:s\[[0-9:]+\]]], 2, v{{[0-9]+}}
137; GFX1064: s_or_b64 [[AND:s\[[0-9:]+\]]], vcc, [[C2]]
138; GFX1064: v_cndmask_b32_e64 v{{[0-9]+}}, 2, 1, [[AND]]
139define amdgpu_kernel void @test_vop3_cmp_u32_sop_or(i32 addrspace(1)* %arg) {
140  %lid = tail call i32 @llvm.amdgcn.workitem.id.x()
141  %gep = getelementptr inbounds i32, i32 addrspace(1)* %arg, i32 %lid
142  %load = load i32, i32 addrspace(1)* %gep, align 4
143  %cmp = icmp ugt i32 %load, 3
144  %cmp2 = icmp ult i32 %load, 2
145  %or = or i1 %cmp, %cmp2
146  %sel = select i1 %or, i32 1, i32 2
147  store i32 %sel, i32 addrspace(1)* %gep, align 4
148  ret void
149}
150
151; GCN-LABEL: {{^}}test_mask_if:
152; GFX1032: s_and_saveexec_b32 s{{[0-9]+}}, vcc_lo
153; GFX1064: s_and_saveexec_b64 s[{{[0-9:]+}}], vcc{{$}}
154; GCN: s_cbranch_execz
155define amdgpu_kernel void @test_mask_if(i32 addrspace(1)* %arg) #0 {
156  %lid = tail call i32 @llvm.amdgcn.workitem.id.x()
157  %cmp = icmp ugt i32 %lid, 10
158  br i1 %cmp, label %if, label %endif
159
160if:
161  store i32 0, i32 addrspace(1)* %arg, align 4
162  br label %endif
163
164endif:
165  ret void
166}
167
168; GCN-LABEL: {{^}}test_loop_with_if:
169; GFX1032: s_or_b32 s{{[0-9]+}}, vcc_lo, s{{[0-9]+}}
170; GFX1032: s_andn2_b32 exec_lo, exec_lo, s{{[0-9]+}}
171; GFX1064: s_or_b64 s[{{[0-9:]+}}], vcc, s[{{[0-9:]+}}]
172; GFX1064: s_andn2_b64 exec, exec, s[{{[0-9:]+}}]
173; GCN:     s_cbranch_execz
174; GCN:   BB{{.*}}:
175; GFX1032: s_and_saveexec_b32 s{{[0-9]+}}, vcc_lo
176; GFX1064: s_and_saveexec_b64 s[{{[0-9:]+}}], vcc{{$}}
177; GCN:     s_cbranch_execz
178; GCN:   ; %bb.{{[0-9]+}}:
179; GCN:   BB{{.*}}:
180; GFX1032: s_xor_b32 s{{[0-9]+}}, exec_lo, s{{[0-9]+}}
181; GFX1064: s_xor_b64 s[{{[0-9:]+}}], exec, s[{{[0-9:]+}}]
182; GCN:   ; %bb.{{[0-9]+}}:
183; GCN:   ; %bb.{{[0-9]+}}:
184; GFX1032: s_or_b32 exec_lo, exec_lo, s{{[0-9]+}}
185; GFX1032: s_and_saveexec_b32 s{{[0-9]+}}, s{{[0-9]+}}
186; GFX1064: s_or_b64 exec, exec, s[{{[0-9:]+}}]
187; GFX1064: s_and_saveexec_b64 s[{{[0-9:]+}}], s[{{[0-9:]+}}]{{$}}
188; GCN:     s_cbranch_execz BB
189; GCN:   ; %bb.{{[0-9]+}}:
190; GCN:   BB{{.*}}:
191; GCN:     s_endpgm
192define amdgpu_kernel void @test_loop_with_if(i32 addrspace(1)* %arg) #0 {
193bb:
194  %tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
195  br label %bb2
196
197bb1:
198  ret void
199
200bb2:
201  %tmp3 = phi i32 [ 0, %bb ], [ %tmp15, %bb13 ]
202  %tmp4 = icmp slt i32 %tmp3, %tmp
203  br i1 %tmp4, label %bb5, label %bb11
204
205bb5:
206  %tmp6 = sext i32 %tmp3 to i64
207  %tmp7 = getelementptr inbounds i32, i32 addrspace(1)* %arg, i64 %tmp6
208  %tmp8 = load i32, i32 addrspace(1)* %tmp7, align 4
209  %tmp9 = icmp sgt i32 %tmp8, 10
210  br i1 %tmp9, label %bb10, label %bb11
211
212bb10:
213  store i32 %tmp, i32 addrspace(1)* %tmp7, align 4
214  br label %bb13
215
216bb11:
217  %tmp12 = sdiv i32 %tmp3, 2
218  br label %bb13
219
220bb13:
221  %tmp14 = phi i32 [ %tmp3, %bb10 ], [ %tmp12, %bb11 ]
222  %tmp15 = add nsw i32 %tmp14, 1
223  %tmp16 = icmp slt i32 %tmp14, 255
224  br i1 %tmp16, label %bb2, label %bb1
225}
226
227; GCN-LABEL: {{^}}test_loop_with_if_else_break:
228; GFX1032: s_and_saveexec_b32 s{{[0-9]+}}, vcc_lo
229; GFX1064: s_and_saveexec_b64 s[{{[0-9:]+}}], vcc{{$}}
230; GCN:     s_cbranch_execz
231; GCN:   ; %bb.{{[0-9]+}}: ; %.preheader
232; GCN:   BB{{.*}}:
233
234; GCN:     global_store_dword
235; GFX1032: s_or_b32 [[MASK0:s[0-9]+]], [[MASK0]], vcc_lo
236; GFX1064: s_or_b64 [[MASK0:s\[[0-9:]+\]]], [[MASK0]], vcc
237; GFX1032: s_andn2_b32 [[MASK1:s[0-9]+]], [[MASK1]], exec_lo
238; GFX1064: s_andn2_b64 [[MASK1:s\[[0-9:]+\]]], [[MASK1]], exec
239; GFX1032: s_and_b32 [[MASK0]], [[MASK0]], exec_lo
240; GFX1064: s_and_b64 [[MASK0]], [[MASK0]], exec
241; GFX1032: s_or_b32 [[MASK1]], [[MASK1]], [[MASK0]]
242; GFX1064: s_or_b64 [[MASK1]], [[MASK1]], [[MASK0]]
243; GCN:   BB{{.*}}: ; %Flow
244; GFX1032: s_and_b32 [[TMP0:s[0-9]+]], exec_lo, [[MASK1]]
245; GFX1064: s_and_b64 [[TMP0:s\[[0-9:]+\]]], exec, [[MASK1]]
246; GFX1032: s_or_b32  [[ACC:s[0-9]+]], [[TMP0]], [[ACC]]
247; GFX1064: s_or_b64  [[ACC:s\[[0-9:]+\]]], [[TMP0]], [[ACC]]
248; GFX1032: s_andn2_b32 exec_lo, exec_lo, [[ACC]]
249; GFX1064: s_andn2_b64 exec, exec, [[ACC]]
250; GCN:     s_cbranch_execz
251; GCN:   BB{{.*}}:
252
253; GFX1032: s_or_b32 [[MASK1]], [[MASK1]], exec_lo
254; GFX1064: s_or_b64 [[MASK1]], [[MASK1]], exec
255; GCN: global_load_dword [[LOAD:v[0-9]+]]
256; GFX1032: v_cmp_gt_i32_e32 vcc_lo, 11, [[LOAD]]
257; GFX1064: v_cmp_gt_i32_e32 vcc, 11, [[LOAD]]
258define amdgpu_kernel void @test_loop_with_if_else_break(i32 addrspace(1)* %arg) #0 {
259bb:
260  %tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
261  %tmp1 = icmp eq i32 %tmp, 0
262  br i1 %tmp1, label %.loopexit, label %.preheader
263
264.preheader:
265  br label %bb2
266
267bb2:
268  %tmp3 = phi i32 [ %tmp9, %bb8 ], [ 0, %.preheader ]
269  %tmp4 = zext i32 %tmp3 to i64
270  %tmp5 = getelementptr inbounds i32, i32 addrspace(1)* %arg, i64 %tmp4
271  %tmp6 = load i32, i32 addrspace(1)* %tmp5, align 4
272  %tmp7 = icmp sgt i32 %tmp6, 10
273  br i1 %tmp7, label %bb8, label %.loopexit
274
275bb8:
276  store i32 %tmp, i32 addrspace(1)* %tmp5, align 4
277  %tmp9 = add nuw nsw i32 %tmp3, 1
278  %tmp10 = icmp ult i32 %tmp9, 256
279  %tmp11 = icmp ult i32 %tmp9, %tmp
280  %tmp12 = and i1 %tmp10, %tmp11
281  br i1 %tmp12, label %bb2, label %.loopexit
282
283.loopexit:
284  ret void
285}
286
287; GCN-LABEL: {{^}}test_addc_vop2b:
288; GFX1032: v_add_co_u32_e64 v{{[0-9]+}}, vcc_lo, v{{[0-9]+}}, s{{[0-9]+}}
289; GFX1032: v_add_co_ci_u32_e32 v{{[0-9]+}}, vcc_lo, s{{[0-9]+}}, v{{[0-9]+}}, vcc_lo
290; GFX1064: v_add_co_u32_e64 v{{[0-9]+}}, vcc, v{{[0-9]+}}, s{{[0-9]+}}
291; GFX1064: v_add_co_ci_u32_e32 v{{[0-9]+}}, vcc, s{{[0-9]+}}, v{{[0-9]+}}, vcc{{$}}
292define amdgpu_kernel void @test_addc_vop2b(i64 addrspace(1)* %arg, i64 %arg1) #0 {
293bb:
294  %tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
295  %tmp3 = getelementptr inbounds i64, i64 addrspace(1)* %arg, i32 %tmp
296  %tmp4 = load i64, i64 addrspace(1)* %tmp3, align 8
297  %tmp5 = add nsw i64 %tmp4, %arg1
298  store i64 %tmp5, i64 addrspace(1)* %tmp3, align 8
299  ret void
300}
301
302; GCN-LABEL: {{^}}test_subbrev_vop2b:
303; GFX1032: v_sub_co_u32_e64 v{{[0-9]+}}, [[A0:s[0-9]+|vcc_lo]], v{{[0-9]+}}, s{{[0-9]+}}{{$}}
304; GFX1032: v_subrev_co_ci_u32_e32 v{{[0-9]+}}, vcc_lo, {{[vs][0-9]+}}, {{[vs][0-9]+}}, [[A0]]{{$}}
305; GFX1064: v_sub_co_u32_e64 v{{[0-9]+}}, [[A0:s\[[0-9:]+\]|vcc]], v{{[0-9]+}}, s{{[0-9]+}}{{$}}
306; GFX1064: v_subrev_co_ci_u32_e32 v{{[0-9]+}}, vcc, {{[vs][0-9]+}}, {{[vs][0-9]+}}, [[A0]]{{$}}
307define amdgpu_kernel void @test_subbrev_vop2b(i64 addrspace(1)* %arg, i64 %arg1) #0 {
308bb:
309  %tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
310  %tmp3 = getelementptr inbounds i64, i64 addrspace(1)* %arg, i32 %tmp
311  %tmp4 = load i64, i64 addrspace(1)* %tmp3, align 8
312  %tmp5 = sub nsw i64 %tmp4, %arg1
313  store i64 %tmp5, i64 addrspace(1)* %tmp3, align 8
314  ret void
315}
316
317; GCN-LABEL: {{^}}test_subb_vop2b:
318; GFX1032: v_sub_co_u32_e64 v{{[0-9]+}}, [[A0:s[0-9]+|vcc_lo]], s{{[0-9]+}}, v{{[0-9]+}}{{$}}
319; GFX1032: v_sub_co_ci_u32_e32 v{{[0-9]+}}, vcc_lo, {{[vs][0-9]+}}, v{{[0-9]+}}, [[A0]]{{$}}
320; GFX1064: v_sub_co_u32_e64 v{{[0-9]+}}, [[A0:s\[[0-9:]+\]|vcc]], s{{[0-9]+}}, v{{[0-9]+}}{{$}}
321; GFX1064: v_sub_co_ci_u32_e32 v{{[0-9]+}}, vcc, {{[vs][0-9]+}}, v{{[0-9]+}}, [[A0]]{{$}}
322define amdgpu_kernel void @test_subb_vop2b(i64 addrspace(1)* %arg, i64 %arg1) #0 {
323bb:
324  %tmp = tail call i32 @llvm.amdgcn.workitem.id.x()
325  %tmp3 = getelementptr inbounds i64, i64 addrspace(1)* %arg, i32 %tmp
326  %tmp4 = load i64, i64 addrspace(1)* %tmp3, align 8
327  %tmp5 = sub nsw i64 %arg1, %tmp4
328  store i64 %tmp5, i64 addrspace(1)* %tmp3, align 8
329  ret void
330}
331
332; GCN-LABEL: {{^}}test_udiv64:
333; GFX1032: v_add_co_u32_e64 v{{[0-9]+}}, [[SDST:s[0-9]+]], v{{[0-9]+}}, v{{[0-9]+}}
334; GFX1032: v_add_co_ci_u32_e32 v{{[0-9]+}}, vcc_lo, 0, v{{[0-9]+}}, vcc_lo
335; GFX1032: v_add_co_ci_u32_e64 v{{[0-9]+}}, vcc_lo, v{{[0-9]+}}, v{{[0-9]+}}, [[SDST]]
336; GFX1032: v_add_co_u32_e64 v{{[0-9]+}}, vcc_lo, v{{[0-9]+}}, v{{[0-9]+}}
337; GFX1032: v_add_co_u32_e64 v{{[0-9]+}}, vcc_lo, v{{[0-9]+}}, v{{[0-9]+}}
338; GFX1032: v_add_co_u32_e64 v{{[0-9]+}}, vcc_lo, v{{[0-9]+}}, v{{[0-9]+}}
339; GFX1032: v_add_co_ci_u32_e32 v{{[0-9]+}}, vcc_lo, 0, v{{[0-9]+}}, vcc_lo
340; GFX1032: v_sub_co_u32_e64 v{{[0-9]+}}, vcc_lo, s{{[0-9]+}}, v{{[0-9]+}}
341; GFX1032: v_subrev_co_ci_u32_e64 v{{[0-9]+}}, s{{[0-9]+}}, {{[vs][0-9]+}}, v{{[0-9]+}}, vcc_lo
342; GFX1032: v_sub_co_ci_u32_e32 v{{[0-9]+}}, vcc_lo, {{[vs][0-9]+}}, v{{[0-9]+}}, vcc_lo
343; GFX1064: v_add_co_u32_e64 v{{[0-9]+}}, [[SDST:s\[[0-9:]+\]]], v{{[0-9]+}}, v{{[0-9]+}}
344; GFX1064: v_add_co_ci_u32_e32 v{{[0-9]+}}, vcc, 0, v{{[0-9]+}}, vcc{{$}}
345; GFX1064: v_add_co_ci_u32_e64 v{{[0-9]+}}, vcc, v{{[0-9]+}}, v{{[0-9]+}}, [[SDST]]
346; GFX1064: v_add_co_u32_e64 v{{[0-9]+}}, vcc, v{{[0-9]+}}, v{{[0-9]+}}
347; GFX1064: v_add_co_u32_e64 v{{[0-9]+}}, vcc, v{{[0-9]+}}, v{{[0-9]+}}
348; GFX1064: v_add_co_u32_e64 v{{[0-9]+}}, vcc, v{{[0-9]+}}, v{{[0-9]+}}
349; GFX1064: v_add_co_ci_u32_e32 v{{[0-9]+}}, vcc, 0, v{{[0-9]+}}, vcc{{$}}
350; GFX1064: v_sub_co_u32_e64 v{{[0-9]+}}, s[{{[0-9:]+}}], s{{[0-9]+}}, v{{[0-9]+}}
351; GFX1064: v_subrev_co_ci_u32_e64 v{{[0-9]+}}, vcc, {{[vs][0-9]+}}, v{{[0-9]+}}, s[{{[0-9:]+}}]
352; GFX1064: v_sub_co_ci_u32_e64 v{{[0-9]+}}, s[{{[0-9:]+}}], {{[vs][0-9]+}}, v{{[0-9]+}}, s[{{[0-9:]+}}]
353define amdgpu_kernel void @test_udiv64(i64 addrspace(1)* %arg) #0 {
354bb:
355  %tmp = getelementptr inbounds i64, i64 addrspace(1)* %arg, i64 1
356  %tmp1 = load i64, i64 addrspace(1)* %tmp, align 8
357  %tmp2 = load i64, i64 addrspace(1)* %arg, align 8
358  %tmp3 = udiv i64 %tmp1, %tmp2
359  %tmp4 = getelementptr inbounds i64, i64 addrspace(1)* %arg, i64 2
360  store i64 %tmp3, i64 addrspace(1)* %tmp4, align 8
361  ret void
362}
363
364; GCN-LABEL: {{^}}test_div_scale_f32:
365; GFX1032: v_div_scale_f32 v{{[0-9]+}}, s{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}
366; GFX1064: v_div_scale_f32 v{{[0-9]+}}, s[{{[0-9:]+}}], v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}
367define amdgpu_kernel void @test_div_scale_f32(float addrspace(1)* %out, float addrspace(1)* %in) #0 {
368  %tid = call i32 @llvm.amdgcn.workitem.id.x() nounwind readnone
369  %gep.0 = getelementptr float, float addrspace(1)* %in, i32 %tid
370  %gep.1 = getelementptr float, float addrspace(1)* %gep.0, i32 1
371
372  %a = load volatile float, float addrspace(1)* %gep.0, align 4
373  %b = load volatile float, float addrspace(1)* %gep.1, align 4
374
375  %result = call { float, i1 } @llvm.amdgcn.div.scale.f32(float %a, float %b, i1 false) nounwind readnone
376  %result0 = extractvalue { float, i1 } %result, 0
377  store float %result0, float addrspace(1)* %out, align 4
378  ret void
379}
380
381; GCN-LABEL: {{^}}test_div_scale_f64:
382; GFX1032: v_div_scale_f64 v[{{[0-9:]+}}], s{{[0-9]+}}, v[{{[0-9:]+}}], v[{{[0-9:]+}}], v[{{[0-9:]+}}]
383; GFX1064: v_div_scale_f64 v[{{[0-9:]+}}], s[{{[0-9:]+}}], v[{{[0-9:]+}}], v[{{[0-9:]+}}], v[{{[0-9:]+}}]
384define amdgpu_kernel void @test_div_scale_f64(double addrspace(1)* %out, double addrspace(1)* %aptr, double addrspace(1)* %in) #0 {
385  %tid = call i32 @llvm.amdgcn.workitem.id.x() nounwind readnone
386  %gep.0 = getelementptr double, double addrspace(1)* %in, i32 %tid
387  %gep.1 = getelementptr double, double addrspace(1)* %gep.0, i32 1
388
389  %a = load volatile double, double addrspace(1)* %gep.0, align 8
390  %b = load volatile double, double addrspace(1)* %gep.1, align 8
391
392  %result = call { double, i1 } @llvm.amdgcn.div.scale.f64(double %a, double %b, i1 true) nounwind readnone
393  %result0 = extractvalue { double, i1 } %result, 0
394  store double %result0, double addrspace(1)* %out, align 8
395  ret void
396}
397
398; GCN-LABEL: {{^}}test_mad_i64_i32:
399; GFX1032: v_mad_i64_i32 v[{{[0-9:]+}}], s{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}, v[{{[0-9:]+}}]
400; GFX1064: v_mad_i64_i32 v[{{[0-9:]+}}], s[{{[0-9:]+}}], v{{[0-9]+}}, v{{[0-9]+}}, v[{{[0-9:]+}}]
401define i64 @test_mad_i64_i32(i32 %arg0, i32 %arg1, i64 %arg2) #0 {
402  %sext0 = sext i32 %arg0 to i64
403  %sext1 = sext i32 %arg1 to i64
404  %mul = mul i64 %sext0, %sext1
405  %mad = add i64 %mul, %arg2
406  ret i64 %mad
407}
408
409; GCN-LABEL: {{^}}test_mad_u64_u32:
410; GFX1032: v_mad_u64_u32 v[{{[0-9:]+}}], s{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}, v[{{[0-9:]+}}]
411; GFX1064: v_mad_u64_u32 v[{{[0-9:]+}}], s[{{[0-9:]+}}], v{{[0-9]+}}, v{{[0-9]+}}, v[{{[0-9:]+}}]
412define i64 @test_mad_u64_u32(i32 %arg0, i32 %arg1, i64 %arg2) #0 {
413  %sext0 = zext i32 %arg0 to i64
414  %sext1 = zext i32 %arg1 to i64
415  %mul = mul i64 %sext0, %sext1
416  %mad = add i64 %mul, %arg2
417  ret i64 %mad
418}
419
420; GCN-LABEL: {{^}}test_div_fmas_f32:
421; GFX1032: v_cmp_eq_u32_e64 vcc_lo,
422; GFX1064: v_cmp_eq_u32_e64 vcc,
423; GCN:     v_div_fmas_f32 v{{[0-9]+}}, {{[vs][0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}
424define amdgpu_kernel void @test_div_fmas_f32(float addrspace(1)* %out, float %a, float %b, float %c, i1 %d) nounwind {
425  %result = call float @llvm.amdgcn.div.fmas.f32(float %a, float %b, float %c, i1 %d) nounwind readnone
426  store float %result, float addrspace(1)* %out, align 4
427  ret void
428}
429
430; GCN-LABEL: {{^}}test_div_fmas_f64:
431; GFX1032: v_cmp_eq_u32_e64 vcc_lo,
432; GFX1064: v_cmp_eq_u32_e64 vcc,
433; GCN-DAG: v_div_fmas_f64 v[{{[0-9:]+}}], {{[vs]}}[{{[0-9:]+}}], v[{{[0-9:]+}}], v[{{[0-9:]+}}]
434define amdgpu_kernel void @test_div_fmas_f64(double addrspace(1)* %out, double %a, double %b, double %c, i1 %d) nounwind {
435  %result = call double @llvm.amdgcn.div.fmas.f64(double %a, double %b, double %c, i1 %d) nounwind readnone
436  store double %result, double addrspace(1)* %out, align 8
437  ret void
438}
439
440; GCN-LABEL: {{^}}test_div_fmas_f32_i1_phi_vcc:
441; GFX1032: s_mov_b32 [[VCC:vcc_lo]], 0{{$}}
442; GFX1064: s_mov_b64 [[VCC:vcc]], 0{{$}}
443; GFX1032: s_and_saveexec_b32 [[SAVE:s[0-9]+]], s{{[0-9]+}}{{$}}
444; GFX1064: s_and_saveexec_b64 [[SAVE:s\[[0-9]+:[0-9]+\]]], s[{{[0-9:]+}}]{{$}}
445
446; GCN: load_dword [[LOAD:v[0-9]+]]
447; GCN: v_cmp_ne_u32_e32 [[VCC]], 0, [[LOAD]]
448
449; GCN: BB{{[0-9_]+}}:
450; GFX1032: s_or_b32 exec_lo, exec_lo, [[SAVE]]
451; GFX1064: s_or_b64 exec, exec, [[SAVE]]
452; GCN: v_div_fmas_f32 {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}, {{v[0-9]+}}
453define amdgpu_kernel void @test_div_fmas_f32_i1_phi_vcc(float addrspace(1)* %out, float addrspace(1)* %in, i32 addrspace(1)* %dummy) #0 {
454entry:
455  %tid = call i32 @llvm.amdgcn.workitem.id.x() nounwind readnone
456  %gep.out = getelementptr float, float addrspace(1)* %out, i32 2
457  %gep.a = getelementptr float, float addrspace(1)* %in, i32 %tid
458  %gep.b = getelementptr float, float addrspace(1)* %gep.a, i32 1
459  %gep.c = getelementptr float, float addrspace(1)* %gep.a, i32 2
460
461  %a = load float, float addrspace(1)* %gep.a
462  %b = load float, float addrspace(1)* %gep.b
463  %c = load float, float addrspace(1)* %gep.c
464
465  %cmp0 = icmp eq i32 %tid, 0
466  br i1 %cmp0, label %bb, label %exit
467
468bb:
469  %val = load volatile i32, i32 addrspace(1)* %dummy
470  %cmp1 = icmp ne i32 %val, 0
471  br label %exit
472
473exit:
474  %cond = phi i1 [false, %entry], [%cmp1, %bb]
475  %result = call float @llvm.amdgcn.div.fmas.f32(float %a, float %b, float %c, i1 %cond) nounwind readnone
476  store float %result, float addrspace(1)* %gep.out, align 4
477  ret void
478}
479
480; GCN-LABEL: {{^}}fdiv_f32:
481; GFX1032: v_div_scale_f32 v{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}}
482; GFX1064: v_div_scale_f32 v{{[0-9]+}}, s{{\[[0-9]+:[0-9]+\]}}, s{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}}
483; GCN: v_rcp_f32_e32 v{{[0-9]+}}, v{{[0-9]+}}
484; GFX1032: v_div_scale_f32 v{{[0-9]+}}, vcc_lo, s{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}}
485; GFX1064: v_div_scale_f32 v{{[0-9]+}}, vcc, s{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}}
486
487; GCN-NOT: vcc
488; GCN: v_div_fmas_f32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}}
489define amdgpu_kernel void @fdiv_f32(float addrspace(1)* %out, float %a, float %b) #0 {
490entry:
491  %fdiv = fdiv float %a, %b
492  store float %fdiv, float addrspace(1)* %out
493  ret void
494}
495
496; GCN-LABEL: {{^}}test_br_cc_f16:
497; GFX1032:  v_cmp_nlt_f16_e32 vcc_lo,
498; GFX1032:  s_and_b32 vcc_lo, exec_lo, vcc_lo
499; GFX1064:  v_cmp_nlt_f16_e32 vcc,
500; GFX1064:  s_and_b64 vcc, exec, vcc{{$}}
501; GCN-NEXT: s_cbranch_vccnz
502define amdgpu_kernel void @test_br_cc_f16(
503    half addrspace(1)* %r,
504    half addrspace(1)* %a,
505    half addrspace(1)* %b) {
506entry:
507  %a.val = load half, half addrspace(1)* %a
508  %b.val = load half, half addrspace(1)* %b
509  %fcmp = fcmp olt half %a.val, %b.val
510  br i1 %fcmp, label %one, label %two
511
512one:
513  store half %a.val, half addrspace(1)* %r
514  ret void
515
516two:
517  store half %b.val, half addrspace(1)* %r
518  ret void
519}
520
521; GCN-LABEL: {{^}}test_brcc_i1:
522; GCN:      s_cmp_eq_u32 s{{[0-9]+}}, 0
523; GCN-NEXT: s_cbranch_scc1
524define amdgpu_kernel void @test_brcc_i1(i32 addrspace(1)* noalias %out, i32 addrspace(1)* noalias %in, i1 %val) #0 {
525  %cmp0 = icmp ne i1 %val, 0
526  br i1 %cmp0, label %store, label %end
527
528store:
529  store i32 222, i32 addrspace(1)* %out
530  ret void
531
532end:
533  ret void
534}
535
536; GCN-LABEL: {{^}}test_preserve_condition_undef_flag:
537; GFX1032-DAG: v_cmp_nlt_f32_e64 s{{[0-9]+}}, s{{[0-9]+}}, 1.0
538; GFX1032-DAG: v_cmp_ngt_f32_e64 s{{[0-9]+}}, s{{[0-9]+}}, 0
539; GFX1032: v_cmp_nlt_f32_e64 s{{[0-9]+}}, s{{[0-9]+}}, 1.0
540; GFX1032: s_or_b32 [[OR1:s[0-9]+]], s{{[0-9]+}}, s{{[0-9]+}}
541; GFX1032: s_or_b32 [[OR2:s[0-9]+]], [[OR1]], s{{[0-9]+}}
542; GFX1032: s_and_b32 vcc_lo, exec_lo, [[OR2]]
543; GFX1064-DAG: v_cmp_nlt_f32_e64 s[{{[0-9:]+}}], s{{[0-9]+}}, 1.0
544; GFX1064-DAG: v_cmp_ngt_f32_e64 s[{{[0-9:]+}}], s{{[0-9]+}}, 0
545; GFX1064: v_cmp_nlt_f32_e64 s[{{[0-9:]+}}], s{{[0-9]+}}, 1.0
546; GFX1064: s_or_b64 [[OR1:s\[[0-9:]+\]]], s[{{[0-9:]+}}], s[{{[0-9:]+}}]
547; GFX1064: s_or_b64 [[OR2:s\[[0-9:]+\]]], [[OR1]], s[{{[0-9:]+}}]
548; GFX1064: s_and_b64 vcc, exec, [[OR2]]
549; GCN:     s_cbranch_vccnz
550define amdgpu_kernel void @test_preserve_condition_undef_flag(float %arg, i32 %arg1, float %arg2) #0 {
551bb0:
552  %tmp = icmp sgt i32 %arg1, 4
553  %undef = call i1 @llvm.amdgcn.class.f32(float undef, i32 undef)
554  %tmp4 = select i1 %undef, float %arg, float 1.000000e+00
555  %tmp5 = fcmp ogt float %arg2, 0.000000e+00
556  %tmp6 = fcmp olt float %arg2, 1.000000e+00
557  %tmp7 = fcmp olt float %arg, %tmp4
558  %tmp8 = and i1 %tmp5, %tmp6
559  %tmp9 = and i1 %tmp8, %tmp7
560  br i1 %tmp9, label %bb1, label %bb2
561
562bb1:
563  store volatile i32 0, i32 addrspace(1)* undef
564  br label %bb2
565
566bb2:
567  ret void
568}
569
570; GCN-LABEL: {{^}}test_invert_true_phi_cond_break_loop:
571; GFX1032: s_xor_b32 s{{[0-9]+}}, s{{[0-9]+}}, -1
572; GFX1032: s_or_b32 s{{[0-9]+}}, s{{[0-9]+}}, s{{[0-9]+}}
573; GFX1064: s_xor_b64 s[{{[0-9:]+}}], s[{{[0-9:]+}}], -1
574; GFX1064: s_or_b64 s[{{[0-9:]+}}], s[{{[0-9:]+}}], s[{{[0-9:]+}}]
575define amdgpu_kernel void @test_invert_true_phi_cond_break_loop(i32 %arg) #0 {
576bb:
577  %id = call i32 @llvm.amdgcn.workitem.id.x()
578  %tmp = sub i32 %id, %arg
579  br label %bb1
580
581bb1:                                              ; preds = %Flow, %bb
582  %lsr.iv = phi i32 [ undef, %bb ], [ %tmp2, %Flow ]
583  %lsr.iv.next = add i32 %lsr.iv, 1
584  %cmp0 = icmp slt i32 %lsr.iv.next, 0
585  br i1 %cmp0, label %bb4, label %Flow
586
587bb4:                                              ; preds = %bb1
588  %load = load volatile i32, i32 addrspace(1)* undef, align 4
589  %cmp1 = icmp sge i32 %tmp, %load
590  br label %Flow
591
592Flow:                                             ; preds = %bb4, %bb1
593  %tmp2 = phi i32 [ %lsr.iv.next, %bb4 ], [ undef, %bb1 ]
594  %tmp3 = phi i1 [ %cmp1, %bb4 ], [ true, %bb1 ]
595  br i1 %tmp3, label %bb1, label %bb9
596
597bb9:                                              ; preds = %Flow
598  store volatile i32 7, i32 addrspace(3)* undef
599  ret void
600}
601
602; GCN-LABEL: {{^}}test_movrels_extract_neg_offset_vgpr:
603; GFX1032: v_cmp_eq_u32_e32 vcc_lo, 1, v{{[0-9]+}}
604; GFX1032: v_cndmask_b32_e64 v{{[0-9]+}}, 0, 1, vcc_lo
605; GFX1032: v_cmp_ne_u32_e32 vcc_lo, 2, v{{[0-9]+}}
606; GFX1032: v_cndmask_b32_e32 v{{[0-9]+}}, 2, v{{[0-9]+}}, vcc_lo
607; GFX1032: v_cmp_ne_u32_e32 vcc_lo, 3, v{{[0-9]+}}
608; GFX1032: v_cndmask_b32_e32 v{{[0-9]+}}, 3, v{{[0-9]+}}, vcc_lo
609; GFX1064: v_cmp_eq_u32_e32 vcc, 1, v{{[0-9]+}}
610; GFX1064: v_cndmask_b32_e64 v{{[0-9]+}}, 0, 1, vcc
611; GFX1064: v_cmp_ne_u32_e32 vcc, 2, v{{[0-9]+}}
612; GFX1064: v_cndmask_b32_e32 v{{[0-9]+}}, 2, v{{[0-9]+}}, vcc
613; GFX1064: v_cmp_ne_u32_e32 vcc, 3, v{{[0-9]+}}
614; GFX1064: v_cndmask_b32_e32 v{{[0-9]+}}, 3, v{{[0-9]+}}, vcc
615define amdgpu_kernel void @test_movrels_extract_neg_offset_vgpr(i32 addrspace(1)* %out) #0 {
616entry:
617  %id = call i32 @llvm.amdgcn.workitem.id.x() #1
618  %index = add i32 %id, -512
619  %value = extractelement <4 x i32> <i32 0, i32 1, i32 2, i32 3>, i32 %index
620  store i32 %value, i32 addrspace(1)* %out
621  ret void
622}
623
624; GCN-LABEL: {{^}}test_set_inactive:
625; GFX1032: s_not_b32 exec_lo, exec_lo
626; GFX1032: v_mov_b32_e32 {{v[0-9]+}}, 42
627; GFX1032: s_not_b32 exec_lo, exec_lo
628; GFX1064: s_not_b64 exec, exec{{$}}
629; GFX1064: v_mov_b32_e32 {{v[0-9]+}}, 42
630; GFX1064: s_not_b64 exec, exec{{$}}
631define amdgpu_kernel void @test_set_inactive(i32 addrspace(1)* %out, i32 %in) #0 {
632  %tmp = call i32 @llvm.amdgcn.set.inactive.i32(i32 %in, i32 42)
633  store i32 %tmp, i32 addrspace(1)* %out
634  ret void
635}
636
637; GCN-LABEL: {{^}}test_set_inactive_64:
638; GFX1032: s_not_b32 exec_lo, exec_lo
639; GFX1032: v_mov_b32_e32 {{v[0-9]+}}, 0
640; GFX1032: v_mov_b32_e32 {{v[0-9]+}}, 0
641; GFX1032: s_not_b32 exec_lo, exec_lo
642; GFX1064: s_not_b64 exec, exec{{$}}
643; GFX1064: v_mov_b32_e32 {{v[0-9]+}}, 0
644; GFX1064: v_mov_b32_e32 {{v[0-9]+}}, 0
645; GFX1064: s_not_b64 exec, exec{{$}}
646define amdgpu_kernel void @test_set_inactive_64(i64 addrspace(1)* %out, i64 %in) #0 {
647  %tmp = call i64 @llvm.amdgcn.set.inactive.i64(i64 %in, i64 0)
648  store i64 %tmp, i64 addrspace(1)* %out
649  ret void
650}
651
652; GCN-LABEL: {{^}}test_kill_i1_terminator_float:
653; GFX1032: s_mov_b32 exec_lo, 0
654; GFX1064: s_mov_b64 exec, 0
655define amdgpu_ps void @test_kill_i1_terminator_float() #0 {
656  call void @llvm.amdgcn.kill(i1 false)
657  ret void
658}
659
660; GCN-LABEL: {{^}}test_kill_i1_terminator_i1:
661; GFX1032: s_or_b32 [[OR:s[0-9]+]],
662; GFX1032: s_and_b32 exec_lo, exec_lo, [[OR]]
663; GFX1064: s_or_b64 [[OR:s\[[0-9:]+\]]],
664; GFX1064: s_and_b64 exec, exec, [[OR]]
665define amdgpu_gs void @test_kill_i1_terminator_i1(i32 %a, i32 %b, i32 %c, i32 %d) #0 {
666  %c1 = icmp slt i32 %a, %b
667  %c2 = icmp slt i32 %c, %d
668  %x = or i1 %c1, %c2
669  call void @llvm.amdgcn.kill(i1 %x)
670  ret void
671}
672
673; GCN-LABEL: {{^}}test_loop_vcc:
674; GFX1032: v_cmp_lt_f32_e32 vcc_lo,
675; GFX1064: v_cmp_lt_f32_e32 vcc,
676; GCN: s_cbranch_vccz
677define amdgpu_ps <4 x float> @test_loop_vcc(<4 x float> %in) #0 {
678entry:
679  br label %loop
680
681loop:
682  %ctr.iv = phi float [ 0.0, %entry ], [ %ctr.next, %body ]
683  %c.iv = phi <4 x float> [ %in, %entry ], [ %c.next, %body ]
684  %cc = fcmp ogt float %ctr.iv, 7.0
685  br i1 %cc, label %break, label %body
686
687body:
688  %c.iv0 = extractelement <4 x float> %c.iv, i32 0
689  %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)
690  %ctr.next = fadd float %ctr.iv, 2.0
691  br label %loop
692
693break:
694  ret <4 x float> %c.iv
695}
696
697; GCN-LABEL: {{^}}test_wwm1:
698; GFX1032: s_or_saveexec_b32 [[SAVE:s[0-9]+]], -1
699; GFX1032: s_mov_b32 exec_lo, [[SAVE]]
700; GFX1064: s_or_saveexec_b64 [[SAVE:s\[[0-9]+:[0-9]+\]]], -1
701; GFX1064: s_mov_b64 exec, [[SAVE]]
702define amdgpu_ps float @test_wwm1(i32 inreg %idx0, i32 inreg %idx1, float %src0, float %src1) {
703main_body:
704  %out = fadd float %src0, %src1
705  %out.0 = call float @llvm.amdgcn.wwm.f32(float %out)
706  ret float %out.0
707}
708
709; GCN-LABEL: {{^}}test_wwm2:
710; GFX1032: v_cmp_gt_u32_e32 vcc_lo, 32, v{{[0-9]+}}
711; GFX1032: s_and_saveexec_b32 [[SAVE1:s[0-9]+]], vcc_lo
712; GFX1032: s_or_saveexec_b32 [[SAVE2:s[0-9]+]], -1
713; GFX1032: s_mov_b32 exec_lo, [[SAVE2]]
714; GFX1032: s_or_b32 exec_lo, exec_lo, [[SAVE1]]
715; GFX1064: v_cmp_gt_u32_e32 vcc, 32, v{{[0-9]+}}
716; GFX1064: s_and_saveexec_b64 [[SAVE1:s\[[0-9:]+\]]], vcc{{$}}
717; GFX1064: s_or_saveexec_b64 [[SAVE2:s\[[0-9:]+\]]], -1
718; GFX1064: s_mov_b64 exec, [[SAVE2]]
719; GFX1064: s_or_b64 exec, exec, [[SAVE1]]
720define amdgpu_ps float @test_wwm2(i32 inreg %idx) {
721main_body:
722  ; use mbcnt to make sure the branch is divergent
723  %lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 -1, i32 0)
724  %hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 -1, i32 %lo)
725  %cc = icmp uge i32 %hi, 32
726  br i1 %cc, label %endif, label %if
727
728if:
729  %src = call float @llvm.amdgcn.struct.buffer.load.f32(<4 x i32> undef, i32 %idx, i32 0, i32 0, i32 0)
730  %out = fadd float %src, %src
731  %out.0 = call float @llvm.amdgcn.wwm.f32(float %out)
732  %out.1 = fadd float %src, %out.0
733  br label %endif
734
735endif:
736  %out.2 = phi float [ %out.1, %if ], [ 0.0, %main_body ]
737  ret float %out.2
738}
739
740; GCN-LABEL: {{^}}test_wqm1:
741; GFX1032: s_mov_b32 [[ORIG:s[0-9]+]], exec_lo
742; GFX1032: s_wqm_b32 exec_lo, exec_lo
743; GFX1032: s_and_b32 exec_lo, exec_lo, [[ORIG]]
744; GFX1064: s_mov_b64 [[ORIG:s\[[0-9]+:[0-9]+\]]], exec{{$}}
745; GFX1064: s_wqm_b64 exec, exec{{$}}
746; GFX1064: s_and_b64 exec, exec, [[ORIG]]
747define amdgpu_ps <4 x float> @test_wqm1(i32 inreg, i32 inreg, i32 inreg, i32 inreg %m0, <8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, <2 x float> %pos) #0 {
748main_body:
749  %inst23 = extractelement <2 x float> %pos, i32 0
750  %inst24 = extractelement <2 x float> %pos, i32 1
751  %inst25 = tail call float @llvm.amdgcn.interp.p1(float %inst23, i32 0, i32 0, i32 %m0)
752  %inst26 = tail call float @llvm.amdgcn.interp.p2(float %inst25, float %inst24, i32 0, i32 0, i32 %m0)
753  %inst28 = tail call float @llvm.amdgcn.interp.p1(float %inst23, i32 1, i32 0, i32 %m0)
754  %inst29 = tail call float @llvm.amdgcn.interp.p2(float %inst28, float %inst24, i32 1, i32 0, i32 %m0)
755  %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)
756  ret <4 x float> %tex
757}
758
759; GCN-LABEL: {{^}}test_wqm2:
760; GFX1032: s_wqm_b32 exec_lo, exec_lo
761; GFX1032: s_and_b32 exec_lo, exec_lo, s{{[0-9+]}}
762; GFX1064: s_wqm_b64 exec, exec{{$}}
763; GFX1064: s_and_b64 exec, exec, s[{{[0-9:]+}}]
764define amdgpu_ps float @test_wqm2(i32 inreg %idx0, i32 inreg %idx1) #0 {
765main_body:
766  %src0 = call float @llvm.amdgcn.struct.buffer.load.f32(<4 x i32> undef, i32 %idx0, i32 0, i32 0, i32 0)
767  %src1 = call float @llvm.amdgcn.struct.buffer.load.f32(<4 x i32> undef, i32 %idx1, i32 0, i32 0, i32 0)
768  %out = fadd float %src0, %src1
769  %out.0 = bitcast float %out to i32
770  %out.1 = call i32 @llvm.amdgcn.wqm.i32(i32 %out.0)
771  %out.2 = bitcast i32 %out.1 to float
772  ret float %out.2
773}
774
775; GCN-LABEL: {{^}}test_intr_fcmp_i64:
776; GFX1032-DAG: v_mov_b32_e32 v[[V_HI:[0-9]+]], 0{{$}}
777; GFX1032-DAG: v_cmp_eq_f32_e64 s[[C_LO:[0-9]+]], {{s[0-9]+}}, |{{[vs][0-9]+}}|
778; GFX1032-DAG: v_mov_b32_e32 v[[V_LO:[0-9]+]], s[[C_LO]]
779; GFX1064:     v_cmp_eq_f32_e64 s{{\[}}[[C_LO:[0-9]+]]:[[C_HI:[0-9]+]]], {{s[0-9]+}}, |{{[vs][0-9]+}}|
780; GFX1064-DAG: v_mov_b32_e32 v[[V_LO:[0-9]+]], s[[C_LO]]
781; GFX1064-DAG: v_mov_b32_e32 v[[V_HI:[0-9]+]], s[[C_HI]]
782; GCN:         store_dwordx2 v{{[0-9]+}}, v{{\[}}[[V_LO]]:[[V_HI]]], s
783define amdgpu_kernel void @test_intr_fcmp_i64(i64 addrspace(1)* %out, float %src, float %a) {
784  %temp = call float @llvm.fabs.f32(float %a)
785  %result = call i64 @llvm.amdgcn.fcmp.i64.f32(float %src, float %temp, i32 1)
786  store i64 %result, i64 addrspace(1)* %out
787  ret void
788}
789
790; GCN-LABEL: {{^}}test_intr_icmp_i64:
791; GFX1032-DAG: v_mov_b32_e32 v[[V_HI:[0-9]+]], 0{{$}}
792; GFX1032-DAG: v_cmp_eq_u32_e64 [[C_LO:vcc_lo|s[0-9]+]], 0x64, {{s[0-9]+}}
793; GFX1032-DAG: v_mov_b32_e32 v[[V_LO:[0-9]+]], [[C_LO]]
794; GFX1064:     v_cmp_eq_u32_e64 s{{\[}}[[C_LO:[0-9]+]]:[[C_HI:[0-9]+]]], 0x64, {{s[0-9]+}}
795; GFX1064-DAG: v_mov_b32_e32 v[[V_LO:[0-9]+]], s[[C_LO]]
796; GFX1064-DAG: v_mov_b32_e32 v[[V_HI:[0-9]+]], s[[C_HI]]
797; GCN:         store_dwordx2 v{{[0-9]+}}, v{{\[}}[[V_LO]]:[[V_HI]]], s
798define amdgpu_kernel void @test_intr_icmp_i64(i64 addrspace(1)* %out, i32 %src) {
799  %result = call i64 @llvm.amdgcn.icmp.i64.i32(i32 %src, i32 100, i32 32)
800  store i64 %result, i64 addrspace(1)* %out
801  ret void
802}
803
804; GCN-LABEL: {{^}}test_intr_fcmp_i32:
805; GFX1032-DAG: v_cmp_eq_f32_e64 s[[C_LO:[0-9]+]], {{s[0-9]+}}, |{{[vs][0-9]+}}|
806; GFX1032-DAG: v_mov_b32_e32 v[[V_LO:[0-9]+]], s[[C_LO]]
807; GFX1064:     v_cmp_eq_f32_e64 s{{\[}}[[C_LO:[0-9]+]]:[[C_HI:[0-9]+]]], {{s[0-9]+}}, |{{[vs][0-9]+}}|
808; GFX1064-DAG: v_mov_b32_e32 v[[V_LO:[0-9]+]], s[[C_LO]]
809; GCN:         store_dword v{{[0-9]+}}, v[[V_LO]], s
810define amdgpu_kernel void @test_intr_fcmp_i32(i32 addrspace(1)* %out, float %src, float %a) {
811  %temp = call float @llvm.fabs.f32(float %a)
812  %result = call i32 @llvm.amdgcn.fcmp.i32.f32(float %src, float %temp, i32 1)
813  store i32 %result, i32 addrspace(1)* %out
814  ret void
815}
816
817; GCN-LABEL: {{^}}test_intr_icmp_i32:
818; GFX1032-DAG: v_cmp_eq_u32_e64 s[[C_LO:[0-9]+]], 0x64, {{s[0-9]+}}
819; GFX1032-DAG: v_mov_b32_e32 v[[V_LO:[0-9]+]], s[[C_LO]]{{$}}
820; GFX1064:     v_cmp_eq_u32_e64 s{{\[}}[[C_LO:[0-9]+]]:{{[0-9]+}}], 0x64, {{s[0-9]+}}
821; GFX1064-DAG: v_mov_b32_e32 v[[V_LO:[0-9]+]], s[[C_LO]]{{$}}
822; GCN:         store_dword v{{[0-9]+}}, v[[V_LO]], s
823define amdgpu_kernel void @test_intr_icmp_i32(i32 addrspace(1)* %out, i32 %src) {
824  %result = call i32 @llvm.amdgcn.icmp.i32.i32(i32 %src, i32 100, i32 32)
825  store i32 %result, i32 addrspace(1)* %out
826  ret void
827}
828
829; GCN-LABEL: {{^}}test_wqm_vote:
830; GFX1032: v_cmp_neq_f32_e32 vcc_lo, 0
831; GFX1032: s_wqm_b32 [[WQM:s[0-9]+]], vcc_lo
832; GFX1032: s_and_b32 exec_lo, exec_lo, [[WQM]]
833; GFX1064: v_cmp_neq_f32_e32 vcc, 0
834; GFX1064: s_wqm_b64 [[WQM:s\[[0-9:]+\]]], vcc{{$}}
835; GFX1064: s_and_b64 exec, exec, [[WQM]]
836define amdgpu_ps void @test_wqm_vote(float %a) {
837  %c1 = fcmp une float %a, 0.0
838  %c2 = call i1 @llvm.amdgcn.wqm.vote(i1 %c1)
839  call void @llvm.amdgcn.kill(i1 %c2)
840  ret void
841}
842
843; GCN-LABEL: {{^}}test_branch_true:
844; GFX1032: s_mov_b32 vcc_lo, exec_lo
845; GFX1064: s_mov_b64 vcc, exec
846define amdgpu_kernel void @test_branch_true() #2 {
847entry:
848  br i1 true, label %for.end, label %for.body.lr.ph
849
850for.body.lr.ph:                                   ; preds = %entry
851  br label %for.body
852
853for.body:                                         ; preds = %for.body, %for.body.lr.ph
854  br i1 undef, label %for.end, label %for.body
855
856for.end:                                          ; preds = %for.body, %entry
857  ret void
858}
859
860; GCN-LABEL: {{^}}test_ps_live:
861; GFX1032: s_mov_b32 [[C:s[0-9]+]], exec_lo
862; GFX1064: s_mov_b64 [[C:s\[[0-9:]+\]]], exec{{$}}
863; GCN: v_cndmask_b32_e64 v{{[0-9]+}}, 0, 1, [[C]]
864define amdgpu_ps float @test_ps_live() #0 {
865  %live = call i1 @llvm.amdgcn.ps.live()
866  %live.32 = zext i1 %live to i32
867  %r = bitcast i32 %live.32 to float
868  ret float %r
869}
870
871; GCN-LABEL: {{^}}test_vccnz_ifcvt_triangle64:
872; GFX1032: v_cmp_neq_f64_e64 [[C:s[0-9]+]], s[{{[0-9:]+}}], 1.0
873; GFX1032: s_and_b32 vcc_lo, exec_lo, [[C]]
874; GFX1064: v_cmp_neq_f64_e64 [[C:s\[[0-9:]+\]]], s[{{[0-9:]+}}], 1.0
875; GFX1064: s_and_b64 vcc, exec, [[C]]
876define amdgpu_kernel void @test_vccnz_ifcvt_triangle64(double addrspace(1)* %out, double addrspace(1)* %in) #0 {
877entry:
878  %v = load double, double addrspace(1)* %in
879  %cc = fcmp oeq double %v, 1.000000e+00
880  br i1 %cc, label %if, label %endif
881
882if:
883  %u = fadd double %v, %v
884  br label %endif
885
886endif:
887  %r = phi double [ %v, %entry ], [ %u, %if ]
888  store double %r, double addrspace(1)* %out
889  ret void
890}
891
892; GCN-LABEL: {{^}}test_vgprblocks_w32_attr:
893; Test that the wave size can be overridden in function attributes and that the block size is correct as a result
894; GFX10DEFWAVE: ; VGPRBlocks: 1
895define amdgpu_gs float @test_vgprblocks_w32_attr(float %a, float %b, float %c, float %d, float %e,
896                                        float %f, float %g, float %h, float %i, float %j, float %k, float %l) #3 {
897main_body:
898  %s = fadd float %a, %b
899  %s.1 = fadd float %s, %c
900  %s.2 = fadd float %s.1, %d
901  %s.3 = fadd float %s.2, %e
902  %s.4 = fadd float %s.3, %f
903  %s.5 = fadd float %s.4, %g
904  %s.6 = fadd float %s.5, %h
905  %s.7 = fadd float %s.6, %i
906  %s.8 = fadd float %s.7, %j
907  %s.9 = fadd float %s.8, %k
908  %s.10 = fadd float %s.9, %l
909  ret float %s.10
910}
911
912; GCN-LABEL: {{^}}test_vgprblocks_w64_attr:
913; Test that the wave size can be overridden in function attributes and that the block size is correct as a result
914; GFX10DEFWAVE: ; VGPRBlocks: 2
915define amdgpu_gs float @test_vgprblocks_w64_attr(float %a, float %b, float %c, float %d, float %e,
916                                        float %f, float %g, float %h, float %i, float %j, float %k, float %l) #4 {
917main_body:
918  %s = fadd float %a, %b
919  %s.1 = fadd float %s, %c
920  %s.2 = fadd float %s.1, %d
921  %s.3 = fadd float %s.2, %e
922  %s.4 = fadd float %s.3, %f
923  %s.5 = fadd float %s.4, %g
924  %s.6 = fadd float %s.5, %h
925  %s.7 = fadd float %s.6, %i
926  %s.8 = fadd float %s.7, %j
927  %s.9 = fadd float %s.8, %k
928  %s.10 = fadd float %s.9, %l
929  ret float %s.10
930}
931
932; GCN-LABEL: {{^}}icmp64:
933; GFX1032: v_cmp_eq_u32_e32 vcc_lo, 0, v
934; GFX1064: v_cmp_eq_u32_e32 vcc, 0, v
935define amdgpu_kernel void @icmp64(i32 %n, i32 %s) {
936entry:
937  %id = tail call i32 @llvm.amdgcn.workitem.id.x()
938  %mul4 = mul nsw i32 %s, %n
939  %cmp = icmp slt i32 0, %mul4
940  br label %if.end
941
942if.end:                                           ; preds = %entry
943  %rem = urem i32 %id, %s
944  %icmp = tail call i64 @llvm.amdgcn.icmp.i64.i32(i32 %rem, i32 0, i32 32)
945  %shr = lshr i64 %icmp, 1
946  %notmask = shl nsw i64 -1, 0
947  %and = and i64 %notmask, %shr
948  %or = or i64 %and, -9223372036854775808
949  %cttz = tail call i64 @llvm.cttz.i64(i64 %or, i1 true)
950  %cast = trunc i64 %cttz to i32
951  %cmp3 = icmp ugt i32 10, %cast
952  %cmp6 = icmp ne i32 %rem, 0
953  %brmerge = or i1 %cmp6, %cmp3
954  br i1 %brmerge, label %if.end2, label %if.then
955
956if.then:                                          ; preds = %if.end
957  unreachable
958
959if.end2:                                          ; preds = %if.end
960  ret void
961}
962
963; GCN-LABEL: {{^}}fcmp64:
964; GFX1032: v_cmp_eq_f32_e32 vcc_lo, 0, v
965; GFX1064: v_cmp_eq_f32_e32 vcc, 0, v
966define amdgpu_kernel void @fcmp64(float %n, float %s) {
967entry:
968  %id = tail call i32 @llvm.amdgcn.workitem.id.x()
969  %id.f = uitofp i32 %id to float
970  %mul4 = fmul float %s, %n
971  %cmp = fcmp ult float 0.0, %mul4
972  br label %if.end
973
974if.end:                                           ; preds = %entry
975  %rem.f = frem float %id.f, %s
976  %fcmp = tail call i64 @llvm.amdgcn.fcmp.i64.f32(float %rem.f, float 0.0, i32 1)
977  %shr = lshr i64 %fcmp, 1
978  %notmask = shl nsw i64 -1, 0
979  %and = and i64 %notmask, %shr
980  %or = or i64 %and, -9223372036854775808
981  %cttz = tail call i64 @llvm.cttz.i64(i64 %or, i1 true)
982  %cast = trunc i64 %cttz to i32
983  %cmp3 = icmp ugt i32 10, %cast
984  %cmp6 = fcmp one float %rem.f, 0.0
985  %brmerge = or i1 %cmp6, %cmp3
986  br i1 %brmerge, label %if.end2, label %if.then
987
988if.then:                                          ; preds = %if.end
989  unreachable
990
991if.end2:                                          ; preds = %if.end
992  ret void
993}
994
995; GCN-LABEL: {{^}}icmp32:
996; GFX1032: v_cmp_eq_u32_e32 vcc_lo, 0, v
997; GFX1064: v_cmp_eq_u32_e32 vcc, 0, v
998define amdgpu_kernel void @icmp32(i32 %n, i32 %s) {
999entry:
1000  %id = tail call i32 @llvm.amdgcn.workitem.id.x()
1001  %mul4 = mul nsw i32 %s, %n
1002  %cmp = icmp slt i32 0, %mul4
1003  br label %if.end
1004
1005if.end:                                           ; preds = %entry
1006  %rem = urem i32 %id, %s
1007  %icmp = tail call i32 @llvm.amdgcn.icmp.i32.i32(i32 %rem, i32 0, i32 32)
1008  %shr = lshr i32 %icmp, 1
1009  %notmask = shl nsw i32 -1, 0
1010  %and = and i32 %notmask, %shr
1011  %or = or i32 %and, 2147483648
1012  %cttz = tail call i32 @llvm.cttz.i32(i32 %or, i1 true)
1013  %cmp3 = icmp ugt i32 10, %cttz
1014  %cmp6 = icmp ne i32 %rem, 0
1015  %brmerge = or i1 %cmp6, %cmp3
1016  br i1 %brmerge, label %if.end2, label %if.then
1017
1018if.then:                                          ; preds = %if.end
1019  unreachable
1020
1021if.end2:                                          ; preds = %if.end
1022  ret void
1023}
1024
1025; GCN-LABEL: {{^}}fcmp32:
1026; GFX1032: v_cmp_eq_f32_e32 vcc_lo, 0, v
1027; GFX1064: v_cmp_eq_f32_e32 vcc, 0, v
1028define amdgpu_kernel void @fcmp32(float %n, float %s) {
1029entry:
1030  %id = tail call i32 @llvm.amdgcn.workitem.id.x()
1031  %id.f = uitofp i32 %id to float
1032  %mul4 = fmul float %s, %n
1033  %cmp = fcmp ult float 0.0, %mul4
1034  br label %if.end
1035
1036if.end:                                           ; preds = %entry
1037  %rem.f = frem float %id.f, %s
1038  %fcmp = tail call i32 @llvm.amdgcn.fcmp.i32.f32(float %rem.f, float 0.0, i32 1)
1039  %shr = lshr i32 %fcmp, 1
1040  %notmask = shl nsw i32 -1, 0
1041  %and = and i32 %notmask, %shr
1042  %or = or i32 %and, 2147483648
1043  %cttz = tail call i32 @llvm.cttz.i32(i32 %or, i1 true)
1044  %cmp3 = icmp ugt i32 10, %cttz
1045  %cmp6 = fcmp one float %rem.f, 0.0
1046  %brmerge = or i1 %cmp6, %cmp3
1047  br i1 %brmerge, label %if.end2, label %if.then
1048
1049if.then:                                          ; preds = %if.end
1050  unreachable
1051
1052if.end2:                                          ; preds = %if.end
1053  ret void
1054}
1055
1056declare void @external_void_func_void() #1
1057
1058; Test save/restore of VGPR needed for SGPR spilling.
1059
1060; GCN-LABEL: {{^}}callee_no_stack_with_call:
1061; GCN: s_waitcnt
1062; GCN-NEXT: s_waitcnt_vscnt
1063
1064; GFX1064-NEXT: s_or_saveexec_b64 [[COPY_EXEC0:s\[[0-9]+:[0-9]+\]]], -1{{$}}
1065; GFX1032-NEXT: s_or_saveexec_b32 [[COPY_EXEC0:s[0-9]]], -1{{$}}
1066; GCN-NEXT: buffer_store_dword v40, off, s[0:3], s32 ; 4-byte Folded Spill
1067; GCN-NEXT: s_waitcnt_depctr 0xffe3
1068; GFX1064-NEXT: s_mov_b64 exec, [[COPY_EXEC0]]
1069; GFX1032-NEXT: s_mov_b32 exec_lo, [[COPY_EXEC0]]
1070
1071; GCN-NEXT: v_writelane_b32 v40, s33, 2
1072; GCN: s_mov_b32 s33, s32
1073; GFX1064: s_add_u32 s32, s32, 0x400
1074; GFX1032: s_add_u32 s32, s32, 0x200
1075
1076
1077; GCN-DAG: v_writelane_b32 v40, s30, 0
1078; GCN-DAG: v_writelane_b32 v40, s31, 1
1079; GCN: s_swappc_b64
1080; GCN-DAG: v_readlane_b32 s4, v40, 0
1081; GCN-DAG: v_readlane_b32 s5, v40, 1
1082
1083
1084; GFX1064: s_sub_u32 s32, s32, 0x400
1085; GFX1032: s_sub_u32 s32, s32, 0x200
1086; GCN: v_readlane_b32 s33, v40, 2
1087; GFX1064: s_or_saveexec_b64 [[COPY_EXEC1:s\[[0-9]+:[0-9]+\]]], -1{{$}}
1088; GFX1032: s_or_saveexec_b32 [[COPY_EXEC1:s[0-9]]], -1{{$}}
1089; GCN-NEXT: buffer_load_dword v40, off, s[0:3], s32 ; 4-byte Folded Reload
1090; GCN-NEXT: s_waitcnt_depctr 0xffe3
1091; GFX1064-NEXT: s_mov_b64 exec, [[COPY_EXEC1]]
1092; GFX1032-NEXT: s_mov_b32 exec_lo, [[COPY_EXEC1]]
1093; GCN-NEXT: s_waitcnt vmcnt(0)
1094; GCN-NEXT: s_setpc_b64
1095define void @callee_no_stack_with_call() #1 {
1096  call void @external_void_func_void()
1097  ret void
1098}
1099
1100
1101declare i32 @llvm.amdgcn.workitem.id.x()
1102declare float @llvm.fabs.f32(float)
1103declare { float, i1 } @llvm.amdgcn.div.scale.f32(float, float, i1)
1104declare { double, i1 } @llvm.amdgcn.div.scale.f64(double, double, i1)
1105declare float @llvm.amdgcn.div.fmas.f32(float, float, float, i1)
1106declare double @llvm.amdgcn.div.fmas.f64(double, double, double, i1)
1107declare i1 @llvm.amdgcn.class.f32(float, i32)
1108declare i32 @llvm.amdgcn.set.inactive.i32(i32, i32)
1109declare i64 @llvm.amdgcn.set.inactive.i64(i64, i64)
1110declare <4 x float> @llvm.amdgcn.image.sample.1d.v4f32.f32(i32, float, <8 x i32>, <4 x i32>, i1, i32, i32)
1111declare <4 x float> @llvm.amdgcn.image.sample.2d.v4f32.f32(i32, float, float, <8 x i32>, <4 x i32>, i1, i32, i32)
1112declare float @llvm.amdgcn.wwm.f32(float)
1113declare i32 @llvm.amdgcn.wqm.i32(i32)
1114declare float @llvm.amdgcn.interp.p1(float, i32, i32, i32)
1115declare float @llvm.amdgcn.interp.p2(float, float, i32, i32, i32)
1116declare float @llvm.amdgcn.struct.buffer.load.f32(<4 x i32>, i32, i32, i32, i32 immarg)
1117declare i32 @llvm.amdgcn.mbcnt.lo(i32, i32)
1118declare i32 @llvm.amdgcn.mbcnt.hi(i32, i32)
1119declare i64 @llvm.amdgcn.fcmp.i64.f32(float, float, i32)
1120declare i64 @llvm.amdgcn.icmp.i64.i32(i32, i32, i32)
1121declare i32 @llvm.amdgcn.fcmp.i32.f32(float, float, i32)
1122declare i32 @llvm.amdgcn.icmp.i32.i32(i32, i32, i32)
1123declare void @llvm.amdgcn.kill(i1)
1124declare i1 @llvm.amdgcn.wqm.vote(i1)
1125declare i1 @llvm.amdgcn.ps.live()
1126declare i64 @llvm.cttz.i64(i64, i1)
1127declare i32 @llvm.cttz.i32(i32, i1)
1128
1129attributes #0 = { nounwind readnone speculatable }
1130attributes #1 = { nounwind }
1131attributes #2 = { nounwind readnone optnone noinline }
1132attributes #3 = { "target-features"="+wavefrontsize32" }
1133attributes #4 = { "target-features"="+wavefrontsize64" }
1134