1 ;;OpImageWrite.cl 2 ;;void sample_kernel_write(float4 input, write_only image2d_t output, int2 coord) 3 ;;{ 4 ;; write_imagef( output, coord , 5, input); 5 ;; write_imagef( output, coord , input); 6 ;;} 7 ;;clang -cc1 -O0 -triple spir-unknown-unknown -cl-std=CL2.0 -x cl OpImageWrite.cl -include opencl-20.h -emit-llvm -o - | opt -mem2reg -S > OpImageWrite.ll 8 9 ; RUN: llvm-as %s -o %t.bc 10 ; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt 11 ; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV 12 ; RUN: llvm-spirv %t.bc -o %t.spv 13 ; RUN: llvm-spirv -r %t.spv -o %t.rev.bc 14 ; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM 15 16 ; CHECK-SPIRV: Constant {{[0-9]+}} [[lod:[0-9]+]] 5 17 ; CHECK-SPIRV: ImageWrite [[image:[0-9]+]] [[coord:[0-9]+]] [[texel:[0-9]+]] 2 [[lod]] 18 ; CHECK-SPIRV: ImageWrite [[image]] [[coord]] [[texel]] 19 20 21 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" 22 target triple = "spir-unknown-unknown" 23 24 %opencl.image2d_t = type opaque 25 26 ; Function Attrs: nounwind 27 define spir_func void @sample_kernel_write(<4 x float> %input, %opencl.image2d_t addrspace(1)* %output, <2 x i32> %coord) #0 { 28 entry: 29 call spir_func void @_Z12write_imagef11ocl_image2dDv2_iiDv4_f(%opencl.image2d_t addrspace(1)* %output, <2 x i32> %coord, i32 5, <4 x float> %input) 30 ; CHECK-LLVM: call spir_func void @_Z12write_imagef11ocl_image2dDv2_iiDv4_f(%opencl.image2d_t addrspace(1)* %output, <2 x i32> %coord, i32 5, <4 x float> %input) 31 32 call spir_func void @_Z12write_imagef11ocl_image2dDv2_iDv4_f(%opencl.image2d_t addrspace(1)* %output, <2 x i32> %coord, <4 x float> %input) 33 ; CHECK-LLVM: call spir_func void @_Z12write_imagef11ocl_image2dDv2_iDv4_f(%opencl.image2d_t addrspace(1)* %output, <2 x i32> %coord, <4 x float> %input) 34 35 ret void 36 } 37 38 declare spir_func void @_Z12write_imagef11ocl_image2dDv2_iiDv4_f(%opencl.image2d_t addrspace(1)*, <2 x i32>, i32, <4 x float>) #1 39 40 declare spir_func void @_Z12write_imagef11ocl_image2dDv2_iDv4_f(%opencl.image2d_t addrspace(1)*, <2 x i32>, <4 x float>) #1 41 42 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" } 43 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" } 44 45 !opencl.enable.FP_CONTRACT = !{} 46 !opencl.spir.version = !{!0} 47 !opencl.ocl.version = !{!1} 48 !opencl.used.extensions = !{!2} 49 !opencl.used.optional.core.features = !{!3} 50 !opencl.compiler.options = !{!2} 51 52 !0 = !{i32 1, i32 2} 53 !1 = !{i32 2, i32 0} 54 !2 = !{} 55 !3 = !{!"cl_images"} 56 57