1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=GFX8 -check-prefix=NOAUTO %s 2; RUN: llc -march=amdgcn -mattr=+auto-waitcnt-before-barrier -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=GFX8 -check-prefix=AUTO %s 3; RUN: llc -march=amdgcn -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=GFX9 -check-prefix=NOAUTO %s 4; RUN: llc -march=amdgcn -mcpu=gfx900 -mattr=+auto-waitcnt-before-barrier -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=GFX9 -check-prefix=AUTO %s 5 6; GCN-LABEL: {{^}}test_barrier: 7; GFX8: buffer_store_dword 8; GFX9: global_store_dword 9; NOAUTO: s_waitcnt 10; AUTO-NOT: s_waitcnt 11; GCN: s_barrier 12define amdgpu_kernel void @test_barrier(i32 addrspace(1)* %out, i32 %size) #0 { 13entry: 14 %tmp = call i32 @llvm.amdgcn.workitem.id.x() 15 %tmp1 = getelementptr i32, i32 addrspace(1)* %out, i32 %tmp 16 store i32 %tmp, i32 addrspace(1)* %tmp1 17 call void @llvm.amdgcn.s.barrier() 18 %tmp3 = sub i32 %size, 1 19 %tmp4 = sub i32 %tmp3, %tmp 20 %tmp5 = getelementptr i32, i32 addrspace(1)* %out, i32 %tmp4 21 %tmp6 = load i32, i32 addrspace(1)* %tmp5 22 store i32 %tmp6, i32 addrspace(1)* %tmp1 23 ret void 24} 25 26declare void @llvm.amdgcn.s.barrier() #1 27declare i32 @llvm.amdgcn.workitem.id.x() #2 28 29attributes #0 = { nounwind } 30attributes #1 = { convergent nounwind } 31attributes #2 = { nounwind readnone } 32