• 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 @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 0)
9; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 1)
10; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 2)
11; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 3)
12
13; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 0)
14; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 1)
15; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 2)
16; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 3)
17
18; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 0)
19; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 1)
20; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 2)
21; CHECK-LLVM-NEXT: call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 3)
22
23; global | acquire_release
24; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema1:[0-9]+]] 520
25; local | acquire_release
26; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema2:[0-9]+]] 264
27; image | acquire_release
28; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[MemSema3:[0-9]+]] 2056
29
30; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[ScopeWorkItem:[0-9]+]] 4
31; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[ScopeWorkGroup:[0-9]+]] 2
32; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[ScopeDevice:[0-9]+]] 1
33; CHECK-SPIRV-DAG: 4 Constant {{[0-9]+}} [[ScopeCrossDevice:[0-9]+]] 0
34
35; CHECK-SPIRV: 3 MemoryBarrier [[ScopeWorkItem]] [[MemSema1]]
36; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeWorkGroup]] [[MemSema1]]
37; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeDevice]] [[MemSema1]]
38; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeCrossDevice]] [[MemSema1]]
39
40; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeWorkItem]] [[MemSema2]]
41; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeWorkGroup]] [[MemSema2]]
42; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeDevice]] [[MemSema2]]
43; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeCrossDevice]] [[MemSema2]]
44
45; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeWorkItem]] [[MemSema3]]
46; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeWorkGroup]] [[MemSema3]]
47; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeDevice]] [[MemSema3]]
48; CHECK-SPIRV-NEXT: 3 MemoryBarrier [[ScopeCrossDevice]] [[MemSema3]]
49
50; ModuleID = 'OpMemoryBarrier.ll'
51target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
52target triple = "spir64-unknown-unknown"
53
54; Function Attrs: nounwind
55define spir_kernel void @test() #0 {
56entry:
57  call spir_func void @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 0) ; global mem fence + memory_scope_work_item
58  call spir_func void @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 1) ; global mem fence + memory_scope_work_group
59  call spir_func void @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 2) ; global mem fence + memory_scope_device
60  call spir_func void @_Z22atomic_work_item_fencejii(i32 2, i32 3, i32 3) ; global mem fence + memory_scope_all_svm_devices
61
62  call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 0) ; local mem fence + memory_scope_work_item
63  call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 1) ; local mem fence + memory_scope_work_group
64  call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 2) ; local mem fence + memory_scope__devices
65  call spir_func void @_Z22atomic_work_item_fencejii(i32 1, i32 3, i32 3) ; local mem fence + memory_scope_all_svm_devices
66
67  call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 0) ; image mem fence + memory_scope_work_item
68  call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 1) ; image mem fence + memory_scope_work_group
69  call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 2) ; image mem fence + memory_scope__devices
70  call spir_func void @_Z22atomic_work_item_fencejii(i32 4, i32 3, i32 3) ; image mem fence + memory_scope_all_svm_devices
71  ret void
72}
73
74declare spir_func void @_Z22atomic_work_item_fencejii(i32, i32, i32) #1
75
76attributes #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" }
77attributes #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" }
78
79!opencl.kernels = !{!0}
80!opencl.enable.FP_CONTRACT = !{}
81!opencl.spir.version = !{!6}
82!opencl.ocl.version = !{!7}
83!opencl.used.extensions = !{!8}
84!opencl.used.optional.core.features = !{!8}
85!opencl.compiler.options = !{!8}
86!llvm.ident = !{!9}
87
88!0 = !{void ()* @test, !1, !2, !3, !4, !5}
89!1 = !{!"kernel_arg_addr_space"}
90!2 = !{!"kernel_arg_access_qual"}
91!3 = !{!"kernel_arg_type"}
92!4 = !{!"kernel_arg_base_type"}
93!5 = !{!"kernel_arg_type_qual"}
94!6 = !{i32 1, i32 2}
95!7 = !{i32 2, i32 0}
96!8 = !{}
97!9 = !{!"clang version 3.6.2 "}
98