Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/image.ll

raw
1 ; RUN: llvm-as -opaque-pointers=0 %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -opaque-pointers=0 -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
3 ; RUN: llvm-spirv %t.bc -opaque-pointers=0 -o %t.spv
4 ; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
5 ; RUN: llvm-dis -opaque-pointers=0 < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
6 ; RUN: llvm-spirv -r --spirv-target-env=SPV-IR %t.spv -o %t.rev.bc
7 ; RUN: llvm-dis -opaque-pointers=0 < %t.rev.bc | FileCheck %s --check-prefix=CHECK-SPV-IR
8 ; RUN: llvm-spirv %t.rev.bc -opaque-pointers=0 -o %t.rev.spv
9 ; RUN: spirv-val %t.rev.spv
10
11 ; CHECK-SPIRV: 2 TypeVoid [[VOID_TY:[0-9]+]]
12 ; CHECK-SPIRV-DAG: 10 TypeImage {{[0-9]*}} [[VOID_TY]] 1 0 0 0 0 0 0
13 ; CHECK-SPIRV-DAG: 10 TypeImage {{[0-9]*}} [[VOID_TY]] 1 0 0 0 0 0 1
14 ; CHECK-SPIRV-NOT: 10 TypeImage {{[0-9]*}} [[VOID_TY]] 1 0 0 0 0 0 0
15 ; CHECK-SPIRV: ImageSampleExplicitLod
16 ; CHECK-SPIRV: ImageWrite
17
18 ; ModuleID = 'image.bc'
19 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
20 target triple = "spir64-unknown-unknown"
21
22 %opencl.image2d_t = type opaque
23
24 ; Function Attrs: nounwind
25 define spir_kernel void @image_copy(%opencl.image2d_t addrspace(1)* readnone %image1, %opencl.image2d_t addrspace(1)* %image2) #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 {
26 entry:
27 %call = tail call spir_func i64 @_Z13get_global_idj(i32 0) #3
28 %conv = trunc i64 %call to i32
29 %call1 = tail call spir_func i64 @_Z13get_global_idj(i32 1) #3
30 %conv2 = trunc i64 %call1 to i32
31 %vecinit = insertelement <2 x i32> undef, i32 %conv, i32 0
32 %vecinit3 = insertelement <2 x i32> %vecinit, i32 %conv2, i32 1
33 %call4 = tail call spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_i(%opencl.image2d_t addrspace(1)* %image1, i32 20, <2 x i32> %vecinit3) #3
34 tail call spir_func void @_Z12write_imagef11ocl_image2dDv2_iDv4_f(%opencl.image2d_t addrspace(1)* %image2, <2 x i32> %vecinit3, <4 x float> %call4) #4
35 ; CHECK-LLVM: call spir_func void @_Z12write_imagef14ocl_image2d_woDv2_iDv4_f(%opencl.image2d_wo_t addrspace(1)* %image2, <2 x i32> %vecinit3, <4 x float> %call4) #0
36 ; CHECK-SPV-IR: call spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv4_f(%spirv.Image._void_1_0_0_0_0_0_1 addrspace(1)* %image2, <2 x i32> %vecinit3, <4 x float> %call4) #0
37 ret void
38 }
39
40 ; Function Attrs: nounwind readnone
41 declare spir_func i64 @_Z13get_global_idj(i32) #1
42
43 ; Function Attrs: nounwind readnone
44 declare spir_func <4 x float> @_Z11read_imagef11ocl_image2d11ocl_samplerDv2_i(%opencl.image2d_t addrspace(1)*, i32, <2 x i32>) #1
45
46 declare spir_func void @_Z12write_imagef11ocl_image2dDv2_iDv4_f(%opencl.image2d_t addrspace(1)*, <2 x i32>, <4 x float>) #2
47 ; CHECK-LLVM: declare spir_func void @_Z12write_imagef14ocl_image2d_woDv2_iDv4_f(%opencl.image2d_wo_t addrspace(1)*, <2 x i32>, <4 x float>)
48 ; CHECK-SPV-IR: declare spir_func void @_Z18__spirv_ImageWritePU3AS133__spirv_Image__void_1_0_0_0_0_0_1Dv2_iDv4_f(%spirv.Image._void_1_0_0_0_0_0_1 addrspace(1)*, <2 x i32>, <4 x float>)
49
50 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" }
51 attributes #1 = { nounwind readnone "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" }
52 attributes #2 = { "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" }
53 attributes #3 = { nounwind readnone }
54 attributes #4 = { nounwind }
55
56 !opencl.enable.FP_CONTRACT = !{}
57 !opencl.spir.version = !{!6}
58 !opencl.ocl.version = !{!6}
59 !opencl.used.extensions = !{!7}
60 !opencl.used.optional.core.features = !{!8}
61 !opencl.compiler.options = !{!7}
62 !llvm.ident = !{!9}
63
64 !1 = !{i32 1, i32 1}
65 !2 = !{!"read_only", !"write_only"}
66 !3 = !{!"image2d_t", !"image2d_t"}
67 !4 = !{!"", !""}
68 !5 = !{!"image2d_t", !"image2d_t"}
69 !6 = !{i32 2, i32 0}
70 !7 = !{}
71 !8 = !{!"cl_images"}
72 !9 = !{!"clang version 3.4 "}