1 ; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
2 ; RUN: llc -march=r600 -mcpu=cayman -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
4 ; TODO: Add _RTN versions and merge with the GCN test
6 ; FUNC-LABEL: {{^}}atomic_add_i32_offset:
7 ; EG: MEM_RAT ATOMIC_ADD [[REG:T[0-9]+]]
8 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
9 define amdgpu_kernel void @atomic_add_i32_offset(i32 addrspace(1)* %out, i32 %in) {
11 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
12 %val = atomicrmw volatile add i32 addrspace(1)* %gep, i32 %in seq_cst
16 ; FUNC-LABEL: {{^}}atomic_add_i32_soffset:
17 ; EG: MEM_RAT ATOMIC_ADD [[REG:T[0-9]+]]
18 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
19 define amdgpu_kernel void @atomic_add_i32_soffset(i32 addrspace(1)* %out, i32 %in) {
21 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 9000
22 %val = atomicrmw volatile add i32 addrspace(1)* %gep, i32 %in seq_cst
26 ; FUNC-LABEL: {{^}}atomic_add_i32_huge_offset:
27 ; FIXME: looks like the offset is wrong
28 ; EG: MEM_RAT ATOMIC_ADD [[REG:T[0-9]+]]
29 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
30 define amdgpu_kernel void @atomic_add_i32_huge_offset(i32 addrspace(1)* %out, i32 %in) {
32 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 47224239175595
34 %val = atomicrmw volatile add i32 addrspace(1)* %gep, i32 %in seq_cst
38 ; FUNC-LABEL: {{^}}atomic_add_i32_addr64_offset:
39 ; EG: MEM_RAT ATOMIC_ADD [[REG:T[0-9]+]]
40 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
41 define amdgpu_kernel void @atomic_add_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) {
43 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
44 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
45 %val = atomicrmw volatile add i32 addrspace(1)* %gep, i32 %in seq_cst
49 ; FUNC-LABEL: {{^}}atomic_add_i32:
50 ; EG: MEM_RAT ATOMIC_ADD [[REG:T[0-9]+]]
51 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
52 define amdgpu_kernel void @atomic_add_i32(i32 addrspace(1)* %out, i32 %in) {
54 %val = atomicrmw volatile add i32 addrspace(1)* %out, i32 %in seq_cst
58 ; FUNC-LABEL: {{^}}atomic_add_i32_addr64:
59 ; EG: MEM_RAT ATOMIC_ADD [[REG:T[0-9]+]]
60 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
61 define amdgpu_kernel void @atomic_add_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) {
63 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
64 %val = atomicrmw volatile add i32 addrspace(1)* %ptr, i32 %in seq_cst
68 ; FUNC-LABEL: {{^}}atomic_and_i32_offset:
69 ; EG: MEM_RAT ATOMIC_AND [[REG:T[0-9]+]]
70 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
71 define amdgpu_kernel void @atomic_and_i32_offset(i32 addrspace(1)* %out, i32 %in) {
73 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
74 %val = atomicrmw volatile and i32 addrspace(1)* %gep, i32 %in seq_cst
78 ; FUNC-LABEL: {{^}}atomic_and_i32_addr64_offset:
79 ; EG: MEM_RAT ATOMIC_AND [[REG:T[0-9]+]]
80 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
81 define amdgpu_kernel void @atomic_and_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) {
83 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
84 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
85 %val = atomicrmw volatile and i32 addrspace(1)* %gep, i32 %in seq_cst
89 ; FUNC-LABEL: {{^}}atomic_and_i32:
90 ; EG: MEM_RAT ATOMIC_AND [[REG:T[0-9]+]]
91 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
92 define amdgpu_kernel void @atomic_and_i32(i32 addrspace(1)* %out, i32 %in) {
94 %val = atomicrmw volatile and i32 addrspace(1)* %out, i32 %in seq_cst
98 ; FUNC-LABEL: {{^}}atomic_and_i32_addr64:
99 ; EG: MEM_RAT ATOMIC_AND [[REG:T[0-9]+]]
100 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
101 define amdgpu_kernel void @atomic_and_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) {
103 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
104 %val = atomicrmw volatile and i32 addrspace(1)* %ptr, i32 %in seq_cst
108 ; FUNC-LABEL: {{^}}atomic_sub_i32_offset:
109 ; EG: MEM_RAT ATOMIC_SUB [[REG:T[0-9]+]]
110 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
111 define amdgpu_kernel void @atomic_sub_i32_offset(i32 addrspace(1)* %out, i32 %in) {
113 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
114 %val = atomicrmw volatile sub i32 addrspace(1)* %gep, i32 %in seq_cst
118 ; FUNC-LABEL: {{^}}atomic_sub_i32_addr64_offset:
119 ; EG: MEM_RAT ATOMIC_SUB [[REG:T[0-9]+]]
120 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
121 define amdgpu_kernel void @atomic_sub_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) {
123 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
124 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
125 %val = atomicrmw volatile sub i32 addrspace(1)* %gep, i32 %in seq_cst
129 ; FUNC-LABEL: {{^}}atomic_sub_i32:
130 ; EG: MEM_RAT ATOMIC_SUB [[REG:T[0-9]+]]
131 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
132 define amdgpu_kernel void @atomic_sub_i32(i32 addrspace(1)* %out, i32 %in) {
134 %val = atomicrmw volatile sub i32 addrspace(1)* %out, i32 %in seq_cst
138 ; FUNC-LABEL: {{^}}atomic_sub_i32_addr64:
139 ; EG: MEM_RAT ATOMIC_SUB [[REG:T[0-9]+]]
140 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
141 define amdgpu_kernel void @atomic_sub_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) {
143 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
144 %val = atomicrmw volatile sub i32 addrspace(1)* %ptr, i32 %in seq_cst
148 ; FUNC-LABEL: {{^}}atomic_max_i32_offset:
149 ; EG: MEM_RAT ATOMIC_MAX_INT [[REG:T[0-9]+]]
150 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
151 define amdgpu_kernel void @atomic_max_i32_offset(i32 addrspace(1)* %out, i32 %in) {
153 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
154 %val = atomicrmw volatile max i32 addrspace(1)* %gep, i32 %in seq_cst
158 ; FUNC-LABEL: {{^}}atomic_max_i32_addr64_offset:
159 ; EG: MEM_RAT ATOMIC_MAX_INT [[REG:T[0-9]+]]
160 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
161 define amdgpu_kernel void @atomic_max_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) {
163 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
164 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
165 %val = atomicrmw volatile max i32 addrspace(1)* %gep, i32 %in seq_cst
169 ; FUNC-LABEL: {{^}}atomic_max_i32:
170 ; EG: MEM_RAT ATOMIC_MAX_INT [[REG:T[0-9]+]]
171 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
172 define amdgpu_kernel void @atomic_max_i32(i32 addrspace(1)* %out, i32 %in) {
174 %val = atomicrmw volatile max i32 addrspace(1)* %out, i32 %in seq_cst
178 ; FUNC-LABEL: {{^}}atomic_max_i32_addr64:
179 ; EG: MEM_RAT ATOMIC_MAX_INT [[REG:T[0-9]+]]
180 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
181 define amdgpu_kernel void @atomic_max_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) {
183 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
184 %val = atomicrmw volatile max i32 addrspace(1)* %ptr, i32 %in seq_cst
188 ; FUNC-LABEL: {{^}}atomic_umax_i32_offset:
189 ; EG: MEM_RAT ATOMIC_MAX_UINT [[REG:T[0-9]+]]
190 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
191 define amdgpu_kernel void @atomic_umax_i32_offset(i32 addrspace(1)* %out, i32 %in) {
193 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
194 %val = atomicrmw volatile umax i32 addrspace(1)* %gep, i32 %in seq_cst
198 ; FUNC-LABEL: {{^}}atomic_umax_i32_addr64_offset:
199 ; EG: MEM_RAT ATOMIC_MAX_UINT [[REG:T[0-9]+]]
200 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
201 define amdgpu_kernel void @atomic_umax_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) {
203 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
204 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
205 %val = atomicrmw volatile umax i32 addrspace(1)* %gep, i32 %in seq_cst
209 ; FUNC-LABEL: {{^}}atomic_umax_i32:
210 ; EG: MEM_RAT ATOMIC_MAX_UINT [[REG:T[0-9]+]]
211 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
212 define amdgpu_kernel void @atomic_umax_i32(i32 addrspace(1)* %out, i32 %in) {
214 %val = atomicrmw volatile umax i32 addrspace(1)* %out, i32 %in seq_cst
218 ; FUNC-LABEL: {{^}}atomic_umax_i32_addr64:
219 ; EG: MEM_RAT ATOMIC_MAX_UINT [[REG:T[0-9]+]]
220 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
221 define amdgpu_kernel void @atomic_umax_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) {
223 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
224 %val = atomicrmw volatile umax i32 addrspace(1)* %ptr, i32 %in seq_cst
228 ; FUNC-LABEL: {{^}}atomic_min_i32_offset:
229 ; EG: MEM_RAT ATOMIC_MIN_INT [[REG:T[0-9]+]]
230 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
231 define amdgpu_kernel void @atomic_min_i32_offset(i32 addrspace(1)* %out, i32 %in) {
233 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
234 %val = atomicrmw volatile min i32 addrspace(1)* %gep, i32 %in seq_cst
238 ; FUNC-LABEL: {{^}}atomic_min_i32_addr64_offset:
239 ; EG: MEM_RAT ATOMIC_MIN_INT [[REG:T[0-9]+]]
240 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
241 define amdgpu_kernel void @atomic_min_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) {
243 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
244 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
245 %val = atomicrmw volatile min i32 addrspace(1)* %gep, i32 %in seq_cst
249 ; FUNC-LABEL: {{^}}atomic_min_i32:
250 ; EG: MEM_RAT ATOMIC_MIN_INT [[REG:T[0-9]+]]
251 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
252 define amdgpu_kernel void @atomic_min_i32(i32 addrspace(1)* %out, i32 %in) {
254 %val = atomicrmw volatile min i32 addrspace(1)* %out, i32 %in seq_cst
258 ; FUNC-LABEL: {{^}}atomic_min_i32_addr64:
259 ; EG: MEM_RAT ATOMIC_MIN_INT [[REG:T[0-9]+]]
260 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
261 define amdgpu_kernel void @atomic_min_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) {
263 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
264 %val = atomicrmw volatile min i32 addrspace(1)* %ptr, i32 %in seq_cst
268 ; FUNC-LABEL: {{^}}atomic_umin_i32_offset:
269 ; EG: MEM_RAT ATOMIC_MIN_UINT [[REG:T[0-9]+]]
270 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
271 define amdgpu_kernel void @atomic_umin_i32_offset(i32 addrspace(1)* %out, i32 %in) {
273 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
274 %val = atomicrmw volatile umin i32 addrspace(1)* %gep, i32 %in seq_cst
278 ; FUNC-LABEL: {{^}}atomic_umin_i32_addr64_offset:
279 ; EG: MEM_RAT ATOMIC_MIN_UINT [[REG:T[0-9]+]]
280 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
281 define amdgpu_kernel void @atomic_umin_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) {
283 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
284 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
285 %val = atomicrmw volatile umin i32 addrspace(1)* %gep, i32 %in seq_cst
289 ; FUNC-LABEL: {{^}}atomic_umin_i32:
290 ; EG: MEM_RAT ATOMIC_MIN_UINT [[REG:T[0-9]+]]
291 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
292 define amdgpu_kernel void @atomic_umin_i32(i32 addrspace(1)* %out, i32 %in) {
294 %val = atomicrmw volatile umin i32 addrspace(1)* %out, i32 %in seq_cst
298 ; FUNC-LABEL: {{^}}atomic_umin_i32_addr64:
299 ; EG: MEM_RAT ATOMIC_MIN_UINT [[REG:T[0-9]+]]
300 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
301 define amdgpu_kernel void @atomic_umin_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) {
303 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
304 %val = atomicrmw volatile umin i32 addrspace(1)* %ptr, i32 %in seq_cst
308 ; FUNC-LABEL: {{^}}atomic_or_i32_offset:
309 ; EG: MEM_RAT ATOMIC_OR [[REG:T[0-9]+]]
310 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
311 define amdgpu_kernel void @atomic_or_i32_offset(i32 addrspace(1)* %out, i32 %in) {
313 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
314 %val = atomicrmw volatile or i32 addrspace(1)* %gep, i32 %in seq_cst
318 ; FUNC-LABEL: {{^}}atomic_or_i32_addr64_offset:
319 ; EG: MEM_RAT ATOMIC_OR [[REG:T[0-9]+]]
320 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
321 define amdgpu_kernel void @atomic_or_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) {
323 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
324 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
325 %val = atomicrmw volatile or i32 addrspace(1)* %gep, i32 %in seq_cst
329 ; FUNC-LABEL: {{^}}atomic_or_i32:
330 ; EG: MEM_RAT ATOMIC_OR [[REG:T[0-9]+]]
331 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
332 define amdgpu_kernel void @atomic_or_i32(i32 addrspace(1)* %out, i32 %in) {
334 %val = atomicrmw volatile or i32 addrspace(1)* %out, i32 %in seq_cst
338 ; FUNC-LABEL: {{^}}atomic_or_i32_addr64:
339 ; EG: MEM_RAT ATOMIC_OR [[REG:T[0-9]+]]
340 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
341 define amdgpu_kernel void @atomic_or_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) {
343 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
344 %val = atomicrmw volatile or i32 addrspace(1)* %ptr, i32 %in seq_cst
348 ; FUNC-LABEL: {{^}}atomic_xchg_i32_offset:
349 ; EG: MEM_RAT ATOMIC_XCHG_INT [[REG:T[0-9]+]]
350 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
351 define amdgpu_kernel void @atomic_xchg_i32_offset(i32 addrspace(1)* %out, i32 %in) {
353 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
354 %val = atomicrmw volatile xchg i32 addrspace(1)* %gep, i32 %in seq_cst
358 ; FUNC-LABEL: {{^}}atomic_xchg_i32_addr64_offset:
359 ; EG: MEM_RAT ATOMIC_XCHG_INT [[REG:T[0-9]+]]
360 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
361 define amdgpu_kernel void @atomic_xchg_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) {
363 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
364 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
365 %val = atomicrmw volatile xchg i32 addrspace(1)* %gep, i32 %in seq_cst
369 ; FUNC-LABEL: {{^}}atomic_xchg_i32:
370 ; EG: MEM_RAT ATOMIC_XCHG_INT [[REG:T[0-9]+]]
371 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
372 define amdgpu_kernel void @atomic_xchg_i32(i32 addrspace(1)* %out, i32 %in) {
374 %val = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in seq_cst
378 ; FUNC-LABEL: {{^}}atomic_xchg_i32_addr64:
379 ; EG: MEM_RAT ATOMIC_XCHG_INT [[REG:T[0-9]+]]
380 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
381 define amdgpu_kernel void @atomic_xchg_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) {
383 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
384 %val = atomicrmw volatile xchg i32 addrspace(1)* %ptr, i32 %in seq_cst
388 ; FUNC-LABEL: {{^}}atomic_cmpxchg_i32_offset:
389 ; EG: MEM_RAT ATOMIC_CMPXCHG_INT [[REG:T[0-9]+]]
390 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
391 define amdgpu_kernel void @atomic_cmpxchg_i32_offset(i32 addrspace(1)* %out, i32 %in, i32 %old) {
393 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
394 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in seq_cst seq_cst
398 ; FUNC-LABEL: {{^}}atomic_cmpxchg_i32_addr64_offset:
399 ; EG: MEM_RAT ATOMIC_CMPXCHG_INT [[REG:T[0-9]+]]
400 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
401 define amdgpu_kernel void @atomic_cmpxchg_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index, i32 %old) {
403 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
404 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
405 %val = cmpxchg volatile i32 addrspace(1)* %gep, i32 %old, i32 %in seq_cst seq_cst
409 ; FUNC-LABEL: {{^}}atomic_cmpxchg_i32:
410 ; EG: MEM_RAT ATOMIC_CMPXCHG_INT [[REG:T[0-9]+]]
411 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
412 define amdgpu_kernel void @atomic_cmpxchg_i32(i32 addrspace(1)* %out, i32 %in, i32 %old) {
414 %val = cmpxchg volatile i32 addrspace(1)* %out, i32 %old, i32 %in seq_cst seq_cst
418 ; FUNC-LABEL: {{^}}atomic_cmpxchg_i32_addr64:
419 ; EG: MEM_RAT ATOMIC_CMPXCHG_INT [[REG:T[0-9]+]]
420 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
421 define amdgpu_kernel void @atomic_cmpxchg_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index, i32 %old) {
423 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
424 %val = cmpxchg volatile i32 addrspace(1)* %ptr, i32 %old, i32 %in seq_cst seq_cst
428 ; FUNC-LABEL: {{^}}atomic_xor_i32_offset:
429 ; EG: MEM_RAT ATOMIC_XOR [[REG:T[0-9]+]]
430 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
431 define amdgpu_kernel void @atomic_xor_i32_offset(i32 addrspace(1)* %out, i32 %in) {
433 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
434 %val = atomicrmw volatile xor i32 addrspace(1)* %gep, i32 %in seq_cst
438 ; FUNC-LABEL: {{^}}atomic_xor_i32_addr64_offset:
439 ; EG: MEM_RAT ATOMIC_XOR [[REG:T[0-9]+]]
440 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
441 define amdgpu_kernel void @atomic_xor_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) {
443 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
444 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
445 %val = atomicrmw volatile xor i32 addrspace(1)* %gep, i32 %in seq_cst
449 ; FUNC-LABEL: {{^}}atomic_xor_i32:
450 ; EG: MEM_RAT ATOMIC_XOR [[REG:T[0-9]+]]
451 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
452 define amdgpu_kernel void @atomic_xor_i32(i32 addrspace(1)* %out, i32 %in) {
454 %val = atomicrmw volatile xor i32 addrspace(1)* %out, i32 %in seq_cst
458 ; FUNC-LABEL: {{^}}atomic_xor_i32_addr64:
459 ; EG: MEM_RAT ATOMIC_XOR [[REG:T[0-9]+]]
460 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Z
461 define amdgpu_kernel void @atomic_xor_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) {
463 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
464 %val = atomicrmw volatile xor i32 addrspace(1)* %ptr, i32 %in seq_cst
468 ; FUNC-LABEL: {{^}}atomic_store_i32_offset:
469 ; EG: MEM_RAT ATOMIC_XCHG_INT [[REG:T[0-9]+]]
470 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Y
471 define amdgpu_kernel void @atomic_store_i32_offset(i32 %in, i32 addrspace(1)* %out) {
473 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
474 store atomic i32 %in, i32 addrspace(1)* %gep seq_cst, align 4
478 ; FUNC-LABEL: {{^}}atomic_store_i32:
479 ; EG: MEM_RAT ATOMIC_XCHG_INT [[REG:T[0-9]+]]
480 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Y
481 define amdgpu_kernel void @atomic_store_i32(i32 %in, i32 addrspace(1)* %out) {
483 store atomic i32 %in, i32 addrspace(1)* %out seq_cst, align 4
487 ; FUNC-LABEL: {{^}}atomic_store_i32_addr64_offset:
488 ; EG: MEM_RAT ATOMIC_XCHG_INT [[REG:T[0-9]+]]
489 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Y
490 define amdgpu_kernel void @atomic_store_i32_addr64_offset(i32 %in, i32 addrspace(1)* %out, i64 %index) {
492 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
493 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i64 4
494 store atomic i32 %in, i32 addrspace(1)* %gep seq_cst, align 4
498 ; FUNC-LABEL: {{^}}atomic_store_i32_addr64:
499 ; EG: MEM_RAT ATOMIC_XCHG_INT [[REG:T[0-9]+]]
500 ; EG: MOV{{[ *]*}}[[REG]].X, KC0[2].Y
501 define amdgpu_kernel void @atomic_store_i32_addr64(i32 %in, i32 addrspace(1)* %out, i64 %index) {
503 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index
504 store atomic i32 %in, i32 addrspace(1)* %ptr seq_cst, align 4
508 ; FUNC-LABEL: {{^}}atomic_inc_add
509 ; EG: MEM_RAT ATOMIC_INC_UINT
510 define amdgpu_kernel void @atomic_inc_add(i32 addrspace(1)* %out) {
512 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
513 %val = atomicrmw volatile add i32 addrspace(1)* %gep, i32 1 seq_cst
517 ; FUNC-LABEL: {{^}}atomic_dec_add
518 ; EG: MEM_RAT ATOMIC_DEC_UINT
519 define amdgpu_kernel void @atomic_dec_add(i32 addrspace(1)* %out) {
521 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
522 %val = atomicrmw volatile add i32 addrspace(1)* %gep, i32 -1 seq_cst
526 ; FUNC-LABEL: {{^}}atomic_inc_sub
527 ; EG: MEM_RAT ATOMIC_INC_UINT
528 define amdgpu_kernel void @atomic_inc_sub(i32 addrspace(1)* %out) {
530 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
531 %val = atomicrmw volatile sub i32 addrspace(1)* %gep, i32 -1 seq_cst
535 ; FUNC-LABEL: {{^}}atomic_dec_sub
536 ; EG: MEM_RAT ATOMIC_DEC_UINT
537 define amdgpu_kernel void @atomic_dec_sub(i32 addrspace(1)* %out) {
539 %gep = getelementptr i32, i32 addrspace(1)* %out, i64 4
540 %val = atomicrmw volatile sub i32 addrspace(1)* %gep, i32 1 seq_cst