• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llvm-as %s -o %t.bc
2; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt
3; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV
4; RUN: llvm-spirv %t.bc -o %t.spv
5; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
6; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
7
8; CHECK-LLVM:      call spir_func void @_Z9mem_fencej(i32 2)
9; CHECK-LLVM-NEXT: call spir_func void @_Z9mem_fencej(i32 1)
10; CHECK-LLVM-NEXT: call spir_func void @_Z9mem_fencej(i32 4)
11; CHECK-LLVM-NEXT: call spir_func void @_Z9mem_fencej(i32 3)
12; CHECK-LLVM-NEXT: call spir_func void @_Z9mem_fencej(i32 5)
13; CHECK-LLVM-NEXT: call spir_func void @_Z9mem_fencej(i32 7)
14
15; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema1:[0-9]+]] 512
16; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema2:[0-9]+]] 256
17; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema3:[0-9]+]] 2048
18; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema4:[0-9]+]] 768
19; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema5:[0-9]+]] 2304
20; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema6:[0-9]+]] 2816
21; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[ScopeWorkGroup:[0-9]+]] 2
22
23; CHECK-SPIRV: 3 MemoryBarrier [[ScopeWorkGroup]] [[MemSema1]]
24; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeWorkGroup]] [[MemSema2]]
25; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeWorkGroup]] [[MemSema3]]
26; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeWorkGroup]] [[MemSema4]]
27; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeWorkGroup]] [[MemSema5]]
28; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeWorkGroup]] [[MemSema6]]
29
30; ModuleID = 'OpMemoryBarrier.ll'
31target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
32target triple = "spir64-unknown-unknown"
33
34; Function Attrs: nounwind
35define spir_kernel void @test() #0 {
36entry:
37  call spir_func void @_Z9mem_fencej(i32 2) ; global mem fence
38  call spir_func void @_Z9mem_fencej(i32 1) ; local mem fence
39  call spir_func void @_Z9mem_fencej(i32 4) ; image mem fence
40
41  call spir_func void @_Z9mem_fencej(i32 3) ; global | local
42  call spir_func void @_Z9mem_fencej(i32 5) ; local | image
43  call spir_func void @_Z9mem_fencej(i32 7) ; global | local | image
44  ret void
45}
46
47declare spir_func void @_Z9mem_fencej(i32) #1
48
49attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
50attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
51
52!opencl.kernels = !{!0}
53!opencl.enable.FP_CONTRACT = !{}
54!opencl.spir.version = !{!6}
55!opencl.ocl.version = !{!6}
56!opencl.used.extensions = !{!7}
57!opencl.used.optional.core.features = !{!7}
58!opencl.compiler.options = !{!7}
59!llvm.ident = !{!8}
60
61!0 = !{void ()* @test, !1, !2, !3, !4, !5}
62!1 = !{!"kernel_arg_addr_space"}
63!2 = !{!"kernel_arg_access_qual"}
64!3 = !{!"kernel_arg_type"}
65!4 = !{!"kernel_arg_base_type"}
66!5 = !{!"kernel_arg_type_qual"}
67!6 = !{i32 1, i32 2}
68!7 = !{}
69!8 = !{!"clang version 3.6.2 "}
70