1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
2 ; RUN: llc -march=r600 -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: S_MOV_B32 [[SNEGONE:s[0-9]+]], -1
73 ; SI: V_MOV_B32_e32 [[NEGONE:v[0-9]+]], [[SNEGONE]]
74 ; SI: DS_INC_RTN_U32 v{{[0-9]+}}, v{{[0-9]+}}, [[NEGONE]] [M0]
76 define void @lds_atomic_inc_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
77 %result = atomicrmw add i32 addrspace(3)* %ptr, i32 1 seq_cst
78 store i32 %result, i32 addrspace(1)* %out, align 4
82 ; FUNC-LABEL: {{^}}lds_atomic_inc_ret_i32_offset:
84 ; SI: S_MOV_B32 [[SNEGONE:s[0-9]+]], -1
85 ; SI: V_MOV_B32_e32 [[NEGONE:v[0-9]+]], [[SNEGONE]]
86 ; SI: DS_INC_RTN_U32 v{{[0-9]+}}, v{{[0-9]+}}, [[NEGONE]] offset:16
88 define void @lds_atomic_inc_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
89 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
90 %result = atomicrmw add i32 addrspace(3)* %gep, i32 1 seq_cst
91 store i32 %result, i32 addrspace(1)* %out, align 4
95 ; FUNC-LABEL: {{^}}lds_atomic_inc_ret_i32_bad_si_offset:
97 ; SI: DS_INC_RTN_U32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} [M0]
98 ; CI: DS_INC_RTN_U32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
100 define void @lds_atomic_inc_ret_i32_bad_si_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr, i32 %a, i32 %b) nounwind {
101 %sub = sub i32 %a, %b
102 %add = add i32 %sub, 4
103 %gep = getelementptr i32 addrspace(3)* %ptr, i32 %add
104 %result = atomicrmw add i32 addrspace(3)* %gep, i32 1 seq_cst
105 store i32 %result, i32 addrspace(1)* %out, align 4
109 ; FUNC-LABEL: {{^}}lds_atomic_sub_ret_i32:
113 define void @lds_atomic_sub_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
114 %result = atomicrmw sub i32 addrspace(3)* %ptr, i32 4 seq_cst
115 store i32 %result, i32 addrspace(1)* %out, align 4
119 ; FUNC-LABEL: {{^}}lds_atomic_sub_ret_i32_offset:
121 ; SI: DS_SUB_RTN_U32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
123 define void @lds_atomic_sub_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
124 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
125 %result = atomicrmw sub i32 addrspace(3)* %gep, i32 4 seq_cst
126 store i32 %result, i32 addrspace(1)* %out, align 4
130 ; FUNC-LABEL: {{^}}lds_atomic_dec_ret_i32:
132 ; SI: S_MOV_B32 [[SNEGONE:s[0-9]+]], -1
133 ; SI: V_MOV_B32_e32 [[NEGONE:v[0-9]+]], [[SNEGONE]]
134 ; SI: DS_DEC_RTN_U32 v{{[0-9]+}}, v{{[0-9]+}}, [[NEGONE]] [M0]
136 define void @lds_atomic_dec_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
137 %result = atomicrmw sub i32 addrspace(3)* %ptr, i32 1 seq_cst
138 store i32 %result, i32 addrspace(1)* %out, align 4
142 ; FUNC-LABEL: {{^}}lds_atomic_dec_ret_i32_offset:
144 ; SI: S_MOV_B32 [[SNEGONE:s[0-9]+]], -1
145 ; SI: V_MOV_B32_e32 [[NEGONE:v[0-9]+]], [[SNEGONE]]
146 ; SI: DS_DEC_RTN_U32 v{{[0-9]+}}, v{{[0-9]+}}, [[NEGONE]] offset:16
148 define void @lds_atomic_dec_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
149 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
150 %result = atomicrmw sub i32 addrspace(3)* %gep, i32 1 seq_cst
151 store i32 %result, i32 addrspace(1)* %out, align 4
155 ; FUNC-LABEL: {{^}}lds_atomic_and_ret_i32:
159 define void @lds_atomic_and_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
160 %result = atomicrmw and i32 addrspace(3)* %ptr, i32 4 seq_cst
161 store i32 %result, i32 addrspace(1)* %out, align 4
165 ; FUNC-LABEL: {{^}}lds_atomic_and_ret_i32_offset:
167 ; SI: DS_AND_RTN_B32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
169 define void @lds_atomic_and_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
170 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
171 %result = atomicrmw and i32 addrspace(3)* %gep, i32 4 seq_cst
172 store i32 %result, i32 addrspace(1)* %out, align 4
176 ; FUNC-LABEL: {{^}}lds_atomic_or_ret_i32:
180 define void @lds_atomic_or_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
181 %result = atomicrmw or i32 addrspace(3)* %ptr, i32 4 seq_cst
182 store i32 %result, i32 addrspace(1)* %out, align 4
186 ; FUNC-LABEL: {{^}}lds_atomic_or_ret_i32_offset:
188 ; SI: DS_OR_RTN_B32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
190 define void @lds_atomic_or_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
191 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
192 %result = atomicrmw or i32 addrspace(3)* %gep, i32 4 seq_cst
193 store i32 %result, i32 addrspace(1)* %out, align 4
197 ; FUNC-LABEL: {{^}}lds_atomic_xor_ret_i32:
201 define void @lds_atomic_xor_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
202 %result = atomicrmw xor i32 addrspace(3)* %ptr, i32 4 seq_cst
203 store i32 %result, i32 addrspace(1)* %out, align 4
207 ; FUNC-LABEL: {{^}}lds_atomic_xor_ret_i32_offset:
209 ; SI: DS_XOR_RTN_B32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
211 define void @lds_atomic_xor_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
212 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
213 %result = atomicrmw xor i32 addrspace(3)* %gep, i32 4 seq_cst
214 store i32 %result, i32 addrspace(1)* %out, align 4
218 ; FIXME: There is no atomic nand instr
219 ; XFUNC-LABEL: {{^}}lds_atomic_nand_ret_i32:uction, so we somehow need to expand this.
220 ; define void @lds_atomic_nand_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
221 ; %result = atomicrmw nand i32 addrspace(3)* %ptr, i32 4 seq_cst
222 ; store i32 %result, i32 addrspace(1)* %out, align 4
226 ; FUNC-LABEL: {{^}}lds_atomic_min_ret_i32:
227 ; EG: LDS_MIN_INT_RET *
230 define void @lds_atomic_min_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
231 %result = atomicrmw min i32 addrspace(3)* %ptr, i32 4 seq_cst
232 store i32 %result, i32 addrspace(1)* %out, align 4
236 ; FUNC-LABEL: {{^}}lds_atomic_min_ret_i32_offset:
237 ; EG: LDS_MIN_INT_RET *
238 ; SI: DS_MIN_RTN_I32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
240 define void @lds_atomic_min_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
241 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
242 %result = atomicrmw min i32 addrspace(3)* %gep, i32 4 seq_cst
243 store i32 %result, i32 addrspace(1)* %out, align 4
247 ; FUNC-LABEL: {{^}}lds_atomic_max_ret_i32:
248 ; EG: LDS_MAX_INT_RET *
251 define void @lds_atomic_max_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
252 %result = atomicrmw max i32 addrspace(3)* %ptr, i32 4 seq_cst
253 store i32 %result, i32 addrspace(1)* %out, align 4
257 ; FUNC-LABEL: {{^}}lds_atomic_max_ret_i32_offset:
258 ; EG: LDS_MAX_INT_RET *
259 ; SI: DS_MAX_RTN_I32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
261 define void @lds_atomic_max_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
262 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
263 %result = atomicrmw max i32 addrspace(3)* %gep, i32 4 seq_cst
264 store i32 %result, i32 addrspace(1)* %out, align 4
268 ; FUNC-LABEL: {{^}}lds_atomic_umin_ret_i32:
269 ; EG: LDS_MIN_UINT_RET *
272 define void @lds_atomic_umin_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
273 %result = atomicrmw umin i32 addrspace(3)* %ptr, i32 4 seq_cst
274 store i32 %result, i32 addrspace(1)* %out, align 4
278 ; FUNC-LABEL: {{^}}lds_atomic_umin_ret_i32_offset:
279 ; EG: LDS_MIN_UINT_RET *
280 ; SI: DS_MIN_RTN_U32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
282 define void @lds_atomic_umin_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
283 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
284 %result = atomicrmw umin i32 addrspace(3)* %gep, i32 4 seq_cst
285 store i32 %result, i32 addrspace(1)* %out, align 4
289 ; FUNC-LABEL: {{^}}lds_atomic_umax_ret_i32:
290 ; EG: LDS_MAX_UINT_RET *
293 define void @lds_atomic_umax_ret_i32(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
294 %result = atomicrmw umax i32 addrspace(3)* %ptr, i32 4 seq_cst
295 store i32 %result, i32 addrspace(1)* %out, align 4
299 ; FUNC-LABEL: {{^}}lds_atomic_umax_ret_i32_offset:
300 ; EG: LDS_MAX_UINT_RET *
301 ; SI: DS_MAX_RTN_U32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
303 define void @lds_atomic_umax_ret_i32_offset(i32 addrspace(1)* %out, i32 addrspace(3)* %ptr) nounwind {
304 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
305 %result = atomicrmw umax i32 addrspace(3)* %gep, i32 4 seq_cst
306 store i32 %result, i32 addrspace(1)* %out, align 4
310 ; FUNC-LABEL: {{^}}lds_atomic_xchg_noret_i32:
311 ; SI: S_LOAD_DWORD [[SPTR:s[0-9]+]],
312 ; SI: V_MOV_B32_e32 [[DATA:v[0-9]+]], 4
313 ; SI: V_MOV_B32_e32 [[VPTR:v[0-9]+]], [[SPTR]]
314 ; SI: DS_WRXCHG_RTN_B32 [[RESULT:v[0-9]+]], [[VPTR]], [[DATA]] [M0]
316 define void @lds_atomic_xchg_noret_i32(i32 addrspace(3)* %ptr) nounwind {
317 %result = atomicrmw xchg i32 addrspace(3)* %ptr, i32 4 seq_cst
321 ; FUNC-LABEL: {{^}}lds_atomic_xchg_noret_i32_offset:
322 ; SI: DS_WRXCHG_RTN_B32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset:16
324 define void @lds_atomic_xchg_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
325 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
326 %result = atomicrmw xchg i32 addrspace(3)* %gep, i32 4 seq_cst
330 ; XXX - Is it really necessary to load 4 into VGPR?
331 ; FUNC-LABEL: {{^}}lds_atomic_add_noret_i32:
332 ; SI: S_LOAD_DWORD [[SPTR:s[0-9]+]],
333 ; SI: V_MOV_B32_e32 [[DATA:v[0-9]+]], 4
334 ; SI: V_MOV_B32_e32 [[VPTR:v[0-9]+]], [[SPTR]]
335 ; SI: DS_ADD_U32 [[VPTR]], [[DATA]] [M0]
337 define void @lds_atomic_add_noret_i32(i32 addrspace(3)* %ptr) nounwind {
338 %result = atomicrmw add i32 addrspace(3)* %ptr, i32 4 seq_cst
342 ; FUNC-LABEL: {{^}}lds_atomic_add_noret_i32_offset:
343 ; SI: DS_ADD_U32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
345 define void @lds_atomic_add_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
346 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
347 %result = atomicrmw add i32 addrspace(3)* %gep, i32 4 seq_cst
351 ; FUNC-LABEL: {{^}}lds_atomic_add_noret_i32_bad_si_offset
352 ; SI: DS_ADD_U32 v{{[0-9]+}}, v{{[0-9]+}} [M0]
353 ; CI: DS_ADD_U32 v{{[0-9]+}}, v{{[0-9]+}} offset:16 [M0]
355 define void @lds_atomic_add_noret_i32_bad_si_offset(i32 addrspace(3)* %ptr, i32 %a, i32 %b) nounwind {
356 %sub = sub i32 %a, %b
357 %add = add i32 %sub, 4
358 %gep = getelementptr i32 addrspace(3)* %ptr, i32 %add
359 %result = atomicrmw add i32 addrspace(3)* %gep, i32 4 seq_cst
363 ; FUNC-LABEL: {{^}}lds_atomic_inc_noret_i32:
364 ; SI: S_MOV_B32 [[SNEGONE:s[0-9]+]], -1
365 ; SI: V_MOV_B32_e32 [[NEGONE:v[0-9]+]], [[SNEGONE]]
366 ; SI: DS_INC_U32 v{{[0-9]+}}, [[NEGONE]] [M0]
368 define void @lds_atomic_inc_noret_i32(i32 addrspace(3)* %ptr) nounwind {
369 %result = atomicrmw add i32 addrspace(3)* %ptr, i32 1 seq_cst
373 ; FUNC-LABEL: {{^}}lds_atomic_inc_noret_i32_offset:
374 ; SI: S_MOV_B32 [[SNEGONE:s[0-9]+]], -1
375 ; SI: V_MOV_B32_e32 [[NEGONE:v[0-9]+]], [[SNEGONE]]
376 ; SI: DS_INC_U32 v{{[0-9]+}}, [[NEGONE]] offset:16
378 define void @lds_atomic_inc_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
379 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
380 %result = atomicrmw add i32 addrspace(3)* %gep, i32 1 seq_cst
384 ; FUNC-LABEL: {{^}}lds_atomic_inc_noret_i32_bad_si_offset:
385 ; SI: DS_INC_U32 v{{[0-9]+}}, v{{[0-9]+}}
386 ; CI: DS_INC_U32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
388 define void @lds_atomic_inc_noret_i32_bad_si_offset(i32 addrspace(3)* %ptr, i32 %a, i32 %b) nounwind {
389 %sub = sub i32 %a, %b
390 %add = add i32 %sub, 4
391 %gep = getelementptr i32 addrspace(3)* %ptr, i32 %add
392 %result = atomicrmw add i32 addrspace(3)* %gep, i32 1 seq_cst
396 ; FUNC-LABEL: {{^}}lds_atomic_sub_noret_i32:
399 define void @lds_atomic_sub_noret_i32(i32 addrspace(3)* %ptr) nounwind {
400 %result = atomicrmw sub i32 addrspace(3)* %ptr, i32 4 seq_cst
404 ; FUNC-LABEL: {{^}}lds_atomic_sub_noret_i32_offset:
405 ; SI: DS_SUB_U32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
407 define void @lds_atomic_sub_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
408 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
409 %result = atomicrmw sub i32 addrspace(3)* %gep, i32 4 seq_cst
413 ; FUNC-LABEL: {{^}}lds_atomic_dec_noret_i32:
414 ; SI: S_MOV_B32 [[SNEGONE:s[0-9]+]], -1
415 ; SI: V_MOV_B32_e32 [[NEGONE:v[0-9]+]], [[SNEGONE]]
416 ; SI: DS_DEC_U32 v{{[0-9]+}}, [[NEGONE]]
418 define void @lds_atomic_dec_noret_i32(i32 addrspace(3)* %ptr) nounwind {
419 %result = atomicrmw sub i32 addrspace(3)* %ptr, i32 1 seq_cst
423 ; FUNC-LABEL: {{^}}lds_atomic_dec_noret_i32_offset:
424 ; SI: S_MOV_B32 [[SNEGONE:s[0-9]+]], -1
425 ; SI: V_MOV_B32_e32 [[NEGONE:v[0-9]+]], [[SNEGONE]]
426 ; SI: DS_DEC_U32 v{{[0-9]+}}, [[NEGONE]] offset:16
428 define void @lds_atomic_dec_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
429 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
430 %result = atomicrmw sub i32 addrspace(3)* %gep, i32 1 seq_cst
434 ; FUNC-LABEL: {{^}}lds_atomic_and_noret_i32:
437 define void @lds_atomic_and_noret_i32(i32 addrspace(3)* %ptr) nounwind {
438 %result = atomicrmw and i32 addrspace(3)* %ptr, i32 4 seq_cst
442 ; FUNC-LABEL: {{^}}lds_atomic_and_noret_i32_offset:
443 ; SI: DS_AND_B32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
445 define void @lds_atomic_and_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
446 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
447 %result = atomicrmw and i32 addrspace(3)* %gep, i32 4 seq_cst
451 ; FUNC-LABEL: {{^}}lds_atomic_or_noret_i32:
454 define void @lds_atomic_or_noret_i32(i32 addrspace(3)* %ptr) nounwind {
455 %result = atomicrmw or i32 addrspace(3)* %ptr, i32 4 seq_cst
459 ; FUNC-LABEL: {{^}}lds_atomic_or_noret_i32_offset:
460 ; SI: DS_OR_B32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
462 define void @lds_atomic_or_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
463 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
464 %result = atomicrmw or i32 addrspace(3)* %gep, i32 4 seq_cst
468 ; FUNC-LABEL: {{^}}lds_atomic_xor_noret_i32:
471 define void @lds_atomic_xor_noret_i32(i32 addrspace(3)* %ptr) nounwind {
472 %result = atomicrmw xor i32 addrspace(3)* %ptr, i32 4 seq_cst
476 ; FUNC-LABEL: {{^}}lds_atomic_xor_noret_i32_offset:
477 ; SI: DS_XOR_B32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
479 define void @lds_atomic_xor_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
480 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
481 %result = atomicrmw xor i32 addrspace(3)* %gep, i32 4 seq_cst
485 ; FIXME: There is no atomic nand instr
486 ; XFUNC-LABEL: {{^}}lds_atomic_nand_noret_i32:uction, so we somehow need to expand this.
487 ; define void @lds_atomic_nand_noret_i32(i32 addrspace(3)* %ptr) nounwind {
488 ; %result = atomicrmw nand i32 addrspace(3)* %ptr, i32 4 seq_cst
492 ; FUNC-LABEL: {{^}}lds_atomic_min_noret_i32:
495 define void @lds_atomic_min_noret_i32(i32 addrspace(3)* %ptr) nounwind {
496 %result = atomicrmw min i32 addrspace(3)* %ptr, i32 4 seq_cst
500 ; FUNC-LABEL: {{^}}lds_atomic_min_noret_i32_offset:
501 ; SI: DS_MIN_I32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
503 define void @lds_atomic_min_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
504 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
505 %result = atomicrmw min i32 addrspace(3)* %gep, i32 4 seq_cst
509 ; FUNC-LABEL: {{^}}lds_atomic_max_noret_i32:
512 define void @lds_atomic_max_noret_i32(i32 addrspace(3)* %ptr) nounwind {
513 %result = atomicrmw max i32 addrspace(3)* %ptr, i32 4 seq_cst
517 ; FUNC-LABEL: {{^}}lds_atomic_max_noret_i32_offset:
518 ; SI: DS_MAX_I32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
520 define void @lds_atomic_max_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
521 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
522 %result = atomicrmw max i32 addrspace(3)* %gep, i32 4 seq_cst
526 ; FUNC-LABEL: {{^}}lds_atomic_umin_noret_i32:
529 define void @lds_atomic_umin_noret_i32(i32 addrspace(3)* %ptr) nounwind {
530 %result = atomicrmw umin i32 addrspace(3)* %ptr, i32 4 seq_cst
534 ; FUNC-LABEL: {{^}}lds_atomic_umin_noret_i32_offset:
535 ; SI: DS_MIN_U32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
537 define void @lds_atomic_umin_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
538 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
539 %result = atomicrmw umin i32 addrspace(3)* %gep, i32 4 seq_cst
543 ; FUNC-LABEL: {{^}}lds_atomic_umax_noret_i32:
546 define void @lds_atomic_umax_noret_i32(i32 addrspace(3)* %ptr) nounwind {
547 %result = atomicrmw umax i32 addrspace(3)* %ptr, i32 4 seq_cst
551 ; FUNC-LABEL: {{^}}lds_atomic_umax_noret_i32_offset:
552 ; SI: DS_MAX_U32 v{{[0-9]+}}, v{{[0-9]+}} offset:16
554 define void @lds_atomic_umax_noret_i32_offset(i32 addrspace(3)* %ptr) nounwind {
555 %gep = getelementptr i32 addrspace(3)* %ptr, i32 4
556 %result = atomicrmw umax i32 addrspace(3)* %gep, i32 4 seq_cst