| 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 |
| 4 |
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" |
| 5 |
target triple = "spir" |
| 6 |
|
| 7 |
;CHECK: EntryPoint {{[0-9]+}} [[KernelId:[0-9]+]] |
| 8 |
|
| 9 |
%opencl.image2d_t = type opaque |
| 10 |
;CHECK: TypeImage [[image2d_t:[0-9]+]] |
| 11 |
;CHECK: TypeSampler [[sampler_t:[0-9]+]] |
| 12 |
;CHECK: TypeSampledImage [[sampled_image_t:[0-9]+]] |
| 13 |
|
| 14 |
; Function Attrs: nounwind |
| 15 |
define spir_func float @test(%opencl.image2d_t addrspace(1)* %Img, i32 %Smp) #0 { |
| 16 |
;CHECK-NOT: Function {{[0-9]+}} [[KernelId]] |
| 17 |
;CHECK: Function |
| 18 |
;CHECK: FunctionParameter [[image2d_t]] [[image:[0-9]+]] |
| 19 |
;CHECK: FunctionParameter [[sampler_t]] [[sampler:[0-9]+]] |
| 20 |
entry: |
| 21 |
%call = call spir_func <4 x i32> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_i(%opencl.image2d_t addrspace(1)* %Img, i32 %Smp, <2 x i32> zeroinitializer) |
| 22 |
;CHECK: SampledImage [[sampled_image_t]] [[sampled_image:[0-9]+]] [[image]] [[sampler]] |
| 23 |
;CHECK: ImageSampleExplicitLod {{[0-9]+}} {{[0-9]+}} [[sampled_image]] {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} |
| 24 |
|
| 25 |
%0 = extractelement <4 x i32> %call, i32 0 |
| 26 |
%conv = sitofp i32 %0 to float |
| 27 |
ret float %conv |
| 28 |
} |
| 29 |
|
| 30 |
declare spir_func <4 x i32> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_i(%opencl.image2d_t addrspace(1)*, i32, <2 x i32>) #1 |
| 31 |
|
| 32 |
; Function Attrs: nounwind |
| 33 |
define spir_kernel void @test2(%opencl.image2d_t addrspace(1)* %Img, float addrspace(1)* %result) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 { |
| 34 |
;CHECK: Function {{[0-9]+}} [[KernelId]] |
| 35 |
entry: |
| 36 |
%call = call spir_func float @test(%opencl.image2d_t addrspace(1)* %Img, i32 0) |
| 37 |
%arrayidx = getelementptr inbounds float, float addrspace(1)* %result, i32 0 |
| 38 |
%0 = load float, float addrspace(1)* %arrayidx, align 4 |
| 39 |
%add = fadd float %0, %call |
| 40 |
store float %add, float addrspace(1)* %arrayidx, align 4 |
| 41 |
ret void |
| 42 |
} |
| 43 |
|
| 44 |
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" } |
| 45 |
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" } |
| 46 |
|
| 47 |
!opencl.enable.FP_CONTRACT = !{} |
| 48 |
!opencl.spir.version = !{!6} |
| 49 |
!opencl.ocl.version = !{!7} |
| 50 |
!opencl.used.extensions = !{!8} |
| 51 |
!opencl.used.optional.core.features = !{!9} |
| 52 |
!opencl.compiler.options = !{!8} |
| 53 |
|
| 54 |
!1 = !{i32 1, i32 1} |
| 55 |
!2 = !{!"read_only", !"none"} |
| 56 |
!3 = !{!"image2d_t", !"float*"} |
| 57 |
!4 = !{!"image2d_t", !"float*"} |
| 58 |
!5 = !{!"", !""} |
| 59 |
!6 = !{i32 1, i32 2} |
| 60 |
!7 = !{i32 2, i32 0} |
| 61 |
!8 = !{} |
| 62 |
!9 = !{!"cl_images"} |
| 63 |
|