119734787 65536 393230 15 0
2 Capability Addresses
2 Capability Kernel
3 MemoryModel 1 2
5 EntryPoint 6 4 "test"
8 String 14 "kernel_arg_type.test."
3 Source 3 102000
4 Name 5 "entry"
4 TypeInt 6 32 0
4 Constant 6 7 2
4 Constant 6 8 528
4 Constant 6 9 272
4 Constant 6 10 2064
4 Constant 6 11 784
4 Constant 6 12 2320
4 Constant 6 13 2832
2 TypeVoid 2
3 TypeFunction 3 2

5 Function 2 4 0 3

2 Label 5
4 ControlBarrier 7 7 8
4 ControlBarrier 7 7 9
4 ControlBarrier 7 7 10
4 ControlBarrier 7 7 11
4 ControlBarrier 7 7 12
4 ControlBarrier 7 7 13
1 Return

1 FunctionEnd

; RUN: llvm-spirv %s -to-binary -o %t.spv
; RUN: spirv-val %t.spv

; RUN: llvm-spirv -r %t.spv -o %t1.bc --spirv-target-env="CL1.2"
; RUN: llvm-dis < %t1.bc | FileCheck %s --check-prefix=CHECK-LLVM-12

; CHECK-LLVM-12: call spir_func void @_Z7barrierj(i32 2) [[attr:#[0-9]+]]
; CHECK-LLVM-12: call spir_func void @_Z7barrierj(i32 1) [[attr]]
; CHECK-LLVM-12: call spir_func void @_Z7barrierj(i32 4) [[attr]]
; CHECK-LLVM-12: call spir_func void @_Z7barrierj(i32 3) [[attr]]
; CHECK-LLVM-12: call spir_func void @_Z7barrierj(i32 5) [[attr]]
; CHECK-LLVM-12: call spir_func void @_Z7barrierj(i32 7) [[attr]]
; CHECK-LLVM-12: attributes [[attr]] = { convergent nounwind }

; RUN: llvm-spirv -r %t.spv -o %t2.bc --spirv-target-env="CL2.0"
; RUN: llvm-dis < %t2.bc | FileCheck %s --check-prefix=CHECK-LLVM-20

; CHECK-LLVM-20: call spir_func void @_Z18work_group_barrierj12memory_scope(i32 2, i32 1) [[attr:#[0-9]+]]
; CHECK-LLVM-20: call spir_func void @_Z18work_group_barrierj12memory_scope(i32 1, i32 1) [[attr]]
; CHECK-LLVM-20: call spir_func void @_Z18work_group_barrierj12memory_scope(i32 4, i32 1) [[attr]]
; CHECK-LLVM-20: call spir_func void @_Z18work_group_barrierj12memory_scope(i32 3, i32 1) [[attr]]
; CHECK-LLVM-20: call spir_func void @_Z18work_group_barrierj12memory_scope(i32 5, i32 1) [[attr]]
; CHECK-LLVM-20: call spir_func void @_Z18work_group_barrierj12memory_scope(i32 7, i32 1) [[attr]]
; CHECK-LLVM-20: attributes [[attr]] = { convergent nounwind }

; RUN: llvm-spirv -r %t.spv -o %t3.bc --spirv-target-env="SPV-IR"
; RUN: llvm-dis < %t3.bc | FileCheck %s --check-prefix=CHECK-LLVM-SPV-IR

; CHECK-LLVM-SPV-IR: call spir_func void @_Z22__spirv_ControlBarrieriii(i32 2, i32 2, i32 528) [[attr:#[0-9]+]]
; CHECK-LLVM-SPV-IR: call spir_func void @_Z22__spirv_ControlBarrieriii(i32 2, i32 2, i32 272) [[attr]]
; CHECK-LLVM-SPV-IR: call spir_func void @_Z22__spirv_ControlBarrieriii(i32 2, i32 2, i32 2064) [[attr]]
; CHECK-LLVM-SPV-IR: call spir_func void @_Z22__spirv_ControlBarrieriii(i32 2, i32 2, i32 784) [[attr]]
; CHECK-LLVM-SPV-IR: call spir_func void @_Z22__spirv_ControlBarrieriii(i32 2, i32 2, i32 2320) [[attr]]
; CHECK-LLVM-SPV-IR: call spir_func void @_Z22__spirv_ControlBarrieriii(i32 2, i32 2, i32 2832) [[attr]]
; CHECK-LLVM-SPV-IR: attributes [[attr]] = { convergent nounwind }
