1 ; RUN: llc -O0 -march=amdgcn -mcpu=gfx900 -amdgpu-dpp-combine=false -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9,GFX9-O0 %s
2 ; RUN: llc -march=amdgcn -mcpu=gfx900 -amdgpu-dpp-combine=false -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9,GFX9-O3 %s
4 ; NOTE: llvm.amdgcn.wwm is deprecated, use llvm.amdgcn.strict.wwm instead.
6 ; GFX9-LABEL: {{^}}no_cfg:
7 define amdgpu_cs void @no_cfg(ptr addrspace(8) inreg %tmp14) {
8 %tmp100 = call <2 x float> @llvm.amdgcn.raw.ptr.buffer.load.v2f32(ptr addrspace(8) %tmp14, i32 0, i32 0, i32 0)
9 %tmp101 = bitcast <2 x float> %tmp100 to <2 x i32>
10 %tmp102 = extractelement <2 x i32> %tmp101, i32 0
11 %tmp103 = extractelement <2 x i32> %tmp101, i32 1
12 %tmp105 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 %tmp102, i32 0)
13 %tmp107 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 %tmp103, i32 0)
15 ; GFX9: s_or_saveexec_b64 s[{{[0-9]+}}:{{[0-9]+}}], -1
17 ; GFX9-DAG: v_mov_b32_dpp v[[FIRST_MOV:[0-9]+]], v{{[0-9]+}} row_bcast:31 row_mask:0xc bank_mask:0xf
18 ; GFX9-O3-DAG: v_add_u32_e32 v[[FIRST_ADD:[0-9]+]], v{{[0-9]+}}, v[[FIRST_MOV]]
19 ; GFX9-O0-DAG: v_add_u32_e64 v[[FIRST_ADD:[0-9]+]], v{{[0-9]+}}, v[[FIRST_MOV]]
20 ; GFX9-DAG: v_mov_b32_e32 v[[FIRST:[0-9]+]], v[[FIRST_ADD]]
21 %tmp120 = tail call i32 @llvm.amdgcn.update.dpp.i32(i32 0, i32 %tmp105, i32 323, i32 12, i32 15, i1 false)
22 %tmp121 = add i32 %tmp105, %tmp120
23 %tmp122 = tail call i32 @llvm.amdgcn.wwm.i32(i32 %tmp121)
25 ; GFX9-DAG: v_mov_b32_dpp v[[SECOND_MOV:[0-9]+]], v{{[0-9]+}} row_bcast:31 row_mask:0xc bank_mask:0xf
26 ; GFX9-O3-DAG: v_add_u32_e32 v[[SECOND_ADD:[0-9]+]], v{{[0-9]+}}, v[[SECOND_MOV]]
27 ; GFX9-O0-DAG: v_add_u32_e64 v[[SECOND_ADD:[0-9]+]], v{{[0-9]+}}, v[[SECOND_MOV]]
28 ; GFX9-DAG: v_mov_b32_e32 v[[SECOND:[0-9]+]], v[[SECOND_ADD]]
29 %tmp135 = tail call i32 @llvm.amdgcn.update.dpp.i32(i32 0, i32 %tmp107, i32 323, i32 12, i32 15, i1 false)
30 %tmp136 = add i32 %tmp107, %tmp135
31 %tmp137 = tail call i32 @llvm.amdgcn.wwm.i32(i32 %tmp136)
33 ; GFX9-O3: v_cmp_eq_u32_e32 vcc, v[[FIRST]], v[[SECOND]]
34 ; GFX9-O0: v_cmp_eq_u32_e64 s[{{[0-9]+}}:{{[0-9]+}}], v[[FIRST]], v[[SECOND]]
35 %tmp138 = icmp eq i32 %tmp122, %tmp137
36 %tmp139 = sext i1 %tmp138 to i32
37 %tmp140 = shl nsw i32 %tmp139, 1
38 %tmp141 = and i32 %tmp140, 2
39 %tmp145 = bitcast i32 %tmp141 to float
40 call void @llvm.amdgcn.raw.ptr.buffer.store.f32(float %tmp145, ptr addrspace(8) %tmp14, i32 4, i32 0, i32 0)
44 ; GFX9-LABEL: {{^}}cfg:
45 define amdgpu_cs void @cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) {
47 %tmp100 = call <2 x float> @llvm.amdgcn.raw.ptr.buffer.load.v2f32(ptr addrspace(8) %tmp14, i32 0, i32 0, i32 0)
48 %tmp101 = bitcast <2 x float> %tmp100 to <2 x i32>
49 %tmp102 = extractelement <2 x i32> %tmp101, i32 0
50 %tmp105 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 %tmp102, i32 0)
52 ; GFX9: v_mov_b32_dpp v[[FIRST_MOV:[0-9]+]], v{{[0-9]+}} row_bcast:31 row_mask:0xc bank_mask:0xf
53 ; GFX9-O3: v_add_u32_e32 v[[FIRST_ADD:[0-9]+]], v{{[0-9]+}}, v[[FIRST_MOV]]
54 ; GFX9-O0: v_add_u32_e64 v[[FIRST_ADD:[0-9]+]], v{{[0-9]+}}, v[[FIRST_MOV]]
55 ; GFX9: v_mov_b32_e32 v[[FIRST:[0-9]+]], v[[FIRST_ADD]]
56 ; GFX9-O0: buffer_store_dword v[[FIRST]], off, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:[[FIRST_IMM_OFFSET:[0-9]+]]
57 %tmp120 = tail call i32 @llvm.amdgcn.update.dpp.i32(i32 0, i32 %tmp105, i32 323, i32 12, i32 15, i1 false)
58 %tmp121 = add i32 %tmp105, %tmp120
59 %tmp122 = tail call i32 @llvm.amdgcn.wwm.i32(i32 %tmp121)
61 %cond = icmp eq i32 %arg, 0
62 br i1 %cond, label %if, label %merge
64 %tmp103 = extractelement <2 x i32> %tmp101, i32 1
65 %tmp107 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 %tmp103, i32 0)
67 ; GFX9: v_mov_b32_dpp v[[SECOND_MOV:[0-9]+]], v{{[0-9]+}} row_bcast:31 row_mask:0xc bank_mask:0xf
68 ; GFX9-O3: v_add_u32_e32 v[[SECOND_ADD:[0-9]+]], v{{[0-9]+}}, v[[SECOND_MOV]]
69 ; GFX9-O0: v_add_u32_e64 v[[SECOND_ADD:[0-9]+]], v{{[0-9]+}}, v[[SECOND_MOV]]
70 ; GFX9: v_mov_b32_e32 v[[SECOND:[0-9]+]], v[[SECOND_ADD]]
71 ; GFX9-O0: buffer_store_dword v[[SECOND]], off, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:[[SECOND_IMM_OFFSET:[0-9]+]]
72 %tmp135 = tail call i32 @llvm.amdgcn.update.dpp.i32(i32 0, i32 %tmp107, i32 323, i32 12, i32 15, i1 false)
73 %tmp136 = add i32 %tmp107, %tmp135
74 %tmp137 = tail call i32 @llvm.amdgcn.wwm.i32(i32 %tmp136)
78 %merge_value = phi i32 [ 0, %entry ], [%tmp137, %if ]
79 ; GFX9-O3: v_cmp_eq_u32_e32 vcc, v[[FIRST]], v[[SECOND]]
80 ; GFX9-O0: buffer_load_dword v[[FIRST:[0-9]+]], off, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:[[FIRST_IMM_OFFSET]]
81 ; GFX9-O0: buffer_load_dword v[[SECOND:[0-9]+]], off, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:[[SECOND_IMM_OFFSET]]
82 ; GFX9-O0: v_cmp_eq_u32_e64 s[{{[0-9]+}}:{{[0-9]+}}], v[[FIRST]], v[[SECOND]]
83 %tmp138 = icmp eq i32 %tmp122, %merge_value
84 %tmp139 = sext i1 %tmp138 to i32
85 %tmp140 = shl nsw i32 %tmp139, 1
86 %tmp141 = and i32 %tmp140, 2
87 %tmp145 = bitcast i32 %tmp141 to float
88 call void @llvm.amdgcn.raw.ptr.buffer.store.f32(float %tmp145, ptr addrspace(8) %tmp14, i32 4, i32 0, i32 0)
92 ; GFX9-LABEL: {{^}}called:
93 define hidden i32 @called(i32 %a) noinline {
94 ; GFX9-O3: v_add_u32_e32 v1, v0, v0
95 ; GFX9-O0: v_add_u32_e64 v1, v0, v0
97 ; GFX9: v_mul_lo_u32 v0, v1, v0
98 %mul = mul i32 %add, %a
99 ; GFX9-O3: v_sub_u32_e32 v0, v0, v1
100 ; GFX9-O0: v_sub_u32_e64 v0, v0, v1
101 %sub = sub i32 %mul, %add
105 ; GFX9-LABEL: {{^}}call:
106 define amdgpu_kernel void @call(ptr addrspace(8) inreg %tmp14, i32 inreg %arg) {
107 ; GFX9-DAG: s_load_dword [[ARG:s[0-9]+]]
108 ; GFX9-O0-DAG: s_mov_b32 s3, 0{{$}}
109 ; GFX9-O0-DAG: v_mov_b32_e32 v{{[0-9]+}}, [[ARG]]
111 ; GFX9-O3: v_mov_b32_e32 v2, [[ARG]]
113 ; GFX9-NEXT: s_not_b64 exec, exec
114 ; GFX9-O0-NEXT: v_mov_b32_e32 v6, s3
115 ; GFX9-O3-NEXT: v_mov_b32_e32 v2, 0
116 ; GFX9-NEXT: s_not_b64 exec, exec
117 %tmp107 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 %arg, i32 0)
118 ; GFX9-O0: v_mov_b32_e32 v0, v6
119 ; GFX9-O3: v_mov_b32_e32 v0, v2
121 %tmp134 = call i32 @called(i32 %tmp107)
122 ; GFX9-O3: v_mov_b32_e32 v1, v0
123 ; GFX9-O3: v_add_u32_e32 v1, v1, v2
124 ; GFX9-O0: v_mov_b32_e32 v3, v0
125 ; GFX9-O0: v_add_u32_e64 v3, v3, v6
126 %tmp136 = add i32 %tmp134, %tmp107
127 %tmp137 = tail call i32 @llvm.amdgcn.wwm.i32(i32 %tmp136)
128 ; GFX9-O0: buffer_store_dword v1
129 ; GFX9-O3: buffer_store_dword v0
130 call void @llvm.amdgcn.raw.ptr.buffer.store.i32(i32 %tmp137, ptr addrspace(8) %tmp14, i32 4, i32 0, i32 0)
134 ; GFX9-LABEL: {{^}}called_i64:
135 define i64 @called_i64(i64 %a) noinline {
136 %add = add i64 %a, %a
137 %mul = mul i64 %add, %a
138 %sub = sub i64 %mul, %add
142 ; GFX9-LABEL: {{^}}call_i64:
143 define amdgpu_kernel void @call_i64(ptr addrspace(8) inreg %tmp14, i64 inreg %arg) {
144 ; GFX9: s_load_dwordx2 s[[[ARG_LO:[0-9]+]]:[[ARG_HI:[0-9]+]]]{{.*}}, 0x34
146 ; GFX9-O0: s_mov_b64 s[[[ZERO_LO:[0-9]+]]:[[ZERO_HI:[0-9]+]]], 0{{$}}
147 ; GFX9-O0-DAG: v_mov_b32_e32 v9, s[[ARG_HI]]
148 ; GFX9-O0-DAG: v_mov_b32_e32 v8, s[[ARG_LO]]
150 ; GFX9-O3-DAG: v_mov_b32_e32 v7, s[[ARG_HI]]
151 ; GFX9-O3-DAG: v_mov_b32_e32 v6, s[[ARG_LO]]
153 ; GFX9: s_not_b64 exec, exec
154 ; GFX9-O0-NEXT: v_mov_b32_e32 v8, s[[ZERO_LO]]
155 ; GFX9-O0-NEXT: v_mov_b32_e32 v9, s[[ZERO_HI]]
156 ; GFX9-O3-NEXT: v_mov_b32_e32 v6, 0
157 ; GFX9-O3-NEXT: v_mov_b32_e32 v7, 0
158 ; GFX9-NEXT: s_not_b64 exec, exec
159 %tmp107 = tail call i64 @llvm.amdgcn.set.inactive.i64(i64 %arg, i64 0)
161 %tmp134 = call i64 @called_i64(i64 %tmp107)
162 %tmp136 = add i64 %tmp134, %tmp107
163 %tmp137 = tail call i64 @llvm.amdgcn.wwm.i64(i64 %tmp136)
164 %tmp138 = bitcast i64 %tmp137 to <2 x i32>
165 ; GFX9: buffer_store_dwordx2
166 call void @llvm.amdgcn.raw.ptr.buffer.store.v2i32(<2 x i32> %tmp138, ptr addrspace(8) %tmp14, i32 4, i32 0, i32 0)
170 ; GFX9-LABEL: {{^}}_amdgpu_cs_main:
171 define amdgpu_cs void @_amdgpu_cs_main(<4 x i32> inreg %desc, i32 %index) {
172 %tmp17 = shl i32 %index, 5
173 ; GFX9: buffer_load_dwordx4
174 %tmp18 = tail call <4 x i32> @llvm.amdgcn.s.buffer.load.v4i32(<4 x i32> %desc, i32 %tmp17, i32 0)
175 %.i0.upto1.bc = bitcast <4 x i32> %tmp18 to <2 x i64>
176 %tmp19 = or i32 %tmp17, 16
177 ; GFX9: buffer_load_dwordx2
178 %tmp20 = tail call <2 x i32> @llvm.amdgcn.s.buffer.load.v2i32(<4 x i32> %desc, i32 %tmp19, i32 0)
179 %.i0.upto1.extract = extractelement <2 x i64> %.i0.upto1.bc, i32 0
180 %tmp22 = tail call i64 @llvm.amdgcn.set.inactive.i64(i64 %.i0.upto1.extract, i64 9223372036854775807)
181 %tmp97 = tail call i64 @llvm.amdgcn.wwm.i64(i64 %tmp22)
182 %.i1.upto1.extract = extractelement <2 x i64> %.i0.upto1.bc, i32 1
183 %tmp99 = tail call i64 @llvm.amdgcn.set.inactive.i64(i64 %.i1.upto1.extract, i64 9223372036854775807)
184 %tmp174 = tail call i64 @llvm.amdgcn.wwm.i64(i64 %tmp99)
185 %.i25 = bitcast <2 x i32> %tmp20 to i64
186 %tmp176 = tail call i64 @llvm.amdgcn.set.inactive.i64(i64 %.i25, i64 9223372036854775807)
187 %tmp251 = tail call i64 @llvm.amdgcn.wwm.i64(i64 %tmp176)
188 %.cast = bitcast i64 %tmp97 to <2 x float>
189 %.cast6 = bitcast i64 %tmp174 to <2 x float>
190 %.cast7 = bitcast i64 %tmp251 to <2 x float>
191 %tmp254 = shufflevector <2 x float> %.cast, <2 x float> %.cast6, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
192 %desc.int = bitcast <4 x i32> %desc to i128
193 %desc.ptr = inttoptr i128 %desc.int to ptr addrspace(8)
194 ; GFX9: buffer_store_dwordx4
195 tail call void @llvm.amdgcn.raw.ptr.buffer.store.v4f32(<4 x float> %tmp254, ptr addrspace(8) %desc.ptr, i32 %tmp17, i32 0, i32 0)
196 ; GFX9: buffer_store_dwordx2
197 tail call void @llvm.amdgcn.raw.ptr.buffer.store.v2f32(<2 x float> %.cast7, ptr addrspace(8) %desc.ptr, i32 %tmp19, i32 0, i32 0)
202 ; GFX9-LABEL: {{^}}strict_wwm_no_cfg:
203 define amdgpu_cs void @strict_wwm_no_cfg(ptr addrspace(8) inreg %tmp14) {
204 %tmp100 = call <2 x float> @llvm.amdgcn.raw.ptr.buffer.load.v2f32(ptr addrspace(8) %tmp14, i32 0, i32 0, i32 0)
205 %tmp101 = bitcast <2 x float> %tmp100 to <2 x i32>
206 %tmp102 = extractelement <2 x i32> %tmp101, i32 0
207 %tmp103 = extractelement <2 x i32> %tmp101, i32 1
208 %tmp105 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 %tmp102, i32 0)
209 %tmp107 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 %tmp103, i32 0)
211 ; GFX9: s_or_saveexec_b64 s[{{[0-9]+}}:{{[0-9]+}}], -1
213 ; GFX9-DAG: v_mov_b32_dpp v[[FIRST_MOV:[0-9]+]], v{{[0-9]+}} row_bcast:31 row_mask:0xc bank_mask:0xf
214 ; GFX9-O3-DAG: v_add_u32_e32 v[[FIRST_ADD:[0-9]+]], v{{[0-9]+}}, v[[FIRST_MOV]]
215 ; GFX9-O0-DAG: v_add_u32_e64 v[[FIRST_ADD:[0-9]+]], v{{[0-9]+}}, v[[FIRST_MOV]]
216 ; GFX9-DAG: v_mov_b32_e32 v[[FIRST:[0-9]+]], v[[FIRST_ADD]]
217 %tmp120 = tail call i32 @llvm.amdgcn.update.dpp.i32(i32 0, i32 %tmp105, i32 323, i32 12, i32 15, i1 false)
218 %tmp121 = add i32 %tmp105, %tmp120
219 %tmp122 = tail call i32 @llvm.amdgcn.strict.wwm.i32(i32 %tmp121)
221 ; GFX9-DAG: v_mov_b32_dpp v[[SECOND_MOV:[0-9]+]], v{{[0-9]+}} row_bcast:31 row_mask:0xc bank_mask:0xf
222 ; GFX9-O3-DAG: v_add_u32_e32 v[[SECOND_ADD:[0-9]+]], v{{[0-9]+}}, v[[SECOND_MOV]]
223 ; GFX9-O0-DAG: v_add_u32_e64 v[[SECOND_ADD:[0-9]+]], v{{[0-9]+}}, v[[SECOND_MOV]]
224 ; GFX9-DAG: v_mov_b32_e32 v[[SECOND:[0-9]+]], v[[SECOND_ADD]]
225 %tmp135 = tail call i32 @llvm.amdgcn.update.dpp.i32(i32 0, i32 %tmp107, i32 323, i32 12, i32 15, i1 false)
226 %tmp136 = add i32 %tmp107, %tmp135
227 %tmp137 = tail call i32 @llvm.amdgcn.strict.wwm.i32(i32 %tmp136)
229 ; GFX9-O3: v_cmp_eq_u32_e32 vcc, v[[FIRST]], v[[SECOND]]
230 ; GFX9-O0: v_cmp_eq_u32_e64 s[{{[0-9]+}}:{{[0-9]+}}], v[[FIRST]], v[[SECOND]]
231 %tmp138 = icmp eq i32 %tmp122, %tmp137
232 %tmp139 = sext i1 %tmp138 to i32
233 %tmp140 = shl nsw i32 %tmp139, 1
234 %tmp141 = and i32 %tmp140, 2
235 %tmp145 = bitcast i32 %tmp141 to float
236 call void @llvm.amdgcn.raw.ptr.buffer.store.f32(float %tmp145, ptr addrspace(8) %tmp14, i32 4, i32 0, i32 0)
240 ; GFX9-LABEL: {{^}}strict_wwm_cfg:
241 define amdgpu_cs void @strict_wwm_cfg(ptr addrspace(8) inreg %tmp14, i32 %arg) {
243 %tmp100 = call <2 x float> @llvm.amdgcn.raw.ptr.buffer.load.v2f32(ptr addrspace(8) %tmp14, i32 0, i32 0, i32 0)
244 %tmp101 = bitcast <2 x float> %tmp100 to <2 x i32>
245 %tmp102 = extractelement <2 x i32> %tmp101, i32 0
246 %tmp105 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 %tmp102, i32 0)
248 ; GFX9: v_mov_b32_dpp v[[FIRST_MOV:[0-9]+]], v{{[0-9]+}} row_bcast:31 row_mask:0xc bank_mask:0xf
249 ; GFX9-O3: v_add_u32_e32 v[[FIRST_ADD:[0-9]+]], v{{[0-9]+}}, v[[FIRST_MOV]]
250 ; GFX9-O0: v_add_u32_e64 v[[FIRST_ADD:[0-9]+]], v{{[0-9]+}}, v[[FIRST_MOV]]
251 ; GFX9: v_mov_b32_e32 v[[FIRST:[0-9]+]], v[[FIRST_ADD]]
252 ; GFX9-O0: buffer_store_dword v[[FIRST]], off, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:[[FIRST_IMM_OFFSET:[0-9]+]]
253 %tmp120 = tail call i32 @llvm.amdgcn.update.dpp.i32(i32 0, i32 %tmp105, i32 323, i32 12, i32 15, i1 false)
254 %tmp121 = add i32 %tmp105, %tmp120
255 %tmp122 = tail call i32 @llvm.amdgcn.strict.wwm.i32(i32 %tmp121)
257 %cond = icmp eq i32 %arg, 0
258 br i1 %cond, label %if, label %merge
260 %tmp103 = extractelement <2 x i32> %tmp101, i32 1
261 %tmp107 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 %tmp103, i32 0)
263 ; GFX9: v_mov_b32_dpp v[[SECOND_MOV:[0-9]+]], v{{[0-9]+}} row_bcast:31 row_mask:0xc bank_mask:0xf
264 ; GFX9-O3: v_add_u32_e32 v[[SECOND_ADD:[0-9]+]], v{{[0-9]+}}, v[[SECOND_MOV]]
265 ; GFX9-O0: v_add_u32_e64 v[[SECOND_ADD:[0-9]+]], v{{[0-9]+}}, v[[SECOND_MOV]]
266 ; GFX9: v_mov_b32_e32 v[[SECOND:[0-9]+]], v[[SECOND_ADD]]
267 ; GFX9-O0: buffer_store_dword v[[SECOND]], off, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:[[SECOND_IMM_OFFSET:[0-9]+]]
268 %tmp135 = tail call i32 @llvm.amdgcn.update.dpp.i32(i32 0, i32 %tmp107, i32 323, i32 12, i32 15, i1 false)
269 %tmp136 = add i32 %tmp107, %tmp135
270 %tmp137 = tail call i32 @llvm.amdgcn.strict.wwm.i32(i32 %tmp136)
274 %merge_value = phi i32 [ 0, %entry ], [%tmp137, %if ]
275 ; GFX9-O3: v_cmp_eq_u32_e32 vcc, v[[FIRST]], v[[SECOND]]
276 ; GFX9-O0: buffer_load_dword v[[FIRST:[0-9]+]], off, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:[[FIRST_IMM_OFFSET]]
277 ; GFX9-O0: buffer_load_dword v[[SECOND:[0-9]+]], off, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:[[SECOND_IMM_OFFSET]]
278 ; GFX9-O0: v_cmp_eq_u32_e64 s[{{[0-9]+}}:{{[0-9]+}}], v[[FIRST]], v[[SECOND]]
279 %tmp138 = icmp eq i32 %tmp122, %merge_value
280 %tmp139 = sext i1 %tmp138 to i32
281 %tmp140 = shl nsw i32 %tmp139, 1
282 %tmp141 = and i32 %tmp140, 2
283 %tmp145 = bitcast i32 %tmp141 to float
284 call void @llvm.amdgcn.raw.ptr.buffer.store.f32(float %tmp145, ptr addrspace(8) %tmp14, i32 4, i32 0, i32 0)
288 ; GFX9-LABEL: {{^}}strict_wwm_called:
289 define hidden i32 @strict_wwm_called(i32 %a) noinline {
290 ; GFX9-O3: v_add_u32_e32 v1, v0, v0
291 ; GFX9-O0: v_add_u32_e64 v1, v0, v0
292 %add = add i32 %a, %a
293 ; GFX9: v_mul_lo_u32 v0, v1, v0
294 %mul = mul i32 %add, %a
295 ; GFX9-O3: v_sub_u32_e32 v0, v0, v1
296 ; GFX9-O0: v_sub_u32_e64 v0, v0, v1
297 %sub = sub i32 %mul, %add
301 ; GFX9-LABEL: {{^}}strict_wwm_call:
302 define amdgpu_kernel void @strict_wwm_call(ptr addrspace(8) inreg %tmp14, i32 inreg %arg) {
303 ; GFX9-DAG: s_load_dword [[ARG:s[0-9]+]]
304 ; GFX9-O0-DAG: s_mov_b32 s3, 0{{$}}
305 ; GFX9-O0-DAG: v_mov_b32_e32 v6, [[ARG]]
307 ; GFX9-O3: v_mov_b32_e32 v2, [[ARG]]
309 ; GFX9-NEXT: s_not_b64 exec, exec
310 ; GFX9-O0-NEXT: v_mov_b32_e32 v6, s3
311 ; GFX9-O3-NEXT: v_mov_b32_e32 v2, 0
312 ; GFX9-NEXT: s_not_b64 exec, exec
313 %tmp107 = tail call i32 @llvm.amdgcn.set.inactive.i32(i32 %arg, i32 0)
314 ; GFX9-O3: v_mov_b32_e32 v0, v2
315 ; GFX9-O0: v_mov_b32_e32 v0, v6
317 %tmp134 = call i32 @strict_wwm_called(i32 %tmp107)
318 ; GFX9-O3: v_mov_b32_e32 v1, v0
319 ; GFX9-O3: v_add_u32_e32 v1, v1, v2
320 ; GFX9-O0: v_mov_b32_e32 v3, v0
321 ; GFX9-O0: v_add_u32_e64 v3, v3, v6
322 %tmp136 = add i32 %tmp134, %tmp107
323 %tmp137 = tail call i32 @llvm.amdgcn.strict.wwm.i32(i32 %tmp136)
324 ; GFX9-O0: buffer_store_dword v1
325 ; GFX9-O3: buffer_store_dword v0
326 call void @llvm.amdgcn.raw.ptr.buffer.store.i32(i32 %tmp137, ptr addrspace(8) %tmp14, i32 4, i32 0, i32 0)
330 ; GFX9-LABEL: {{^}}strict_wwm_called_i64:
331 define i64 @strict_wwm_called_i64(i64 %a) noinline {
332 %add = add i64 %a, %a
333 %mul = mul i64 %add, %a
334 %sub = sub i64 %mul, %add
338 ; GFX9-LABEL: {{^}}strict_wwm_call_i64:
339 define amdgpu_kernel void @strict_wwm_call_i64(ptr addrspace(8) inreg %tmp14, i64 inreg %arg) {
340 ; GFX9: s_load_dwordx2 s[[[ARG_LO:[0-9]+]]:[[ARG_HI:[0-9]+]]]{{.*}}, 0x34
342 ; GFX9-O0: s_mov_b64 s[[[ZERO_LO:[0-9]+]]:[[ZERO_HI:[0-9]+]]], 0{{$}}
343 ; GFX9-O0-DAG: v_mov_b32_e32 v9, s[[ARG_HI]]
344 ; GFX9-O0-DAG: v_mov_b32_e32 v8, s[[ARG_LO]]
346 ; GFX9-O3-DAG: v_mov_b32_e32 v7, s[[ARG_HI]]
347 ; GFX9-O3-DAG: v_mov_b32_e32 v6, s[[ARG_LO]]
349 ; GFX9: s_not_b64 exec, exec
350 ; GFX9-O0-NEXT: v_mov_b32_e32 v8, s[[ZERO_LO]]
351 ; GFX9-O0-NEXT: v_mov_b32_e32 v9, s[[ZERO_HI]]
352 ; GFX9-O3-NEXT: v_mov_b32_e32 v6, 0
353 ; GFX9-O3-NEXT: v_mov_b32_e32 v7, 0
354 ; GFX9-NEXT: s_not_b64 exec, exec
355 %tmp107 = tail call i64 @llvm.amdgcn.set.inactive.i64(i64 %arg, i64 0)
357 %tmp134 = call i64 @strict_wwm_called_i64(i64 %tmp107)
358 %tmp136 = add i64 %tmp134, %tmp107
359 %tmp137 = tail call i64 @llvm.amdgcn.strict.wwm.i64(i64 %tmp136)
360 %tmp138 = bitcast i64 %tmp137 to <2 x i32>
361 ; GFX9: buffer_store_dwordx2
362 call void @llvm.amdgcn.raw.ptr.buffer.store.v2i32(<2 x i32> %tmp138, ptr addrspace(8) %tmp14, i32 4, i32 0, i32 0)
366 ; GFX9-LABEL: {{^}}strict_wwm_amdgpu_cs_main:
367 define amdgpu_cs void @strict_wwm_amdgpu_cs_main(<4 x i32> inreg %desc, i32 %index) {
368 %tmp17 = shl i32 %index, 5
369 ; GFX9: buffer_load_dwordx4
370 %tmp18 = tail call <4 x i32> @llvm.amdgcn.s.buffer.load.v4i32(<4 x i32> %desc, i32 %tmp17, i32 0)
371 %.i0.upto1.bc = bitcast <4 x i32> %tmp18 to <2 x i64>
372 %tmp19 = or i32 %tmp17, 16
373 ; GFX9: buffer_load_dwordx2
374 %tmp20 = tail call <2 x i32> @llvm.amdgcn.s.buffer.load.v2i32(<4 x i32> %desc, i32 %tmp19, i32 0)
375 %.i0.upto1.extract = extractelement <2 x i64> %.i0.upto1.bc, i32 0
376 %tmp22 = tail call i64 @llvm.amdgcn.set.inactive.i64(i64 %.i0.upto1.extract, i64 9223372036854775807)
377 %tmp97 = tail call i64 @llvm.amdgcn.strict.wwm.i64(i64 %tmp22)
378 %.i1.upto1.extract = extractelement <2 x i64> %.i0.upto1.bc, i32 1
379 %tmp99 = tail call i64 @llvm.amdgcn.set.inactive.i64(i64 %.i1.upto1.extract, i64 9223372036854775807)
380 %tmp174 = tail call i64 @llvm.amdgcn.strict.wwm.i64(i64 %tmp99)
381 %.i25 = bitcast <2 x i32> %tmp20 to i64
382 %tmp176 = tail call i64 @llvm.amdgcn.set.inactive.i64(i64 %.i25, i64 9223372036854775807)
383 %tmp251 = tail call i64 @llvm.amdgcn.strict.wwm.i64(i64 %tmp176)
384 %.cast = bitcast i64 %tmp97 to <2 x float>
385 %.cast6 = bitcast i64 %tmp174 to <2 x float>
386 %.cast7 = bitcast i64 %tmp251 to <2 x float>
387 %tmp254 = shufflevector <2 x float> %.cast, <2 x float> %.cast6, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
388 ; GFX9: buffer_store_dwordx4
389 %desc.int = bitcast <4 x i32> %desc to i128
390 %desc.ptr = inttoptr i128 %desc.int to ptr addrspace(8)
391 tail call void @llvm.amdgcn.raw.ptr.buffer.store.v4f32(<4 x float> %tmp254, ptr addrspace(8) %desc.ptr, i32 %tmp17, i32 0, i32 0)
392 ; GFX9: buffer_store_dwordx2
393 tail call void @llvm.amdgcn.raw.ptr.buffer.store.v2f32(<2 x float> %.cast7, ptr addrspace(8)%desc.ptr, i32 %tmp19, i32 0, i32 0)
397 declare i32 @llvm.amdgcn.strict.wwm.i32(i32)
398 declare i64 @llvm.amdgcn.strict.wwm.i64(i64)
399 declare i32 @llvm.amdgcn.wwm.i32(i32)
400 declare i64 @llvm.amdgcn.wwm.i64(i64)
401 declare i32 @llvm.amdgcn.set.inactive.i32(i32, i32)
402 declare i64 @llvm.amdgcn.set.inactive.i64(i64, i64)
403 declare i32 @llvm.amdgcn.update.dpp.i32(i32, i32, i32, i32, i32, i1)
404 declare <2 x float> @llvm.amdgcn.raw.ptr.buffer.load.v2f32(ptr addrspace(8), i32, i32, i32)
405 declare void @llvm.amdgcn.raw.ptr.buffer.store.f32(float, ptr addrspace(8), i32, i32, i32)
406 declare void @llvm.amdgcn.raw.ptr.buffer.store.i32(i32, ptr addrspace(8), i32, i32, i32)
407 declare void @llvm.amdgcn.raw.ptr.buffer.store.v2i32(<2 x i32>, ptr addrspace(8), i32, i32, i32)
408 declare void @llvm.amdgcn.raw.ptr.buffer.store.v2f32(<2 x float>, ptr addrspace(8), i32, i32, i32)
409 declare void @llvm.amdgcn.raw.ptr.buffer.store.v4f32(<4 x float>, ptr addrspace(8), i32, i32, i32)
410 declare <2 x i32> @llvm.amdgcn.s.buffer.load.v2i32(<4 x i32>, i32, i32)
411 declare <4 x i32> @llvm.amdgcn.s.buffer.load.v4i32(<4 x i32>, i32, i32)