1 ; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2 ; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -strict-whitespace -check-prefix=CI -check-prefix=FUNC %s
3 ; RUN: llc -march=r600 -mcpu=redwood -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
5 ; FUNC-LABEL: {{^}}lds_atomic_xchg_ret_i32:
7 ; SI: s_load_dword [[SPTR:s[0-9]+]],
8 ; SI: v_mov_b32_e32 [[DATA:v[0-9]+]], 4
9 ; SI: v_mov_b32_e32 [[VPTR:v[0-9]+]], [[SPTR]]
10 ; SI: ds_wrxchg_rtn_b32 [[RESULT:v[0-9]+]], [[VPTR]], [[DATA]] [M0]
11 ; SI: buffer_store_dword [[RESULT]],
13 define void @lds_atomic_xchg_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
14 %result = atomicrmw xchg i32 addrspace(3)* %ptr, i32 4 seq_cst
15 store i32 %result, i32 addrspace(1)* %out, align 4
19 ; FUNC-LABEL: {{^}}lds_atomic_xchg_ret_i32_offset:
20 ; EG: LDS_WRXCHG_RET *
21 ; SI: ds_wrxchg_rtn_b32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
23 define void @lds_atomic_xchg_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
24 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
25 %result = atomicrmw xchg i32 addrspace(3)* %gep, i32 4 seq_cst
26 store i32 %result, i32 addrspace(1)* %out, align 4
30 ; XXX - Is it really necessary to load 4 into VGPR?
31 ; FUNC-LABEL: {{^}}lds_atomic_add_ret_i32:
33 ; SI: s_load_dword [[SPTR:s[0-9]+]],
34 ; SI: v_mov_b32_e32 [[DATA:v[0-9]+]], 4
35 ; SI: v_mov_b32_e32 [[VPTR:v[0-9]+]], [[SPTR]]
36 ; SI: ds_add_rtn_u32 [[RESULT:v[0-9]+]], [[VPTR]], [[DATA]] [M0]
37 ; SI: buffer_store_dword [[RESULT]],
39 define void @lds_atomic_add_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
40 %result = atomicrmw add i32 addrspace(3)* %ptr, i32 4 seq_cst
41 store i32 %result, i32 addrspace(1)* %out, align 4
45 ; FUNC-LABEL: {{^}}lds_atomic_add_ret_i32_offset:
47 ; SI: ds_add_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
49 define void @lds_atomic_add_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
50 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
51 %result = atomicrmw add i32 addrspace(3)* %gep, i32 4 seq_cst
52 store i32 %result, i32 addrspace(1)* %out, align 4
56 ; FUNC-LABEL: {{^}}lds_atomic_add_ret_i32_bad_si_offset:
58 ; SI: ds_add_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} [M0]
59 ; CI: ds_add_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
61 define void @lds_atomic_add_ret_i32_bad_si_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr, i32 %a, i32 %b) nounwind {
63 %add = add i32 %sub, 4
64 %gep = getelementptr i32 addrspace(3)* %ptr, i32 %add
65 %result = atomicrmw add i32 addrspace(3)* %gep, i32 4 seq_cst
66 store i32 %result, i32 addrspace(1)* %out, align 4
70 ; FUNC-LABEL: {{^}}lds_atomic_inc_ret_i32:
72 ; SI: v_mov_b32_e32 [[NEGONE:v[0-9]+]], -1
73 ; SI: ds_inc_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, [[NEGONE]] [M0]
75 define void @lds_atomic_inc_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
76 %result = atomicrmw add i32 addrspace(3)* %ptr, i32 1 seq_cst
77 store i32 %result, i32 addrspace(1)* %out, align 4
81 ; FUNC-LABEL: {{^}}lds_atomic_inc_ret_i32_offset:
83 ; SI: v_mov_b32_e32 [[NEGONE:v[0-9]+]], -1
84 ; SI: ds_inc_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, [[NEGONE]] offset:16
86 define void @lds_atomic_inc_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
87 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
88 %result = atomicrmw add i32 addrspace(3)* %gep, i32 1 seq_cst
89 store i32 %result, i32 addrspace(1)* %out, align 4
93 ; FUNC-LABEL: {{^}}lds_atomic_inc_ret_i32_bad_si_offset:
95 ; SI: ds_inc_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} [M0]
96 ; CI: ds_inc_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
98 define void @lds_atomic_inc_ret_i32_bad_si_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr, i32 %a, i32 %b) nounwind {
100 %add = add i32 %sub, 4
101 %gep = getelementptr i32 addrspace(3)* %ptr, i32 %add
102 %result = atomicrmw add i32 addrspace(3)* %gep, i32 1 seq_cst
103 store i32 %result, i32 addrspace(1)* %out, align 4
107 ; FUNC-LABEL: {{^}}lds_atomic_sub_ret_i32:
111 define void @lds_atomic_sub_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
112 %result = atomicrmw sub i32 addrspace(3)* %ptr, i32 4 seq_cst
113 store i32 %result, i32 addrspace(1)* %out, align 4
117 ; FUNC-LABEL: {{^}}lds_atomic_sub_ret_i32_offset:
119 ; SI: ds_sub_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
121 define void @lds_atomic_sub_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
122 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
123 %result = atomicrmw sub i32 addrspace(3)* %gep, i32 4 seq_cst
124 store i32 %result, i32 addrspace(1)* %out, align 4
128 ; FUNC-LABEL: {{^}}lds_atomic_dec_ret_i32:
130 ; SI: v_mov_b32_e32 [[NEGONE:v[0-9]+]], -1
131 ; SI: ds_dec_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, [[NEGONE]] [M0]
133 define void @lds_atomic_dec_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
134 %result = atomicrmw sub i32 addrspace(3)* %ptr, i32 1 seq_cst
135 store i32 %result, i32 addrspace(1)* %out, align 4
139 ; FUNC-LABEL: {{^}}lds_atomic_dec_ret_i32_offset:
141 ; SI: v_mov_b32_e32 [[NEGONE:v[0-9]+]], -1
142 ; SI: ds_dec_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, [[NEGONE]] offset:16
144 define void @lds_atomic_dec_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
145 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
146 %result = atomicrmw sub i32 addrspace(3)* %gep, i32 1 seq_cst
147 store i32 %result, i32 addrspace(1)* %out, align 4
151 ; FUNC-LABEL: {{^}}lds_atomic_and_ret_i32:
155 define void @lds_atomic_and_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
156 %result = atomicrmw and i32 addrspace(3)* %ptr, i32 4 seq_cst
157 store i32 %result, i32 addrspace(1)* %out, align 4
161 ; FUNC-LABEL: {{^}}lds_atomic_and_ret_i32_offset:
163 ; SI: ds_and_rtn_b32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
165 define void @lds_atomic_and_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
166 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
167 %result = atomicrmw and i32 addrspace(3)* %gep, i32 4 seq_cst
168 store i32 %result, i32 addrspace(1)* %out, align 4
172 ; FUNC-LABEL: {{^}}lds_atomic_or_ret_i32:
176 define void @lds_atomic_or_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
177 %result = atomicrmw or i32 addrspace(3)* %ptr, i32 4 seq_cst
178 store i32 %result, i32 addrspace(1)* %out, align 4
182 ; FUNC-LABEL: {{^}}lds_atomic_or_ret_i32_offset:
184 ; SI: ds_or_rtn_b32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
186 define void @lds_atomic_or_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
187 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
188 %result = atomicrmw or i32 addrspace(3)* %gep, i32 4 seq_cst
189 store i32 %result, i32 addrspace(1)* %out, align 4
193 ; FUNC-LABEL: {{^}}lds_atomic_xor_ret_i32:
197 define void @lds_atomic_xor_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
198 %result = atomicrmw xor i32 addrspace(3)* %ptr, i32 4 seq_cst
199 store i32 %result, i32 addrspace(1)* %out, align 4
203 ; FUNC-LABEL: {{^}}lds_atomic_xor_ret_i32_offset:
205 ; SI: ds_xor_rtn_b32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
207 define void @lds_atomic_xor_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
208 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
209 %result = atomicrmw xor i32 addrspace(3)* %gep, i32 4 seq_cst
210 store i32 %result, i32 addrspace(1)* %out, align 4
214 ; FIXME: There is no atomic nand instr
215 ; XFUNC-LABEL: {{^}}lds_atomic_nand_ret_i32:uction, so we somehow need to expand this.
216 ; define void @lds_atomic_nand_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
217 ; %result = atomicrmw nand i32 addrspace(3)* %ptr, i32 4 seq_cst
218 ; store i32 %result, i32 addrspace(1)* %out, align 4
222 ; FUNC-LABEL: {{^}}lds_atomic_min_ret_i32:
223 ; EG: LDS_MIN_INT_RET *
226 define void @lds_atomic_min_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
227 %result = atomicrmw min i32 addrspace(3)* %ptr, i32 4 seq_cst
228 store i32 %result, i32 addrspace(1)* %out, align 4
232 ; FUNC-LABEL: {{^}}lds_atomic_min_ret_i32_offset:
233 ; EG: LDS_MIN_INT_RET *
234 ; SI: ds_min_rtn_i32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
236 define void @lds_atomic_min_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
237 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
238 %result = atomicrmw min i32 addrspace(3)* %gep, i32 4 seq_cst
239 store i32 %result, i32 addrspace(1)* %out, align 4
243 ; FUNC-LABEL: {{^}}lds_atomic_max_ret_i32:
244 ; EG: LDS_MAX_INT_RET *
247 define void @lds_atomic_max_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
248 %result = atomicrmw max i32 addrspace(3)* %ptr, i32 4 seq_cst
249 store i32 %result, i32 addrspace(1)* %out, align 4
253 ; FUNC-LABEL: {{^}}lds_atomic_max_ret_i32_offset:
254 ; EG: LDS_MAX_INT_RET *
255 ; SI: ds_max_rtn_i32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
257 define void @lds_atomic_max_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
258 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
259 %result = atomicrmw max i32 addrspace(3)* %gep, i32 4 seq_cst
260 store i32 %result, i32 addrspace(1)* %out, align 4
264 ; FUNC-LABEL: {{^}}lds_atomic_umin_ret_i32:
265 ; EG: LDS_MIN_UINT_RET *
268 define void @lds_atomic_umin_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
269 %result = atomicrmw umin i32 addrspace(3)* %ptr, i32 4 seq_cst
270 store i32 %result, i32 addrspace(1)* %out, align 4
274 ; FUNC-LABEL: {{^}}lds_atomic_umin_ret_i32_offset:
275 ; EG: LDS_MIN_UINT_RET *
276 ; SI: ds_min_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
278 define void @lds_atomic_umin_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
279 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
280 %result = atomicrmw umin i32 addrspace(3)* %gep, i32 4 seq_cst
281 store i32 %result, i32 addrspace(1)* %out, align 4
285 ; FUNC-LABEL: {{^}}lds_atomic_umax_ret_i32:
286 ; EG: LDS_MAX_UINT_RET *
289 define void @lds_atomic_umax_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
290 %result = atomicrmw umax i32 addrspace(3)* %ptr, i32 4 seq_cst
291 store i32 %result, i32 addrspace(1)* %out, align 4
295 ; FUNC-LABEL: {{^}}lds_atomic_umax_ret_i32_offset:
296 ; EG: LDS_MAX_UINT_RET *
297 ; SI: ds_max_rtn_u32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
299 define void @lds_atomic_umax_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
300 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
301 %result = atomicrmw umax i32 addrspace(3)* %gep, i32 4 seq_cst
302 store i32 %result, i32 addrspace(1)* %out, align 4
306 ; FUNC-LABEL: {{^}}lds_atomic_xchg_noret_i32:
307 ; SI: s_load_dword [[SPTR:s[0-9]+]],
308 ; SI: v_mov_b32_e32 [[DATA:v[0-9]+]], 4
309 ; SI: v_mov_b32_e32 [[VPTR:v[0-9]+]], [[SPTR]]
310 ; SI: ds_wrxchg_rtn_b32 [[RESULT:v[0-9]+]], [[VPTR]], [[DATA]] [M0]
312 define void @lds_atomic_xchg_noret_i32(i32 addrspace(3)* %ptr) nounwind {
313 %result = atomicrmw xchg i32 addrspace(3)* %ptr, i32 4 seq_cst
317 ; FUNC-LABEL: {{^}}lds_atomic_xchg_noret_i32_offset:
318 ; SI: ds_wrxchg_rtn_b32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
320 define void @lds_atomic_xchg_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
321 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
322 %result = atomicrmw xchg i32 addrspace(3)* %gep, i32 4 seq_cst
326 ; XXX - Is it really necessary to load 4 into VGPR?
327 ; FUNC-LABEL: {{^}}lds_atomic_add_noret_i32:
328 ; SI: s_load_dword [[SPTR:s[0-9]+]],
329 ; SI: v_mov_b32_e32 [[DATA:v[0-9]+]], 4
330 ; SI: v_mov_b32_e32 [[VPTR:v[0-9]+]], [[SPTR]]
331 ; SI: ds_add_u32 [[VPTR]], [[DATA]] [M0]
333 define void @lds_atomic_add_noret_i32(i32 addrspace(3)* %ptr) nounwind {
334 %result = atomicrmw add i32 addrspace(3)* %ptr, i32 4 seq_cst
338 ; FUNC-LABEL: {{^}}lds_atomic_add_noret_i32_offset:
339 ; SI: ds_add_u32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
341 define void @lds_atomic_add_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
342 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
343 %result = atomicrmw add i32 addrspace(3)* %gep, i32 4 seq_cst
347 ; FUNC-LABEL: {{^}}lds_atomic_add_noret_i32_bad_si_offset
348 ; SI: ds_add_u32 v{{[0-9]+}}, v{{[0-9]+}} [M0]
349 ; CI: ds_add_u32 v{{[0-9]+}}, v{{[0-9]+}} offset:16 [M0]
351 define void @lds_atomic_add_noret_i32_bad_si_offset(i32 addrspace(3)* %ptr, i32 %a, i32 %b) nounwind {
352 %sub = sub i32 %a, %b
353 %add = add i32 %sub, 4
354 %gep = getelementptr i32 addrspace(3)* %ptr, i32 %add
355 %result = atomicrmw add i32 addrspace(3)* %gep, i32 4 seq_cst
359 ; FUNC-LABEL: {{^}}lds_atomic_inc_noret_i32:
360 ; SI: v_mov_b32_e32 [[NEGONE:v[0-9]+]], -1
361 ; SI: ds_inc_u32 v{{[0-9]+}}, [[NEGONE]] [M0]
363 define void @lds_atomic_inc_noret_i32(i32 addrspace(3)* %ptr) nounwind {
364 %result = atomicrmw add i32 addrspace(3)* %ptr, i32 1 seq_cst
368 ; FUNC-LABEL: {{^}}lds_atomic_inc_noret_i32_offset:
369 ; SI: v_mov_b32_e32 [[NEGONE:v[0-9]+]], -1
370 ; SI: ds_inc_u32 v{{[0-9]+}}, [[NEGONE]] offset:16
372 define void @lds_atomic_inc_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
373 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
374 %result = atomicrmw add i32 addrspace(3)* %gep, i32 1 seq_cst
378 ; FUNC-LABEL: {{^}}lds_atomic_inc_noret_i32_bad_si_offset:
379 ; SI: ds_inc_u32 v{{[0-9]+}}, v{{[0-9]+}}
380 ; CI: ds_inc_u32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
382 define void @lds_atomic_inc_noret_i32_bad_si_offset(i32 addrspace(3)* %ptr, i32 %a, i32 %b) nounwind {
383 %sub = sub i32 %a, %b
384 %add = add i32 %sub, 4
385 %gep = getelementptr i32 addrspace(3)* %ptr, i32 %add
386 %result = atomicrmw add i32 addrspace(3)* %gep, i32 1 seq_cst
390 ; FUNC-LABEL: {{^}}lds_atomic_sub_noret_i32:
393 define void @lds_atomic_sub_noret_i32(i32 addrspace(3)* %ptr) nounwind {
394 %result = atomicrmw sub i32 addrspace(3)* %ptr, i32 4 seq_cst
398 ; FUNC-LABEL: {{^}}lds_atomic_sub_noret_i32_offset:
399 ; SI: ds_sub_u32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
401 define void @lds_atomic_sub_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
402 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
403 %result = atomicrmw sub i32 addrspace(3)* %gep, i32 4 seq_cst
407 ; FUNC-LABEL: {{^}}lds_atomic_dec_noret_i32:
408 ; SI: v_mov_b32_e32 [[NEGONE:v[0-9]+]], -1
409 ; SI: ds_dec_u32 v{{[0-9]+}}, [[NEGONE]]
411 define void @lds_atomic_dec_noret_i32(i32 addrspace(3)* %ptr) nounwind {
412 %result = atomicrmw sub i32 addrspace(3)* %ptr, i32 1 seq_cst
416 ; FUNC-LABEL: {{^}}lds_atomic_dec_noret_i32_offset:
417 ; SI: v_mov_b32_e32 [[NEGONE:v[0-9]+]], -1
418 ; SI: ds_dec_u32 v{{[0-9]+}}, [[NEGONE]] offset:16
420 define void @lds_atomic_dec_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
421 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
422 %result = atomicrmw sub i32 addrspace(3)* %gep, i32 1 seq_cst
426 ; FUNC-LABEL: {{^}}lds_atomic_and_noret_i32:
429 define void @lds_atomic_and_noret_i32(i32 addrspace(3)* %ptr) nounwind {
430 %result = atomicrmw and i32 addrspace(3)* %ptr, i32 4 seq_cst
434 ; FUNC-LABEL: {{^}}lds_atomic_and_noret_i32_offset:
435 ; SI: ds_and_b32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
437 define void @lds_atomic_and_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
438 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
439 %result = atomicrmw and i32 addrspace(3)* %gep, i32 4 seq_cst
443 ; FUNC-LABEL: {{^}}lds_atomic_or_noret_i32:
446 define void @lds_atomic_or_noret_i32(i32 addrspace(3)* %ptr) nounwind {
447 %result = atomicrmw or i32 addrspace(3)* %ptr, i32 4 seq_cst
451 ; FUNC-LABEL: {{^}}lds_atomic_or_noret_i32_offset:
452 ; SI: ds_or_b32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
454 define void @lds_atomic_or_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
455 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
456 %result = atomicrmw or i32 addrspace(3)* %gep, i32 4 seq_cst
460 ; FUNC-LABEL: {{^}}lds_atomic_xor_noret_i32:
463 define void @lds_atomic_xor_noret_i32(i32 addrspace(3)* %ptr) nounwind {
464 %result = atomicrmw xor i32 addrspace(3)* %ptr, i32 4 seq_cst
468 ; FUNC-LABEL: {{^}}lds_atomic_xor_noret_i32_offset:
469 ; SI: ds_xor_b32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
471 define void @lds_atomic_xor_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
472 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
473 %result = atomicrmw xor i32 addrspace(3)* %gep, i32 4 seq_cst
477 ; FIXME: There is no atomic nand instr
478 ; XFUNC-LABEL: {{^}}lds_atomic_nand_noret_i32:uction, so we somehow need to expand this.
479 ; define void @lds_atomic_nand_noret_i32(i32 addrspace(3)* %ptr) nounwind {
480 ; %result = atomicrmw nand i32 addrspace(3)* %ptr, i32 4 seq_cst
484 ; FUNC-LABEL: {{^}}lds_atomic_min_noret_i32:
487 define void @lds_atomic_min_noret_i32(i32 addrspace(3)* %ptr) nounwind {
488 %result = atomicrmw min i32 addrspace(3)* %ptr, i32 4 seq_cst
492 ; FUNC-LABEL: {{^}}lds_atomic_min_noret_i32_offset:
493 ; SI: ds_min_i32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
495 define void @lds_atomic_min_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
496 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
497 %result = atomicrmw min i32 addrspace(3)* %gep, i32 4 seq_cst
501 ; FUNC-LABEL: {{^}}lds_atomic_max_noret_i32:
504 define void @lds_atomic_max_noret_i32(i32 addrspace(3)* %ptr) nounwind {
505 %result = atomicrmw max i32 addrspace(3)* %ptr, i32 4 seq_cst
509 ; FUNC-LABEL: {{^}}lds_atomic_max_noret_i32_offset:
510 ; SI: ds_max_i32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
512 define void @lds_atomic_max_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
513 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
514 %result = atomicrmw max i32 addrspace(3)* %gep, i32 4 seq_cst
518 ; FUNC-LABEL: {{^}}lds_atomic_umin_noret_i32:
521 define void @lds_atomic_umin_noret_i32(i32 addrspace(3)* %ptr) nounwind {
522 %result = atomicrmw umin i32 addrspace(3)* %ptr, i32 4 seq_cst
526 ; FUNC-LABEL: {{^}}lds_atomic_umin_noret_i32_offset:
527 ; SI: ds_min_u32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
529 define void @lds_atomic_umin_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
530 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
531 %result = atomicrmw umin i32 addrspace(3)* %gep, i32 4 seq_cst
535 ; FUNC-LABEL: {{^}}lds_atomic_umax_noret_i32:
538 define void @lds_atomic_umax_noret_i32(i32 addrspace(3)* %ptr) nounwind {
539 %result = atomicrmw umax i32 addrspace(3)* %ptr, i32 4 seq_cst
543 ; FUNC-LABEL: {{^}}lds_atomic_umax_noret_i32_offset:
544 ; SI: ds_max_u32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
546 define void @lds_atomic_umax_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
547 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
548 %result = atomicrmw umax i32 addrspace(3)* %gep, i32 4 seq_cst