File: barrier_impl.ll

package info (click to toggle)
libclc 0.2.0%2Bgit20160907-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,540 kB
  • ctags: 968
  • sloc: lisp: 7,842; ansic: 1,787; python: 623; cpp: 74; makefile: 10; pascal: 7; sh: 1
file content (32 lines) | stat: -rw-r--r-- 898 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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 }