Home | History | Annotate | Download | only in transcoding
      1 ;;OpImageSampleExplicitLod_arg.cl
      2 ;;void __kernel sample_kernel_read( __global float4 *results,
      3 ;;				  read_only image2d_t image,
      4 ;;			          sampler_t imageSampler,
      5 ;;				  float2 coord,
      6 ;;				  float2 dx,
      7 ;;				  float2 dy)
      8 ;;{
      9 ;;   *results = read_imagef( image, imageSampler, coord);
     10 ;;   *results = read_imagef( image, imageSampler, coord, 3.14f);
     11 ;;   *results = read_imagef( image, imageSampler, coord, dx, dy);
     12 ;;}
     13 ;;clang -cc1 -O0 -triple spir-unknown-unknown -cl-std=CL2.0 -x cl OpImageSampleExplicitLod_arg.cl -include opencl-20.h -emit-llvm -o - | opt -mem2reg -S > OpImageSampleExplicitLod_arg2.ll
     14 
     15 ; RUN: llvm-as %s -o %t.bc
     16 ; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt
     17 ; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV
     18 ; RUN: llvm-spirv %t.bc -o %t.spv
     19 ; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
     20 ; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
     21 
     22 ; CHECK-SPIRV: TypeFloat [[float:[0-9]+]] 32
     23 ; CHECK-SPIRV: Constant [[float]] [[lodNull:[0-9]+]] 0
     24 ; CHECK-SPIRV: Constant [[float]] [[lod:[0-9]+]] 1078523331
     25 ; CHECK-SPIRV: FunctionParameter
     26 ; CHECK-SPIRV: FunctionParameter
     27 ; CHECK-SPIRV: FunctionParameter
     28 ; CHECK-SPIRV: FunctionParameter
     29 ; CHECK-SPIRV: FunctionParameter {{[0-9]+}} [[dx:[0-9]+]]
     30 ; CHECK-SPIRV: FunctionParameter {{[0-9]+}} [[dy:[0-9]+]]
     31 
     32 ; CHECK-SPIRV: ImageSampleExplicitLod {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} 2 [[lodNull]]
     33 ; CHECK-SPIRV: ImageSampleExplicitLod {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} 2 [[lod]]
     34 ; CHECK-SPIRV: ImageSampleExplicitLod {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} 4 [[dx]] [[dy]]
     35 
     36 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"
     37 target triple = "spir-unknown-unknown"
     38 
     39 %opencl.image2d_t = type opaque
     40 
     41 ; Function Attrs: nounwind
     42 define spir_kernel void @sample_kernel_read(<4 x float> addrspace(1)* %results, %opencl.image2d_t addrspace(1)* %image, i32 %imageSampler, <2 x float> %coord, <2 x float> %dx, <2 x float> %dy) #0 {
     43 entry:
     44   %call = call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)* %image, i32 %imageSampler, <2 x float> %coord)
     45 ; CHECK-LLVM: call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)* %image, i32 %imageSampler, <2 x float> %coord)
     46 
     47   store <4 x float> %call, <4 x float> addrspace(1)* %results, align 16
     48   %call1 = call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_ff(%opencl.image2d_t addrspace(1)* %image, i32 %imageSampler, <2 x float> %coord, float 0x40091EB860000000)
     49 ; CHECK-LLVM: call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_ff(%opencl.image2d_t addrspace(1)* %image, i32 %imageSampler, <2 x float> %coord, float 0x40091EB860000000)
     50 
     51   store <4 x float> %call1, <4 x float> addrspace(1)* %results, align 16
     52   %call2 = call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_fDv2_fDv2_f(%opencl.image2d_t addrspace(1)* %image, i32 %imageSampler, <2 x float> %coord, <2 x float> %dx, <2 x float> %dy)
     53 ; CHECK-LLVM: call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_fS_S_(%opencl.image2d_t addrspace(1)* %image, i32 %imageSampler, <2 x float> %coord, <2 x float> %dx, <2 x float> %dy)
     54 
     55   store <4 x float> %call2, <4 x float> addrspace(1)* %results, align 16
     56   ret void
     57 }
     58 
     59 declare spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_f(%opencl.image2d_t addrspace(1)*, i32, <2 x float>) #1
     60 
     61 declare spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_ff(%opencl.image2d_t addrspace(1)*, i32, <2 x float>, float) #1
     62 
     63 declare spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_fDv2_fDv2_f(%opencl.image2d_t addrspace(1)*, i32, <2 x float>, <2 x float>, <2 x float>) #1
     64 
     65 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" }
     66 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" }
     67 
     68 !opencl.kernels = !{!0}
     69 !opencl.enable.FP_CONTRACT = !{}
     70 !opencl.spir.version = !{!6}
     71 !opencl.ocl.version = !{!7}
     72 !opencl.used.extensions = !{!8}
     73 !opencl.used.optional.core.features = !{!9}
     74 !opencl.compiler.options = !{!8}
     75 
     76 !0 = !{void (<4 x float> addrspace(1)*, %opencl.image2d_t addrspace(1)*, i32, <2 x float>, <2 x float>, <2 x float>)* @sample_kernel_read, !1, !2, !3, !4, !5}
     77 !1 = !{!"kernel_arg_addr_space", i32 1, i32 1, i32 0, i32 0, i32 0, i32 0}
     78 !2 = !{!"kernel_arg_access_qual", !"none", !"read_only", !"none", !"none", !"none", !"none"}
     79 !3 = !{!"kernel_arg_type", !"float4*", !"image2d_t", !"sampler_t", !"float2", !"float2", !"float2"}
     80 !4 = !{!"kernel_arg_base_type", !"float4*", !"image2d_t", !"sampler_t", !"float2", !"float2", !"float2"}
     81 !5 = !{!"kernel_arg_type_qual", !"", !"", !"", !"", !"", !""}
     82 !6 = !{i32 1, i32 2}
     83 !7 = !{i32 2, i32 0}
     84 !8 = !{}
     85 !9 = !{!"cl_images"}
     86 
     87