From 6f8e5151853f7387bb4060b18a7cbe707b72c912 Mon Sep 17 00:00:00 2001 From: Konstantin Zhuravlyov Date: Thu, 26 Oct 2017 17:54:09 +0000 Subject: [PATCH] AMDGPU: Commit missing fence-barrier test This should have been committed with memory model implementation llvm-svn: 316680 --- llvm/test/CodeGen/AMDGPU/fence-barrier.ll | 197 ++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 llvm/test/CodeGen/AMDGPU/fence-barrier.ll diff --git a/llvm/test/CodeGen/AMDGPU/fence-barrier.ll b/llvm/test/CodeGen/AMDGPU/fence-barrier.ll new file mode 100644 index 000000000000..4748de570a96 --- /dev/null +++ b/llvm/test/CodeGen/AMDGPU/fence-barrier.ll @@ -0,0 +1,197 @@ +; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -enable-si-insert-waitcnts=1 -verify-machineinstrs < %s | FileCheck --check-prefix=GCN %s + +declare i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() +declare i8 addrspace(2)* @llvm.amdgcn.implicitarg.ptr() +declare i32 @llvm.amdgcn.workitem.id.x() +declare i32 @llvm.amdgcn.workgroup.id.x() +declare void @llvm.amdgcn.s.barrier() + +@test_local.temp = internal addrspace(3) global [1 x i32] undef, align 4 +@test_global_local.temp = internal addrspace(3) global [1 x i32] undef, align 4 + +; GCN-LABEL: {{^}}test_local +; GCN: v_mov_b32_e32 v[[VAL:[0-9]+]], 0x777 +; GCN: ds_write_b32 v{{[0-9]+}}, v[[VAL]] +; GCN: s_waitcnt lgkmcnt(0){{$}} +; GCN-NEXT: s_barrier +; GCN: flat_store_dword +define amdgpu_kernel void @test_local(i32 addrspace(1)*) { + %2 = alloca i32 addrspace(1)*, align 4 + store i32 addrspace(1)* %0, i32 addrspace(1)** %2, align 4 + %3 = call i32 @llvm.amdgcn.workitem.id.x() + %4 = zext i32 %3 to i64 + %5 = icmp eq i64 %4, 0 + br i1 %5, label %6, label %7 + +;