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: %spirv.ConstantPipeStorage = type { i32, i32, i32 } 9; CHECK-LLVM: %"[[CL_PIPE_STORAGE_NAME:[^"]+]]" = type { %spirv.PipeStorage addrspace(1)* } 10; CHECK-LLVM: %spirv.PipeStorage = type opaque 11; CHECK-LLVM: [[CREATOR_NAME:[^ ]+]] = linkonce_odr addrspace(1) global %spirv.ConstantPipeStorage { i32 16, i32 16, i32 1 }, align 4 12; CHECK-LLVM: @mygpipe = addrspace(1) global %"[[CL_PIPE_STORAGE_NAME]]" { %spirv.PipeStorage addrspace(1)* bitcast (%spirv.ConstantPipeStorage addrspace(1)* [[CREATOR_NAME]] to %spirv.PipeStorage addrspace(1)*) }, align 4 13 14; check for magic number followed by version 1.1 15; CHECK-SPIRV: 119734787 65792 16 17; CHECK-SPIRV: 4 Name [[MYPIPE_ID:[0-9]+]] "mygpipe" 18 19; CHECK-SPIRV: 2 TypePipeStorage [[PIPE_STORAGE_ID:[0-9]+]] 20; CHECK-SPIRV-NEXT: 2 TypePipeStorage [[PIPE_STORAGE_ID_2:[0-9]+]] 21; CHECK-SPIRV: 3 TypeStruct [[CL_PIPE_STORAGE_ID:[0-9]+]] [[PIPE_STORAGE_ID_2]] 22; CHECK-SPIRV: 4 TypePointer [[CL_PIPE_STORAGE_PTR_ID:[0-9]+]] 5 [[CL_PIPE_STORAGE_ID]] 23 24; CHECK-SPIRV: 6 ConstantPipeStorage [[PIPE_STORAGE_ID]] [[CPS_ID:[0-9]+]] 16 16 1 25; CHECK-SPIRV: 4 ConstantComposite [[CL_PIPE_STORAGE_ID]] [[COMPOSITE_ID:[0-9]+]] [[CPS_ID]] 26; CHECK-SPIRV: 5 Variable [[CL_PIPE_STORAGE_PTR_ID]] [[MYPIPE_ID]] 5 [[COMPOSITE_ID]] 27 28target 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" 29target triple = "spir-unknown-unknown" 30 31%spirv.ConstantPipeStorage = type { i32, i32, i32 } 32%"class.cl::pipe_storage<int __attribute__((ext_vector_type(4))), 1>" = type { %spirv.PipeStorage addrspace(1)* } 33%spirv.PipeStorage = type opaque 34 35@_ZN2cl9__details29OpConstantPipeStorage_CreatorILi16ELi16ELi1EE5valueE = linkonce_odr addrspace(1) global %spirv.ConstantPipeStorage { i32 16, i32 16, i32 1 }, align 4 36@mygpipe = addrspace(1) global %"class.cl::pipe_storage<int __attribute__((ext_vector_type(4))), 1>" { %spirv.PipeStorage addrspace(1)* bitcast (%spirv.ConstantPipeStorage addrspace(1)* @_ZN2cl9__details29OpConstantPipeStorage_CreatorILi16ELi16ELi1EE5valueE to %spirv.PipeStorage addrspace(1)*) }, align 4 37 38; Function Attrs: nounwind 39define spir_kernel void @worker() { 40entry: 41 ret void 42} 43 44!opencl.enable.FP_CONTRACT = !{} 45!opencl.spir.version = !{!0} 46!opencl.ocl.version = !{!1} 47!opencl.used.extensions = !{!2} 48!opencl.used.optional.core.features = !{!2} 49!opencl.compiler.options = !{!2} 50!llvm.ident = !{!3} 51!spirv.Source = !{!4} 52!spirv.String = !{} 53 54!0 = !{i32 1, i32 2} 55!1 = !{i32 2, i32 2} 56!2 = !{} 57!3 = !{!"clang version 3.6.1 "} 58!4 = !{i32 4, i32 202000} 59