1; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2; RUN: llc -global-isel -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs -stop-after=irtranslator < %s | FileCheck %s 3 4define amdgpu_kernel void @system_one_as_acquire() { 5 ; CHECK-LABEL: name: system_one_as_acquire 6 ; CHECK: bb.1 (%ir-block.0): 7 ; CHECK: G_FENCE 4, 2 8 ; CHECK: S_ENDPGM 0 9 fence syncscope("one-as") acquire 10 ret void 11} 12 13define amdgpu_kernel void @system_one_as_release() { 14 ; CHECK-LABEL: name: system_one_as_release 15 ; CHECK: bb.1 (%ir-block.0): 16 ; CHECK: G_FENCE 5, 2 17 ; CHECK: S_ENDPGM 0 18 fence syncscope("one-as") release 19 ret void 20} 21 22define amdgpu_kernel void @system_one_as_acq_rel() { 23 ; CHECK-LABEL: name: system_one_as_acq_rel 24 ; CHECK: bb.1 (%ir-block.0): 25 ; CHECK: G_FENCE 6, 2 26 ; CHECK: S_ENDPGM 0 27 fence syncscope("one-as") acq_rel 28 ret void 29} 30 31define amdgpu_kernel void @system_one_as_seq_cst() { 32 ; CHECK-LABEL: name: system_one_as_seq_cst 33 ; CHECK: bb.1 (%ir-block.0): 34 ; CHECK: G_FENCE 7, 2 35 ; CHECK: S_ENDPGM 0 36 fence syncscope("one-as") seq_cst 37 ret void 38} 39 40define amdgpu_kernel void @singlethread_one_as_acquire() { 41 ; CHECK-LABEL: name: singlethread_one_as_acquire 42 ; CHECK: bb.1 (%ir-block.0): 43 ; CHECK: G_FENCE 4, 3 44 ; CHECK: S_ENDPGM 0 45 fence syncscope("singlethread-one-as") acquire 46 ret void 47} 48 49define amdgpu_kernel void @singlethread_one_as_release() { 50 ; CHECK-LABEL: name: singlethread_one_as_release 51 ; CHECK: bb.1 (%ir-block.0): 52 ; CHECK: G_FENCE 5, 3 53 ; CHECK: S_ENDPGM 0 54 fence syncscope("singlethread-one-as") release 55 ret void 56} 57 58define amdgpu_kernel void @singlethread_one_as_acq_rel() { 59 ; CHECK-LABEL: name: singlethread_one_as_acq_rel 60 ; CHECK: bb.1 (%ir-block.0): 61 ; CHECK: G_FENCE 6, 3 62 ; CHECK: S_ENDPGM 0 63 fence syncscope("singlethread-one-as") acq_rel 64 ret void 65} 66 67define amdgpu_kernel void @singlethread_one_as_seq_cst() { 68 ; CHECK-LABEL: name: singlethread_one_as_seq_cst 69 ; CHECK: bb.1 (%ir-block.0): 70 ; CHECK: G_FENCE 7, 3 71 ; CHECK: S_ENDPGM 0 72 fence syncscope("singlethread-one-as") seq_cst 73 ret void 74} 75 76define amdgpu_kernel void @agent_one_as_acquire() { 77 ; CHECK-LABEL: name: agent_one_as_acquire 78 ; CHECK: bb.1 (%ir-block.0): 79 ; CHECK: G_FENCE 4, 4 80 ; CHECK: S_ENDPGM 0 81 fence syncscope("agent-one-as") acquire 82 ret void 83} 84 85define amdgpu_kernel void @agent_one_as_release() { 86 ; CHECK-LABEL: name: agent_one_as_release 87 ; CHECK: bb.1 (%ir-block.0): 88 ; CHECK: G_FENCE 5, 4 89 ; CHECK: S_ENDPGM 0 90 fence syncscope("agent-one-as") release 91 ret void 92} 93 94define amdgpu_kernel void @agent_one_as_acq_rel() { 95 ; CHECK-LABEL: name: agent_one_as_acq_rel 96 ; CHECK: bb.1 (%ir-block.0): 97 ; CHECK: G_FENCE 6, 4 98 ; CHECK: S_ENDPGM 0 99 fence syncscope("agent-one-as") acq_rel 100 ret void 101} 102 103define amdgpu_kernel void @agent_one_as_seq_cst() { 104 ; CHECK-LABEL: name: agent_one_as_seq_cst 105 ; CHECK: bb.1 (%ir-block.0): 106 ; CHECK: G_FENCE 7, 4 107 ; CHECK: S_ENDPGM 0 108 fence syncscope("agent-one-as") seq_cst 109 ret void 110} 111 112define amdgpu_kernel void @workgroup_one_as_acquire() { 113 ; CHECK-LABEL: name: workgroup_one_as_acquire 114 ; CHECK: bb.1 (%ir-block.0): 115 ; CHECK: G_FENCE 4, 5 116 ; CHECK: S_ENDPGM 0 117 fence syncscope("workgroup-one-as") acquire 118 ret void 119} 120 121define amdgpu_kernel void @workgroup_one_as_release() { 122 ; CHECK-LABEL: name: workgroup_one_as_release 123 ; CHECK: bb.1 (%ir-block.0): 124 ; CHECK: G_FENCE 5, 5 125 ; CHECK: S_ENDPGM 0 126 fence syncscope("workgroup-one-as") release 127 ret void 128} 129 130define amdgpu_kernel void @workgroup_one_as_acq_rel() { 131 ; CHECK-LABEL: name: workgroup_one_as_acq_rel 132 ; CHECK: bb.1 (%ir-block.0): 133 ; CHECK: G_FENCE 6, 5 134 ; CHECK: S_ENDPGM 0 135 fence syncscope("workgroup-one-as") acq_rel 136 ret void 137} 138 139define amdgpu_kernel void @workgroup_one_as_seq_cst() { 140 ; CHECK-LABEL: name: workgroup_one_as_seq_cst 141 ; CHECK: bb.1 (%ir-block.0): 142 ; CHECK: G_FENCE 7, 5 143 ; CHECK: S_ENDPGM 0 144 fence syncscope("workgroup-one-as") seq_cst 145 ret void 146} 147 148define amdgpu_kernel void @wavefront_one_as_acquire() { 149 ; CHECK-LABEL: name: wavefront_one_as_acquire 150 ; CHECK: bb.1 (%ir-block.0): 151 ; CHECK: G_FENCE 4, 6 152 ; CHECK: S_ENDPGM 0 153 fence syncscope("wavefront-one-as") acquire 154 ret void 155} 156 157define amdgpu_kernel void @wavefront_one_as_release() { 158 ; CHECK-LABEL: name: wavefront_one_as_release 159 ; CHECK: bb.1 (%ir-block.0): 160 ; CHECK: G_FENCE 5, 6 161 ; CHECK: S_ENDPGM 0 162 fence syncscope("wavefront-one-as") release 163 ret void 164} 165 166define amdgpu_kernel void @wavefront_one_as_acq_rel() { 167 ; CHECK-LABEL: name: wavefront_one_as_acq_rel 168 ; CHECK: bb.1 (%ir-block.0): 169 ; CHECK: G_FENCE 6, 6 170 ; CHECK: S_ENDPGM 0 171 fence syncscope("wavefront-one-as") acq_rel 172 ret void 173} 174 175define amdgpu_kernel void @wavefront_one_as_seq_cst() { 176 ; CHECK-LABEL: name: wavefront_one_as_seq_cst 177 ; CHECK: bb.1 (%ir-block.0): 178 ; CHECK: G_FENCE 7, 6 179 ; CHECK: S_ENDPGM 0 180 fence syncscope("wavefront-one-as") seq_cst 181 ret void 182} 183 184define amdgpu_kernel void @system_acquire() { 185 ; CHECK-LABEL: name: system_acquire 186 ; CHECK: bb.1.entry: 187 ; CHECK: S_ENDPGM 0 188entry: 189 ret void 190} 191 192define amdgpu_kernel void @system_release() { 193 ; CHECK-LABEL: name: system_release 194 ; CHECK: bb.1 (%ir-block.0): 195 ; CHECK: G_FENCE 5, 1 196 ; CHECK: S_ENDPGM 0 197 fence release 198 ret void 199} 200 201define amdgpu_kernel void @system_acq_rel() { 202 ; CHECK-LABEL: name: system_acq_rel 203 ; CHECK: bb.1 (%ir-block.0): 204 ; CHECK: G_FENCE 6, 1 205 ; CHECK: S_ENDPGM 0 206 fence acq_rel 207 ret void 208} 209 210define amdgpu_kernel void @system_seq_cst() { 211 ; CHECK-LABEL: name: system_seq_cst 212 ; CHECK: bb.1 (%ir-block.0): 213 ; CHECK: G_FENCE 7, 1 214 ; CHECK: S_ENDPGM 0 215 fence seq_cst 216 ret void 217} 218 219define amdgpu_kernel void @singlethread_acquire() { 220 ; CHECK-LABEL: name: singlethread_acquire 221 ; CHECK: bb.1 (%ir-block.0): 222 ; CHECK: G_FENCE 4, 0 223 ; CHECK: S_ENDPGM 0 224 fence syncscope("singlethread") acquire 225 ret void 226} 227 228define amdgpu_kernel void @singlethread_release() { 229 ; CHECK-LABEL: name: singlethread_release 230 ; CHECK: bb.1 (%ir-block.0): 231 ; CHECK: G_FENCE 5, 0 232 ; CHECK: S_ENDPGM 0 233 fence syncscope("singlethread") release 234 ret void 235} 236 237define amdgpu_kernel void @singlethread_acq_rel() { 238 ; CHECK-LABEL: name: singlethread_acq_rel 239 ; CHECK: bb.1 (%ir-block.0): 240 ; CHECK: G_FENCE 6, 0 241 ; CHECK: S_ENDPGM 0 242 fence syncscope("singlethread") acq_rel 243 ret void 244} 245 246define amdgpu_kernel void @singlethread_seq_cst() { 247 ; CHECK-LABEL: name: singlethread_seq_cst 248 ; CHECK: bb.1 (%ir-block.0): 249 ; CHECK: G_FENCE 7, 0 250 ; CHECK: S_ENDPGM 0 251 fence syncscope("singlethread") seq_cst 252 ret void 253} 254 255define amdgpu_kernel void @agent_acquire() { 256 ; CHECK-LABEL: name: agent_acquire 257 ; CHECK: bb.1 (%ir-block.0): 258 ; CHECK: G_FENCE 4, 7 259 ; CHECK: S_ENDPGM 0 260 fence syncscope("agent") acquire 261 ret void 262} 263 264define amdgpu_kernel void @agent_release() { 265 ; CHECK-LABEL: name: agent_release 266 ; CHECK: bb.1 (%ir-block.0): 267 ; CHECK: G_FENCE 5, 7 268 ; CHECK: S_ENDPGM 0 269 fence syncscope("agent") release 270 ret void 271} 272 273define amdgpu_kernel void @agent_acq_rel() { 274 ; CHECK-LABEL: name: agent_acq_rel 275 ; CHECK: bb.1 (%ir-block.0): 276 ; CHECK: G_FENCE 6, 7 277 ; CHECK: S_ENDPGM 0 278 fence syncscope("agent") acq_rel 279 ret void 280} 281 282define amdgpu_kernel void @agent_seq_cst() { 283 ; CHECK-LABEL: name: agent_seq_cst 284 ; CHECK: bb.1 (%ir-block.0): 285 ; CHECK: G_FENCE 7, 7 286 ; CHECK: S_ENDPGM 0 287 fence syncscope("agent") seq_cst 288 ret void 289} 290 291define amdgpu_kernel void @workgroup_acquire() { 292 ; CHECK-LABEL: name: workgroup_acquire 293 ; CHECK: bb.1 (%ir-block.0): 294 ; CHECK: G_FENCE 4, 8 295 ; CHECK: S_ENDPGM 0 296 fence syncscope("workgroup") acquire 297 ret void 298} 299 300define amdgpu_kernel void @workgroup_release() { 301 ; CHECK-LABEL: name: workgroup_release 302 ; CHECK: bb.1 (%ir-block.0): 303 ; CHECK: G_FENCE 5, 8 304 ; CHECK: S_ENDPGM 0 305 fence syncscope("workgroup") release 306 ret void 307} 308 309define amdgpu_kernel void @workgroup_acq_rel() { 310 ; CHECK-LABEL: name: workgroup_acq_rel 311 ; CHECK: bb.1 (%ir-block.0): 312 ; CHECK: G_FENCE 6, 8 313 ; CHECK: S_ENDPGM 0 314 fence syncscope("workgroup") acq_rel 315 ret void 316} 317 318define amdgpu_kernel void @workgroup_seq_cst() { 319 ; CHECK-LABEL: name: workgroup_seq_cst 320 ; CHECK: bb.1 (%ir-block.0): 321 ; CHECK: G_FENCE 7, 8 322 ; CHECK: S_ENDPGM 0 323 fence syncscope("workgroup") seq_cst 324 ret void 325} 326 327define amdgpu_kernel void @wavefront_acquire() { 328 ; CHECK-LABEL: name: wavefront_acquire 329 ; CHECK: bb.1 (%ir-block.0): 330 ; CHECK: G_FENCE 4, 9 331 ; CHECK: S_ENDPGM 0 332 fence syncscope("wavefront") acquire 333 ret void 334} 335 336define amdgpu_kernel void @wavefront_release() { 337 ; CHECK-LABEL: name: wavefront_release 338 ; CHECK: bb.1 (%ir-block.0): 339 ; CHECK: G_FENCE 5, 9 340 ; CHECK: S_ENDPGM 0 341 fence syncscope("wavefront") release 342 ret void 343} 344 345define amdgpu_kernel void @wavefront_acq_rel() { 346 ; CHECK-LABEL: name: wavefront_acq_rel 347 ; CHECK: bb.1 (%ir-block.0): 348 ; CHECK: G_FENCE 6, 9 349 ; CHECK: S_ENDPGM 0 350 fence syncscope("wavefront") acq_rel 351 ret void 352} 353 354define amdgpu_kernel void @wavefront_seq_cst() { 355 ; CHECK-LABEL: name: wavefront_seq_cst 356 ; CHECK: bb.1 (%ir-block.0): 357 ; CHECK: G_FENCE 7, 9 358 ; CHECK: S_ENDPGM 0 359 fence syncscope("wavefront") seq_cst 360 ret void 361} 362