1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=hawaii -O0 -run-pass=legalizer %s -o - | FileCheck %s
3
4---
5name: test_atomic_cmpxchg_with_success_s32_global
6body: |
7  bb.0:
8    liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3
9
10    ; CHECK-LABEL: name: test_atomic_cmpxchg_with_success_s32_global
11    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
12    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
13    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr3
14    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY2]](s32), [[COPY1]](s32)
15    ; CHECK: [[AMDGPU_ATOMIC_CMPXCHG:%[0-9]+]]:_(s32) = G_AMDGPU_ATOMIC_CMPXCHG [[COPY]](p1), [[BUILD_VECTOR]] :: (load store syncscope("agent-one-as") monotonic monotonic 4, addrspace 1)
16    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[AMDGPU_ATOMIC_CMPXCHG]](s32), [[COPY1]]
17    ; CHECK: S_ENDPGM 0, implicit [[AMDGPU_ATOMIC_CMPXCHG]](s32), implicit [[ICMP]](s1)
18  %0:_(p1) = COPY $vgpr0_vgpr1
19  %1:_(s32) = COPY $vgpr2
20  %2:_(s32) = COPY $vgpr3
21  %3:_(s32), %4:_(s1) = G_ATOMIC_CMPXCHG_WITH_SUCCESS %0, %1, %2 :: (load store syncscope("agent-one-as") monotonic monotonic 4, addrspace 1)
22  S_ENDPGM 0, implicit %3, implicit %4
23
24...
25
26---
27name: test_atomic_cmpxchg_with_success_s32_flat
28body: |
29  bb.0:
30    liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3
31
32    ; CHECK-LABEL: name: test_atomic_cmpxchg_with_success_s32_flat
33    ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $vgpr0_vgpr1
34    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr2
35    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr3
36    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY2]](s32), [[COPY1]](s32)
37    ; CHECK: [[AMDGPU_ATOMIC_CMPXCHG:%[0-9]+]]:_(s32) = G_AMDGPU_ATOMIC_CMPXCHG [[COPY]](p0), [[BUILD_VECTOR]] :: (load store syncscope("agent-one-as") monotonic monotonic 4)
38    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[AMDGPU_ATOMIC_CMPXCHG]](s32), [[COPY1]]
39    ; CHECK: S_ENDPGM 0, implicit [[AMDGPU_ATOMIC_CMPXCHG]](s32), implicit [[ICMP]](s1)
40  %0:_(p0) = COPY $vgpr0_vgpr1
41  %1:_(s32) = COPY $vgpr2
42  %2:_(s32) = COPY $vgpr3
43  %3:_(s32), %4:_(s1) = G_ATOMIC_CMPXCHG_WITH_SUCCESS %0, %1, %2 :: (load store syncscope("agent-one-as") monotonic monotonic 4, addrspace 0)
44  S_ENDPGM 0, implicit %3, implicit %4
45
46...
47
48---
49name: test_atomic_cmpxchg_with_success_s32_local
50body: |
51  bb.0:
52    liveins: $vgpr0, $vgpr1, $vgpr2
53
54    ; CHECK-LABEL: name: test_atomic_cmpxchg_with_success_s32_local
55    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
56    ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
57    ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
58    ; CHECK: [[ATOMIC_CMPXCHG:%[0-9]+]]:_(s32) = G_ATOMIC_CMPXCHG [[COPY]](p3), [[COPY1]], [[COPY2]] :: (load store syncscope("agent-one-as") monotonic monotonic 4, addrspace 3)
59    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[ATOMIC_CMPXCHG]](s32), [[COPY1]]
60    ; CHECK: S_ENDPGM 0, implicit [[ATOMIC_CMPXCHG]](s32), implicit [[ICMP]](s1)
61  %0:_(p3) = COPY $vgpr0
62  %1:_(s32) = COPY $vgpr1
63  %2:_(s32) = COPY $vgpr2
64  %3:_(s32), %4:_(s1) = G_ATOMIC_CMPXCHG_WITH_SUCCESS %0, %1, %2 :: (load store syncscope("agent-one-as") monotonic monotonic 4, addrspace 3)
65  S_ENDPGM 0, implicit %3, implicit %4
66
67...
68
69---
70name: test_atomic_cmpxchg_with_success_s64_global
71body: |
72  bb.0:
73    liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4_vgpr5
74
75    ; CHECK-LABEL: name: test_atomic_cmpxchg_with_success_s64_global
76    ; CHECK: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
77    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr2_vgpr3
78    ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $vgpr4_vgpr5
79    ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[COPY2]](s64), [[COPY1]](s64)
80    ; CHECK: [[AMDGPU_ATOMIC_CMPXCHG:%[0-9]+]]:_(s64) = G_AMDGPU_ATOMIC_CMPXCHG [[COPY]](p1), [[BUILD_VECTOR]] :: (load store syncscope("agent-one-as") monotonic monotonic 8, addrspace 1)
81    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[AMDGPU_ATOMIC_CMPXCHG]](s64), [[COPY1]]
82    ; CHECK: S_ENDPGM 0, implicit [[AMDGPU_ATOMIC_CMPXCHG]](s64), implicit [[ICMP]](s1)
83  %0:_(p1) = COPY $vgpr0_vgpr1
84  %1:_(s64) = COPY $vgpr2_vgpr3
85  %2:_(s64) = COPY $vgpr4_vgpr5
86  %3:_(s64), %4:_(s1) = G_ATOMIC_CMPXCHG_WITH_SUCCESS %0, %1, %2 :: (load store syncscope("agent-one-as") monotonic monotonic 8, addrspace 1)
87  S_ENDPGM 0, implicit %3, implicit %4
88
89...
90
91---
92name: test_atomic_cmpxchg_with_success_s64_local
93body: |
94  bb.0:
95    liveins: $vgpr0, $vgpr1_vgpr2, $vgpr3_vgpr4
96
97    ; CHECK-LABEL: name: test_atomic_cmpxchg_with_success_s64_local
98    ; CHECK: [[COPY:%[0-9]+]]:_(p3) = COPY $vgpr0
99    ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $vgpr1_vgpr2
100    ; CHECK: [[COPY2:%[0-9]+]]:_(s64) = COPY $vgpr3_vgpr4
101    ; CHECK: [[ATOMIC_CMPXCHG:%[0-9]+]]:_(s64) = G_ATOMIC_CMPXCHG [[COPY]](p3), [[COPY1]], [[COPY2]] :: (load store syncscope("agent-one-as") monotonic monotonic 8, addrspace 3)
102    ; CHECK: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[ATOMIC_CMPXCHG]](s64), [[COPY1]]
103    ; CHECK: S_ENDPGM 0, implicit [[ATOMIC_CMPXCHG]](s64), implicit [[ICMP]](s1)
104  %0:_(p3) = COPY $vgpr0
105  %1:_(s64) = COPY $vgpr1_vgpr2
106  %2:_(s64) = COPY $vgpr3_vgpr4
107  %3:_(s64), %4:_(s1) = G_ATOMIC_CMPXCHG_WITH_SUCCESS %0, %1, %2 :: (load store syncscope("agent-one-as") monotonic monotonic 8, addrspace 3)
108  S_ENDPGM 0, implicit %3, implicit %4
109
110...
111