Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/constant-sampler-under-control-flow.spt

raw
1 ; Generated from:
2 ;
3 ; kernel void test(read_only image2d_t image, global int* out)
4 ; {
5 ; size_t gid = get_global_id(0);
6 ; const sampler_t sampler = CLK_NORMALIZED_COORDS_TRUE |
7 ; CLK_ADDRESS_REPEAT |
8 ; CLK_FILTER_NEAREST;
9 ;
10 ; if(gid % 2)
11 ; {
12 ; float4 result = read_imagef( image, sampler, (int2)(0, 0));
13 ; out[0] = result.x;
14 ; }
15 ; else
16 ; {
17 ; int4 result = read_imagei( image, sampler, (int2)(1, 1));
18 ; out[0] = result.x;
19 ; }
20 ; }
21
22 119734787 65536 393230 42 0
23 2 Capability Addresses
24 2 Capability Linkage
25 2 Capability Kernel
26 2 Capability ImageBasic
27 2 Capability LiteralSampler
28 5 ExtInstImport 1 "OpenCL.std"
29 3 MemoryModel 1 2
30 5 EntryPoint 6 10 "test"
31 3 Source 3 200000
32
33 13 Decorate 5 LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
34 3 Decorate 5 Constant
35 4 Decorate 5 BuiltIn 28
36 4 Decorate 12 FuncParamAttr 5
37 4 TypeInt 2 32 0
38 4 Constant 2 21 1
39 4 Constant 2 23 0
40 4 TypeVector 3 2 3
41 4 TypePointer 4 1 3
42 2 TypeVoid 6
43 10 TypeImage 7 6 1 0 0 0 0 0 0
44 4 TypePointer 8 5 2
45 5 TypeFunction 9 6 7 8
46 2 TypeSampler 19
47 2 TypeBool 24
48 3 TypeSampledImage 26 7
49 3 TypeFloat 28 32
50 4 TypeVector 29 28 4
51 4 TypeVector 30 2 2
52 4 TypeVector 37 2 4
53 4 Variable 4 5 1
54 6 ConstantSampler 19 20 3 1 0
55 3 ConstantNull 30 31
56 4 Constant 28 32 0
57 5 ConstantComposite 30 38 21 21
58
59
60 5 Function 6 10 0 9
61 3 FunctionParameter 7 11
62 3 FunctionParameter 8 12
63
64 2 Label 13
65 6 Load 3 17 5 2 16
66 5 CompositeExtract 2 18 17 0
67 5 BitwiseAnd 2 22 18 21
68 5 IEqual 24 25 22 23
69 4 BranchConditional 25 15 14
70
71 2 Label 14
72 5 SampledImage 26 27 11 20
73 7 ImageSampleExplicitLod 29 33 27 31 2 32
74 5 CompositeExtract 28 34 33 0
75 4 ConvertFToS 2 35 34
76 2 Branch 16
77
78 2 Label 15
79 5 SampledImage 26 36 11 20
80 7 ImageSampleExplicitLod 37 39 36 38 2 32
81 5 CompositeExtract 2 40 39 0
82 2 Branch 16
83
84 2 Label 16
85 7 Phi 2 41 40 15 35 14
86 5 Store 12 41 2 4
87 1 Return
88
89 1 FunctionEnd
90
91 ; RUN: llvm-spirv %s -to-binary -o %t.spv
92 ; RUN: llvm-spirv -r -emit-opaque-pointers --spirv-target-env=SPV-IR %t.spv -o %t.bc
93 ; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM
94
95 ; Check whether seperate initilizer has been generated for each use
96
97 ; CHECK-LLVM: %[[cond:.*]] = icmp eq i32 %10, 0
98 ; CHECK-LLVM: br i1 %[[cond]], label %[[br1:.*]], label %[[br0:.*]]
99
100 ; CHECK-LLVM: [[br0]]:
101 ; CHECK-LLVM: %[[s0:.*]] = call target("spirv.Sampler") @__translate_sampler_initializer(i32 23)
102 ; CHECK-LLVM: call spir_func target("spirv.SampledImage", void, 1, 0, 0, 0, 0, 0, 0) @_Z20__spirv_SampledImagePU3AS133__spirv_Image__void_1_0_0_0_0_0_0PU3AS215__spirv_Sampler(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0) %{{.*}}, target("spirv.Sampler") %[[s0]])
103
104 ; CHECK-LLVM: [[br1]]:
105 ; CHECK-LLVM: %[[s1:.*]] = call target("spirv.Sampler") @__translate_sampler_initializer(i32 23)
106 ; CHECK-LLVM: call spir_func target("spirv.SampledImage", void, 1, 0, 0, 0, 0, 0, 0) @_Z20__spirv_SampledImagePU3AS133__spirv_Image__void_1_0_0_0_0_0_0PU3AS215__spirv_Sampler(target("spirv.Image", void, 1, 0, 0, 0, 0, 0, 0) %{{.*}}, target("spirv.Sampler") %[[s1]])