Home | History | Annotate | Download | only in transcoding
      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 @_Z7barrierj(i32 2)
      9 ; CHECK-LLVM-NEXT: call spir_func void @_Z7barrierj(i32 1)
     10 ; CHECK-LLVM-NEXT: call spir_func void @_Z7barrierj(i32 4)
     11 ; CHECK-LLVM-NEXT: call spir_func void @_Z7barrierj(i32 3)
     12 ; CHECK-LLVM-NEXT: call spir_func void @_Z7barrierj(i32 5)
     13 ; CHECK-LLVM-NEXT: call spir_func void @_Z7barrierj(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: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema1]]
     24 ; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema2]]
     25 ; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema3]]
     26 ; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema4]]
     27 ; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema5]]
     28 ; CHECK-SPIRV-NEXT: 4 ControlBarrier [[ScopeWorkGroup]] [[ScopeWorkGroup]] [[MemSema6]]
     29 
     30 
     31 ; ModuleID = 'barrier-cl12.cl'
     32 target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
     33 target triple = "spir-unknown-unknown"
     34 
     35 ; Function Attrs: nounwind
     36 define spir_kernel void @test() #0 {
     37 entry:
     38   call spir_func void @_Z7barrierj(i32 2) ; global mem fence
     39   call spir_func void @_Z7barrierj(i32 1) ; local mem fence
     40   call spir_func void @_Z7barrierj(i32 4) ; image mem fence
     41 
     42   call spir_func void @_Z7barrierj(i32 3) ; global | local
     43   call spir_func void @_Z7barrierj(i32 5) ; local | image
     44   call spir_func void @_Z7barrierj(i32 7) ; global | local | image
     45 
     46   ret void
     47 }
     48 
     49 declare spir_func void @_Z7barrierj(i32) #1
     50 
     51 attributes #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" }
     52 attributes #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" }
     53 attributes #2 = { nounwind }
     54 
     55 !opencl.kernels = !{!0}
     56 !opencl.enable.FP_CONTRACT = !{}
     57 !opencl.spir.version = !{!6}
     58 !opencl.ocl.version = !{!7}
     59 !opencl.used.extensions = !{!8}
     60 !opencl.used.optional.core.features = !{!8}
     61 !opencl.compiler.options = !{!8}
     62 
     63 !0 = !{void ()* @test, !1, !2, !3, !4, !5}
     64 !1 = !{!"kernel_arg_addr_space"}
     65 !2 = !{!"kernel_arg_access_qual"}
     66 !3 = !{!"kernel_arg_type"}
     67 !4 = !{!"kernel_arg_base_type"}
     68 !5 = !{!"kernel_arg_type_qual"}
     69 !6 = !{i32 1, i32 2}
     70 !7 = !{i32 1, i32 2}
     71 !8 = !{}
     72