summaryrefslogtreecommitdiff
path: root/amdgcn
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2016-02-13 01:01:59 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2016-02-13 01:01:59 +0000
commitba011288a9659d57736956c47b8522eace520807 (patch)
tree9b09f077808a5517692f892bf2847663c3881ca4 /amdgcn
parentb518692b52a0bbdf9cf0e2167b9629dd9501abcd (diff)
Split sources for amdgcn and r600
Most files remain in a common amdgpu directory. Also switches barriers to to use convergent, and use llvm.amdgcn.s.barrier. This now requires 3.9/trunk to build amdgcn. git-svn-id: https://llvm.org/svn/llvm-project/libclc/trunk@260777 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'amdgcn')
-rw-r--r--amdgcn/lib/OVERRIDES0
-rw-r--r--amdgcn/lib/SOURCES1
-rw-r--r--amdgcn/lib/synchronization/barrier_impl.ll32
3 files changed, 33 insertions, 0 deletions
diff --git a/amdgcn/lib/OVERRIDES b/amdgcn/lib/OVERRIDES
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/amdgcn/lib/OVERRIDES
diff --git a/amdgcn/lib/SOURCES b/amdgcn/lib/SOURCES
new file mode 100644
index 0000000..c99f3fc
--- /dev/null
+++ b/amdgcn/lib/SOURCES
@@ -0,0 +1 @@
+synchronization/barrier_impl.ll
diff --git a/amdgcn/lib/synchronization/barrier_impl.ll b/amdgcn/lib/synchronization/barrier_impl.ll
new file mode 100644
index 0000000..1809edd
--- /dev/null
+++ b/amdgcn/lib/synchronization/barrier_impl.ll
@@ -0,0 +1,32 @@
+declare i32 @__clc_clk_local_mem_fence() #1
+declare i32 @__clc_clk_global_mem_fence() #1
+declare void @llvm.amdgcn.s.barrier() #0
+
+define void @barrier(i32 %flags) #2 {
+barrier_local_test:
+ %CLK_LOCAL_MEM_FENCE = call i32 @__clc_clk_local_mem_fence()
+ %0 = and i32 %flags, %CLK_LOCAL_MEM_FENCE
+ %1 = icmp ne i32 %0, 0
+ br i1 %1, label %barrier_local, label %barrier_global_test
+
+barrier_local:
+ call void @llvm.amdgcn.s.barrier()
+ br label %barrier_global_test
+
+barrier_global_test:
+ %CLK_GLOBAL_MEM_FENCE = call i32 @__clc_clk_global_mem_fence()
+ %2 = and i32 %flags, %CLK_GLOBAL_MEM_FENCE
+ %3 = icmp ne i32 %2, 0
+ br i1 %3, label %barrier_global, label %done
+
+barrier_global:
+ call void @llvm.amdgcn.s.barrier()
+ br label %done
+
+done:
+ ret void
+}
+
+attributes #0 = { nounwind convergent }
+attributes #1 = { nounwind alwaysinline }
+attributes #2 = { nounwind convergent alwaysinline }