Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/transcoding/check_ro_qualifier.ll

raw
1 ; RUN: llvm-as -opaque-pointers=0 %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv
3 ; RUN: spirv-val %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 %t.spv -o %t.rev.bc --spirv-target-env=SPV-IR
7 ; RUN: llvm-dis -opaque-pointers=0 < %t.rev.bc | FileCheck %s --check-prefix=CHECK-SPV-LLVM
8 ; RUN: llvm-spirv %t.rev.bc -o %t.back.spv
9 ; RUN: llvm-spirv %t.back.spv --to-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
10
11 ; CHECK-LLVM: opencl.image2d_array_ro_t = type opaque
12 ; CHECK-LLVM: define spir_kernel void @sample_kernel(%opencl.image2d_array_ro_t addrspace(1)
13 ; CHECK-LLVM-SAME: !kernel_arg_access_qual [[AQ:![0-9]+]]
14 ; CHECK-LLVM-SAME: !kernel_arg_type [[TYPE:![0-9]+]]
15 ; CHECK-LLVM-SAME: !kernel_arg_base_type [[TYPE]]
16
17 ; CHECK-LLVM: call spir_func <2 x i32> @_Z13get_image_dim20ocl_image2d_array_ro(%opencl.image2d_array_ro_t addrspace(1)
18 ; CHECK-LLVM: call spir_func i64 @_Z20get_image_array_size20ocl_image2d_array_ro(%opencl.image2d_array_ro_t addrspace(1)
19 ; CHECK-LLVM: declare spir_func <2 x i32> @_Z13get_image_dim20ocl_image2d_array_ro(%opencl.image2d_array_ro_t addrspace(1)
20 ; CHECK-LLVM: declare spir_func i64 @_Z20get_image_array_size20ocl_image2d_array_ro(%opencl.image2d_array_ro_t addrspace(1)
21
22 ; CHECK-SPV-LLVM: call spir_func <3 x i32> @_Z31__spirv_ImageQuerySizeLod_Rint3PU3AS133__spirv_Image__void_1_0_1_0_0_0_0i(%spirv.Image._void_1_0_1_0_0_0_0 addrspace(1)
23 ; CHECK-SPV-LLVM: call spir_func <3 x i64> @_Z32__spirv_ImageQuerySizeLod_Rlong3PU3AS133__spirv_Image__void_1_0_1_0_0_0_0i(%spirv.Image._void_1_0_1_0_0_0_0 addrspace(1)
24 ; CHECK-SPV-LLVM: declare spir_func <3 x i32> @_Z31__spirv_ImageQuerySizeLod_Rint3PU3AS133__spirv_Image__void_1_0_1_0_0_0_0i(%spirv.Image._void_1_0_1_0_0_0_0 addrspace(1)
25 ; CHECK-SPV-LLVM: declare spir_func <3 x i64> @_Z32__spirv_ImageQuerySizeLod_Rlong3PU3AS133__spirv_Image__void_1_0_1_0_0_0_0i(%spirv.Image._void_1_0_1_0_0_0_0 addrspace(1)
26
27 ; CHECK-SPIRV: TypeImage [[IMAGE_TYPE:[0-9]+]]
28 ; CHECK-SPIRV: FunctionParameter [[IMAGE_TYPE]] [[IMAGE_ARG:[0-9]+]]
29 ; CHECK-SPIRV: ImageQuerySizeLod {{[0-9]+}} {{[0-9]+}} [[IMAGE_ARG]]
30 ; CHECK-SPIRV: ImageQuerySizeLod {{[0-9]+}} {{[0-9]+}} [[IMAGE_ARG]]
31
32 ; CHECK-LLVM-DAG: [[AQ]] = !{!"read_only"}
33 ; CHECK-LLVM-DAG: [[TYPE]] = !{!"image2d_array_t"}
34
35 ; ModuleID = 'out.ll'
36 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
37 target triple = "spir64-unknown-unknown"
38
39 %opencl.image2d_array_ro_t = type opaque
40
41 ; Function Attrs: nounwind
42 define spir_kernel void @sample_kernel(%opencl.image2d_array_ro_t addrspace(1)* %input) #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 {
43 entry:
44 %call.tmp1 = call spir_func <2 x i32> @_Z13get_image_dim20ocl_image2d_array_ro(%opencl.image2d_array_ro_t addrspace(1)* %input)
45 %call.tmp2 = shufflevector <2 x i32> %call.tmp1, <2 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2>
46 %call.tmp3 = call spir_func i64 @_Z20get_image_array_size20ocl_image2d_array_ro(%opencl.image2d_array_ro_t addrspace(1)* %input)
47 %call.tmp4 = trunc i64 %call.tmp3 to i32
48 %call.tmp5 = insertelement <3 x i32> %call.tmp2, i32 %call.tmp4, i32 2
49 %call.old = extractelement <3 x i32> %call.tmp5, i32 0
50 ret void
51 }
52
53 ; Function Attrs: nounwind
54 declare spir_func <2 x i32> @_Z13get_image_dim20ocl_image2d_array_ro(%opencl.image2d_array_ro_t addrspace(1)*) #0
55
56 ; Function Attrs: nounwind
57 declare spir_func i64 @_Z20get_image_array_size20ocl_image2d_array_ro(%opencl.image2d_array_ro_t addrspace(1)*) #0
58
59 attributes #0 = { nounwind }
60
61 !opencl.enable.FP_CONTRACT = !{}
62 !spirv.Source = !{!6}
63 !opencl.spir.version = !{!7}
64 !opencl.ocl.version = !{!7}
65 !opencl.used.extensions = !{!8}
66 !opencl.used.optional.core.features = !{!9}
67 !spirv.Generator = !{!10}
68
69 !1 = !{i32 1}
70 !2 = !{!"read_only"}
71 !3 = !{!"image2d_array_t"}
72 !4 = !{!""}
73 !5 = !{!"image2d_array_t"}
74 !6 = !{i32 3, i32 102000}
75 !7 = !{i32 1, i32 2}
76 !8 = !{}
77 !9 = !{!"cl_images"}
78 !10 = !{i16 6, i16 14}