Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/image_store.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 %t
3 ; RUN: FileCheck < %t %s
4 ; RUN: llvm-spirv %t.bc -opaque-pointers=0 -o %t.spv
5 ; RUN: spirv-val %t.spv
6
7 ; Image types may be represented in two ways while translating to SPIR-V:
8 ; - OpenCL form, for example, '%opencl.image2d_ro_t',
9 ; - SPIR-V form, for example, '%spirv.Image._void_1_0_0_0_0_0_0',
10 ; but it is still one type which should be translated to one SPIR-V type.
11 ;
12 ; The test checks that the code below is successfully translated and only one
13 ; SPIR-V type for images is generated.
14
15 ; CHECK: 10 TypeImage
16 ; CHECK-NOT: 10 TypeImage
17
18 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
19 target triple = "spir64"
20
21 %opencl.image2d_ro_t = type opaque
22 %spirv.Image._void_1_0_0_0_0_0_0 = type opaque
23
24 ; Function Attrs: convergent noinline nounwind optnone
25 define spir_kernel void @read_image(%opencl.image2d_ro_t addrspace(1)* %srcimg) #0 !kernel_arg_addr_space !5 !kernel_arg_access_qual !6 !kernel_arg_type !7 !kernel_arg_base_type !8 !kernel_arg_type_qual !9 {
26 entry:
27 %srcimg.addr = alloca %opencl.image2d_ro_t addrspace(1)*, align 8
28 %spirvimg.addr = alloca %spirv.Image._void_1_0_0_0_0_0_0 addrspace(1)*, align 8
29 store %opencl.image2d_ro_t addrspace(1)* %srcimg, %opencl.image2d_ro_t addrspace(1)** %srcimg.addr, align 8
30 ret void
31 }
32
33 attributes #0 = { convergent noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
34
35 !llvm.module.flags = !{!0}
36 !opencl.enable.FP_CONTRACT = !{}
37 !opencl.ocl.version = !{!1}
38 !opencl.spir.version = !{!1}
39 !opencl.used.extensions = !{!2}
40 !opencl.used.optional.core.features = !{!3}
41 !opencl.compiler.options = !{!2}
42 !llvm.ident = !{!4}
43
44 !0 = !{i32 1, !"wchar_size", i32 4}
45 !1 = !{i32 1, i32 2}
46 !2 = !{}
47 !3 = !{!"cl_images"}
48 !4 = !{!"clang version 6.0.0"}
49 !5 = !{i32 1}
50 !6 = !{!"read_only"}
51 !7 = !{!"image2d_t"}
52 !8 = !{!"image2d_t"}
53 !9 = !{!""}