1; RUN: llvm-as %s -o %t.bc 2; RUN: llvm-spirv %t.bc -o %t.spv 3; RUN: llvm-spirv -r -spirv-gen-image-type-acc-postfix %t.spv -o %t.rev.bc 4; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM 5 6; CHECK-LLVM: opencl.image2d_array_wo_t = type opaque 7; CHECK-LLVM: define spir_kernel void @sample_kernel(%opencl.image2d_array_wo_t addrspace(1) 8; CHECK-LLVM: call spir_func <2 x i32> @_Z13get_image_dimPU3AS125opencl.image2d_array_wo_t(%opencl.image2d_array_wo_t addrspace(1) 9; CHECK-LLVM: call spir_func i64 @_Z20get_image_array_sizePU3AS125opencl.image2d_array_wo_t(%opencl.image2d_array_wo_t addrspace(1) 10; CHECK-LLVM: declare spir_func <2 x i32> @_Z13get_image_dimPU3AS125opencl.image2d_array_wo_t(%opencl.image2d_array_wo_t addrspace(1) 11; CHECK-LLVM: declare spir_func i64 @_Z20get_image_array_sizePU3AS125opencl.image2d_array_wo_t(%opencl.image2d_array_wo_t addrspace(1) 12; CHECK-LLVM: !{{[0-9]+}} = !{void (%opencl.image2d_array_wo_t 13; CHECK-LLVM: !{{[0-9]+}} = !{!"kernel_arg_type", !"image2d_array_wo_t"} 14; CHECK-LLVM: !{{[0-9]+}} = !{!"kernel_arg_base_type", !"image2d_array_wo_t"} 15 16 17; ModuleID = 'out.ll' 18target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" 19target triple = "spir64-unknown-unknown" 20 21%opencl.image2d_array_wo_t = type opaque 22 23; Function Attrs: nounwind 24define spir_kernel void @sample_kernel(%opencl.image2d_array_wo_t addrspace(1)* %input) #0 { 25entry: 26 %call.tmp1 = call spir_func <2 x i32> @_Z13get_image_dimPU3AS125opencl.image2d_array_wo_t(%opencl.image2d_array_wo_t addrspace(1)* %input) 27 %call.tmp2 = shufflevector <2 x i32> %call.tmp1, <2 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2> 28 %call.tmp3 = call spir_func i64 @_Z20get_image_array_sizePU3AS125opencl.image2d_array_wo_t(%opencl.image2d_array_wo_t addrspace(1)* %input) 29 %call.tmp4 = trunc i64 %call.tmp3 to i32 30 %call.tmp5 = insertelement <3 x i32> %call.tmp2, i32 %call.tmp4, i32 2 31 %call.old = extractelement <3 x i32> %call.tmp5, i32 0 32 ret void 33} 34 35; Function Attrs: nounwind 36declare spir_func <2 x i32> @_Z13get_image_dimPU3AS125opencl.image2d_array_wo_t(%opencl.image2d_array_wo_t addrspace(1)*) #0 37 38; Function Attrs: nounwind 39declare spir_func i64 @_Z20get_image_array_sizePU3AS125opencl.image2d_array_wo_t(%opencl.image2d_array_wo_t addrspace(1)*) #0 40 41attributes #0 = { nounwind } 42 43!opencl.kernels = !{!0} 44!opencl.enable.FP_CONTRACT = !{} 45!spirv.Source = !{!6} 46!opencl.spir.version = !{!7} 47!opencl.ocl.version = !{!7} 48!opencl.used.extensions = !{!8} 49!opencl.used.optional.core.features = !{!9} 50!spirv.Generator = !{!10} 51 52!0 = !{void (%opencl.image2d_array_wo_t addrspace(1)*)* @sample_kernel, !1, !2, !3, !4, !5} 53!1 = !{!"kernel_arg_addr_space", i32 1} 54!2 = !{!"kernel_arg_access_qual", !"write_only"} 55!3 = !{!"kernel_arg_type", !"image2d_array_wo_t"} 56!4 = !{!"kernel_arg_type_qual", !""} 57!5 = !{!"kernel_arg_base_type", !"image2d_array_wo_t"} 58!6 = !{i32 3, i32 102000} 59!7 = !{i32 1, i32 2} 60!8 = !{} 61!9 = !{!"cl_images"} 62!10 = !{i16 6, i16 14}