[PowerPC] Recommit r314244 with refactoring and off by default
[llvm-core.git] / test / CodeGen / AMDGPU / memory-legalizer-atomic-fence.ll
bloba563cfd028311ff67dec88ef81ac1b5095822e4e
1 ; RUN: llc -mtriple=amdgcn-amd- -mcpu=gfx600 -verify-machineinstrs < %s | FileCheck -check-prefix=FUNC -check-prefix=GCN -check-prefix=GFX6 %s
2 ; RUN: llc -mtriple=amdgcn-amd- -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefix=FUNC -check-prefix=GCN -check-prefix=GFX8 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -verify-machineinstrs < %s | FileCheck -check-prefix=FUNC -check-prefix=GCN -check-prefix=GFX8 %s
5 ; FUNC-LABEL: {{^}}system_acquire
6 ; GCN:        BB#0
7 ; GCN-NOT:    ATOMIC_FENCE
8 ; GFX6:       s_waitcnt vmcnt(0){{$}}
9 ; GFX6-NEXT:  buffer_wbinvl1{{$}}
10 ; GFX8:       s_waitcnt vmcnt(0){{$}}
11 ; GFX8-NEXT:  buffer_wbinvl1_vol{{$}}
12 ; GCN:        s_endpgm
13 define amdgpu_kernel void @system_acquire() {
14 entry:
15   fence acquire
16   ret void
19 ; FUNC-LABEL: {{^}}system_release
20 ; GCN:        BB#0
21 ; GCN-NOT:    ATOMIC_FENCE
22 ; GCN:        s_waitcnt vmcnt(0){{$}}
23 ; GCN:        s_endpgm
24 define amdgpu_kernel void @system_release() {
25 entry:
26   fence release
27   ret void
30 ; FUNC-LABEL: {{^}}system_acq_rel
31 ; GCN:        BB#0
32 ; GCN-NOT:    ATOMIC_FENCE
33 ; GCN:        s_waitcnt vmcnt(0){{$}}
34 ; GFX6:       buffer_wbinvl1{{$}}
35 ; GFX8:       buffer_wbinvl1_vol{{$}}
36 ; GCN:        s_endpgm
37 define amdgpu_kernel void @system_acq_rel() {
38 entry:
39   fence acq_rel
40   ret void
43 ; FUNC-LABEL: {{^}}system_seq_cst
44 ; GCN:        BB#0
45 ; GCN-NOT:    ATOMIC_FENCE
46 ; GCN:        s_waitcnt vmcnt(0){{$}}
47 ; GFX6:       buffer_wbinvl1{{$}}
48 ; GFX8:       buffer_wbinvl1_vol{{$}}
49 ; GCN:        s_endpgm
50 define amdgpu_kernel void @system_seq_cst() {
51 entry:
52   fence seq_cst
53   ret void
56 ; FUNC-LABEL: {{^}}singlethread_acquire
57 ; GCN:        BB#0
58 ; GCN-NOT:    ATOMIC_FENCE
59 ; GCN:        s_endpgm
60 define amdgpu_kernel void @singlethread_acquire() {
61 entry:
62   fence syncscope("singlethread") acquire
63   ret void
66 ; FUNC-LABEL: {{^}}singlethread_release
67 ; GCN:        BB#0
68 ; GCN-NOT:    ATOMIC_FENCE
69 ; GCN:        s_endpgm
70 define amdgpu_kernel void @singlethread_release() {
71 entry:
72   fence syncscope("singlethread") release
73   ret void
76 ; FUNC-LABEL: {{^}}singlethread_acq_rel
77 ; GCN:        BB#0
78 ; GCN-NOT:    ATOMIC_FENCE
79 ; GCN:        s_endpgm
80 define amdgpu_kernel void @singlethread_acq_rel() {
81 entry:
82   fence syncscope("singlethread") acq_rel
83   ret void
86 ; FUNC-LABEL: {{^}}singlethread_seq_cst
87 ; GCN:        BB#0
88 ; GCN-NOT:    ATOMIC_FENCE
89 ; GCN:        s_endpgm
90 define amdgpu_kernel void @singlethread_seq_cst() {
91 entry:
92   fence syncscope("singlethread") seq_cst
93   ret void
96 ; FUNC-LABEL: {{^}}agent_acquire
97 ; GCN:        BB#0
98 ; GCN-NOT:    ATOMIC_FENCE
99 ; GFX6:       s_waitcnt vmcnt(0){{$}}
100 ; GFX6-NEXT:  buffer_wbinvl1{{$}}
101 ; GFX8:       s_waitcnt vmcnt(0){{$}}
102 ; GFX8-NEXT:  buffer_wbinvl1_vol{{$}}
103 ; GCN:        s_endpgm
104 define amdgpu_kernel void @agent_acquire() {
105 entry:
106   fence syncscope("agent") acquire
107   ret void
110 ; FUNC-LABEL: {{^}}agent_release
111 ; GCN:        BB#0
112 ; GCN-NOT:    ATOMIC_FENCE
113 ; GCN:        s_waitcnt vmcnt(0){{$}}
114 ; GCN:        s_endpgm
115 define amdgpu_kernel void @agent_release() {
116 entry:
117   fence syncscope("agent") release
118   ret void
121 ; FUNC-LABEL: {{^}}agent_acq_rel
122 ; GCN:        BB#0
123 ; GCN-NOT:    ATOMIC_FENCE
124 ; GCN:        s_waitcnt vmcnt(0){{$}}
125 ; GFX6:       buffer_wbinvl1{{$}}
126 ; GFX8:       buffer_wbinvl1_vol{{$}}
127 ; GCN:        s_endpgm
128 define amdgpu_kernel void @agent_acq_rel() {
129 entry:
130   fence syncscope("agent") acq_rel
131   ret void
134 ; FUNC-LABEL: {{^}}agent_seq_cst
135 ; GCN:        BB#0
136 ; GCN-NOT:    ATOMIC_FENCE
137 ; GCN:        s_waitcnt vmcnt(0){{$}}
138 ; GFX6:       buffer_wbinvl1{{$}}
139 ; GFX8:       buffer_wbinvl1_vol{{$}}
140 ; GCN:        s_endpgm
141 define amdgpu_kernel void @agent_seq_cst() {
142 entry:
143   fence syncscope("agent") seq_cst
144   ret void
147 ; FUNC-LABEL: {{^}}workgroup_acquire
148 ; GCN:        BB#0
149 ; GCN-NOT:    ATOMIC_FENCE
150 ; GCN:        s_endpgm
151 define amdgpu_kernel void @workgroup_acquire() {
152 entry:
153   fence syncscope("workgroup") acquire
154   ret void
157 ; FUNC-LABEL: {{^}}workgroup_release
158 ; GCN:        BB#0
159 ; GCN-NOT:    ATOMIC_FENCE
160 ; GCN:        s_endpgm
161 define amdgpu_kernel void @workgroup_release() {
162 entry:
163   fence syncscope("workgroup") release
164   ret void
167 ; FUNC-LABEL: {{^}}workgroup_acq_rel
168 ; GCN:        BB#0
169 ; GCN-NOT:    ATOMIC_FENCE
170 ; GCN:        s_endpgm
171 define amdgpu_kernel void @workgroup_acq_rel() {
172 entry:
173   fence syncscope("workgroup") acq_rel
174   ret void
177 ; FUNC-LABEL: {{^}}workgroup_seq_cst
178 ; GCN:        BB#0
179 ; GCN-NOT:    ATOMIC_FENCE
180 ; GCN:        s_endpgm
181 define amdgpu_kernel void @workgroup_seq_cst() {
182 entry:
183   fence syncscope("workgroup") seq_cst
184   ret void
187 ; FUNC-LABEL: {{^}}wavefront_acquire
188 ; GCN:        BB#0
189 ; GCN-NOT:    ATOMIC_FENCE
190 ; GCN:        s_endpgm
191 define amdgpu_kernel void @wavefront_acquire() {
192 entry:
193   fence syncscope("wavefront") acquire
194   ret void
197 ; FUNC-LABEL: {{^}}wavefront_release
198 ; GCN:        BB#0
199 ; GCN-NOT:    ATOMIC_FENCE
200 ; GCN:        s_endpgm
201 define amdgpu_kernel void @wavefront_release() {
202 entry:
203   fence syncscope("wavefront") release
204   ret void
207 ; FUNC-LABEL: {{^}}wavefront_acq_rel
208 ; GCN:        BB#0
209 ; GCN-NOT:    ATOMIC_FENCE
210 ; GCN:        s_endpgm
211 define amdgpu_kernel void @wavefront_acq_rel() {
212 entry:
213   fence syncscope("wavefront") acq_rel
214   ret void
217 ; FUNC-LABEL: {{^}}wavefront_seq_cst
218 ; GCN:        BB#0
219 ; GCN-NOT:    ATOMIC_FENCE
220 ; GCN:        s_endpgm
221 define amdgpu_kernel void @wavefront_seq_cst() {
222 entry:
223   fence syncscope("wavefront") seq_cst
224   ret void