| 1 |
; RUN: llvm-as -opaque-pointers=0 %s -o %t.bc |
| 2 |
; RUN: llvm-spirv %t.bc -opaque-pointers=0 -spirv-text -o %t.txt |
| 3 |
; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV |
| 4 |
; RUN: llvm-spirv %t.bc -opaque-pointers=0 -o %t.spv |
| 5 |
; RUN: spirv-val %t.spv |
| 6 |
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc |
| 7 |
; RUN: llvm-dis -opaque-pointers=0 < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM |
| 8 |
|
| 9 |
; CHECK-LLVM: call spir_func float @_Z11read_imagef20ocl_image2d_depth_ro11ocl_samplerDv2_i(%opencl.image2d_depth_ro_t |
| 10 |
|
| 11 |
; CHECK-SPIRV-DAG: 7 ImageSampleExplicitLod [[RetType:[0-9]+]] [[RetID:[0-9]+]] {{[0-9]+}} {{[0-9]+}} 2 {{[0-9]+}} |
| 12 |
; CHECK-SPIRV-DAG: 4 TypeVector [[RetType]] {{[0-9]+}} 4 |
| 13 |
; CHECK-SPIRV: 5 CompositeExtract {{[0-9]+}} {{[0-9]+}} [[RetID]] 0 |
| 14 |
|
| 15 |
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" |
| 16 |
target triple = "spir-unknown-unknown" |
| 17 |
|
| 18 |
%opencl.image2d_depth_ro_t = type opaque |
| 19 |
|
| 20 |
; Function Attrs: nounwind |
| 21 |
define spir_kernel void @sample_kernel(%opencl.image2d_depth_ro_t addrspace(1)* %input, i32 %imageSampler, float addrspace(1)* %xOffsets, float addrspace(1)* %yOffsets, float addrspace(1)* %results) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !5 !kernel_arg_type_qual !4 { |
| 22 |
entry: |
| 23 |
%call = call spir_func i32 @_Z13get_global_idj(i32 0) #1 |
| 24 |
%call1 = call spir_func i32 @_Z13get_global_idj(i32 1) #1 |
| 25 |
%call2.tmp1 = call spir_func <2 x i32> @_Z13get_image_dim20ocl_image2d_depth_ro(%opencl.image2d_depth_ro_t addrspace(1)* %input) |
| 26 |
%call2.old = extractelement <2 x i32> %call2.tmp1, i32 0 |
| 27 |
%mul = mul i32 %call1, %call2.old |
| 28 |
%add = add i32 %mul, %call |
| 29 |
%arrayidx = getelementptr inbounds float, float addrspace(1)* %xOffsets, i32 %add |
| 30 |
%0 = load float, float addrspace(1)* %arrayidx, align 4 |
| 31 |
%conv = fptosi float %0 to i32 |
| 32 |
%vecinit = insertelement <2 x i32> undef, i32 %conv, i32 0 |
| 33 |
%arrayidx3 = getelementptr inbounds float, float addrspace(1)* %yOffsets, i32 %add |
| 34 |
%1 = load float, float addrspace(1)* %arrayidx3, align 4 |
| 35 |
%conv4 = fptosi float %1 to i32 |
| 36 |
%vecinit5 = insertelement <2 x i32> %vecinit, i32 %conv4, i32 1 |
| 37 |
%call6.tmp.tmp = call spir_func float @_Z11read_imagef20ocl_image2d_depth_ro11ocl_samplerDv2_i(%opencl.image2d_depth_ro_t addrspace(1)* %input, i32 %imageSampler, <2 x i32> %vecinit5) |
| 38 |
%arrayidx7 = getelementptr inbounds float, float addrspace(1)* %results, i32 %add |
| 39 |
store float %call6.tmp.tmp, float addrspace(1)* %arrayidx7, align 4 |
| 40 |
ret void |
| 41 |
} |
| 42 |
|
| 43 |
; Function Attrs: nounwind |
| 44 |
declare spir_func float @_Z11read_imagef20ocl_image2d_depth_ro11ocl_samplerDv2_i(%opencl.image2d_depth_ro_t addrspace(1)*, i32, <2 x i32>) #0 |
| 45 |
|
| 46 |
; Function Attrs: nounwind |
| 47 |
declare spir_func i32 @_Z13get_global_idj(i32) #1 |
| 48 |
|
| 49 |
; Function Attrs: nounwind |
| 50 |
declare spir_func <2 x i32> @_Z13get_image_dim20ocl_image2d_depth_ro(%opencl.image2d_depth_ro_t addrspace(1)*) #0 |
| 51 |
|
| 52 |
attributes #0 = { nounwind } |
| 53 |
attributes #1 = { nounwind } |
| 54 |
|
| 55 |
!opencl.enable.FP_CONTRACT = !{} |
| 56 |
!opencl.spir.version = !{!6} |
| 57 |
!opencl.ocl.version = !{!6} |
| 58 |
!opencl.used.extensions = !{!7} |
| 59 |
!opencl.used.optional.core.features = !{!8} |
| 60 |
|
| 61 |
!1 = !{i32 1, i32 0, i32 1, i32 1, i32 1} |
| 62 |
!2 = !{!"read_only", !"none", !"none", !"none", !"none"} |
| 63 |
!3 = !{!"image2d_depth_t", !"sampler_t", !"float*", !"float*", !"float*"} |
| 64 |
!4 = !{!"", !"", !"", !"", !""} |
| 65 |
!5 = !{!"image2d_depth_t", !"sampler_t", !"float*", !"float*", !"float*"} |
| 66 |
!6 = !{i32 2, i32 0} |
| 67 |
!7 = !{!"cl_khr_depth_images"} |
| 68 |
!8 = !{!"cl_images"} |