1 ; RUN: llvm-as < %s | llvm-spirv -spirv-text -o %t 2 ; RUN: FileCheck < %t %s 3 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" 4 target triple = "spir64-unknown-unknown" 5 6 %opencl.image2d_t = type opaque 7 8 ; CHECK: 8 Decorate [[ID:[0-9]*]] LinkageAttributes "imageSampler" Export 9 ; CHECK: 5 Variable {{[0-9]*}} [[ID]] 0 {{[0-9]*}} 10 11 @imageSampler = addrspace(2) constant i32 36, align 4 12 13 ; Function Attrs: nounwind 14 define spir_kernel void @sample_kernel(%opencl.image2d_t addrspace(1)* %input, float addrspace(1)* nocapture %xOffsets, float addrspace(1)* nocapture %yOffsets, <4 x float> addrspace(1)* nocapture %results) #0 { 15 %1 = tail call spir_func i64 @_Z13get_global_idj(i32 0) #1 16 %2 = trunc i64 %1 to i32 17 %3 = tail call spir_func i64 @_Z13get_global_idj(i32 1) #1 18 %4 = trunc i64 %3 to i32 19 %5 = tail call spir_func i32 @_Z15get_image_width11ocl_image2d(%opencl.image2d_t addrspace(1)* %input) #1 20 %6 = mul nsw i32 %4, %5 21 %7 = add nsw i32 %6, %2 22 %8 = sitofp i32 %2 to float 23 %9 = insertelement <2 x float> undef, float %8, i32 0 24 %10 = sitofp i32 %4 to float 25 %11 = insertelement <2 x float> %9, float %10, i32 1 26 %12 = tail call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)* %input, i32 36, <2 x float> %11) #1 27 %13 = sext i32 %7 to i64 28 %14 = getelementptr inbounds <4 x float>, <4 x float> addrspace(1)* %results, i64 %13 29 store <4 x float> %12, <4 x float> addrspace(1)* %14, align 16, !tbaa !11 30 ret void 31 } 32 33 ; Function Attrs: nounwind readnone 34 declare spir_func i64 @_Z13get_global_idj(i32) #1 35 36 ; Function Attrs: nounwind readnone 37 declare spir_func i32 @_Z15get_image_width11ocl_image2d(%opencl.image2d_t addrspace(1)*) #1 38 39 ; Function Attrs: nounwind readnone 40 declare spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)*, i32, <2 x float>) #1 41 42 attributes #0 = { nounwind } 43 attributes #1 = { nounwind readnone } 44 45 !opencl.kernels = !{!0} 46 !opencl.enable.FP_CONTRACT = !{} 47 !opencl.spir.version = !{!7} 48 !opencl.ocl.version = !{!7} 49 !opencl.used.extensions = !{!8} 50 !opencl.used.optional.core.features = !{!9} 51 !opencl.compiler.options = !{!10} 52 53 !0 = !{void (%opencl.image2d_t addrspace(1)*, float addrspace(1)*, float addrspace(1)*, <4 x float> addrspace(1)*)* @sample_kernel, !1, !2, !3, !4, !5, !6} 54 !1 = !{!"kernel_arg_addr_space", i32 1, i32 1, i32 1, i32 1} 55 !2 = !{!"kernel_arg_access_qual", !"read_only", !"none", !"none", !"none"} 56 !3 = !{!"kernel_arg_type", !"image2d_float", !"float*", !"float*", !"float4*"} 57 !4 = !{!"kernel_arg_type_qual", !"", !"", !"", !""} 58 !5 = !{!"kernel_arg_base_type", !"image2d_t", !"float*", !"float*", !"float4*"} 59 !6 = !{!"kernel_arg_name", !"input", !"xOffsets", !"yOffsets", !"results"} 60 !7 = !{i32 1, i32 2} 61 !8 = !{} 62 !9 = !{!"cl_images"} 63 !10 = !{!"-cl-kernel-arg-info"} 64 !11 = !{!12, !12, i64 0} 65 !12 = !{!"omnipotent char", !13} 66 !13 = !{!"Simple C/C++ TBAA"} 67