xref: /aosp_15_r20/external/skia/tests/sksl/intrinsics/ClampInt.asm.frag (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1               OpCapability Shader
2          %1 = OpExtInstImport "GLSL.std.450"
3               OpMemoryModel Logical GLSL450
4               OpEntryPoint Fragment %_entrypoint_v "_entrypoint" %sk_FragColor
5               OpExecutionMode %_entrypoint_v OriginUpperLeft
6               OpName %sk_FragColor "sk_FragColor"
7               OpName %_UniformBuffer "_UniformBuffer"
8               OpMemberName %_UniformBuffer 0 "testInputs"
9               OpMemberName %_UniformBuffer 1 "colorGreen"
10               OpMemberName %_UniformBuffer 2 "colorRed"
11               OpName %_entrypoint_v "_entrypoint_v"
12               OpName %main "main"
13               OpName %intValues "intValues"
14               OpName %expectedA "expectedA"
15               OpName %expectedB "expectedB"
16               OpDecorate %sk_FragColor RelaxedPrecision
17               OpDecorate %sk_FragColor Location 0
18               OpDecorate %sk_FragColor Index 0
19               OpMemberDecorate %_UniformBuffer 0 Offset 0
20               OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
21               OpMemberDecorate %_UniformBuffer 1 Offset 16
22               OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
23               OpMemberDecorate %_UniformBuffer 2 Offset 32
24               OpMemberDecorate %_UniformBuffer 2 RelaxedPrecision
25               OpDecorate %_UniformBuffer Block
26               OpDecorate %7 Binding 0
27               OpDecorate %7 DescriptorSet 0
28               OpDecorate %30 RelaxedPrecision
29               OpDecorate %32 RelaxedPrecision
30               OpDecorate %33 RelaxedPrecision
31               OpDecorate %35 RelaxedPrecision
32               OpDecorate %37 RelaxedPrecision
33               OpDecorate %39 RelaxedPrecision
34               OpDecorate %172 RelaxedPrecision
35               OpDecorate %175 RelaxedPrecision
36               OpDecorate %176 RelaxedPrecision
37      %float = OpTypeFloat 32
38    %v4float = OpTypeVector %float 4
39%_ptr_Output_v4float = OpTypePointer Output %v4float
40%sk_FragColor = OpVariable %_ptr_Output_v4float Output
41%_UniformBuffer = OpTypeStruct %v4float %v4float %v4float
42%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
43          %7 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
44       %void = OpTypeVoid
45         %12 = OpTypeFunction %void
46    %float_0 = OpConstant %float 0
47    %v2float = OpTypeVector %float 2
48         %16 = OpConstantComposite %v2float %float_0 %float_0
49%_ptr_Function_v2float = OpTypePointer Function %v2float
50         %20 = OpTypeFunction %v4float %_ptr_Function_v2float
51        %int = OpTypeInt 32 1
52      %v4int = OpTypeVector %int 4
53%_ptr_Function_v4int = OpTypePointer Function %v4int
54%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
55      %int_0 = OpConstant %int 0
56  %float_100 = OpConstant %float 100
57   %int_n100 = OpConstant %int -100
58     %int_75 = OpConstant %int 75
59    %int_100 = OpConstant %int 100
60         %46 = OpConstantComposite %v4int %int_n100 %int_0 %int_75 %int_100
61     %int_50 = OpConstant %int 50
62    %int_225 = OpConstant %int 225
63         %50 = OpConstantComposite %v4int %int_n100 %int_0 %int_50 %int_225
64       %bool = OpTypeBool
65      %false = OpConstantFalse %bool
66      %v2int = OpTypeVector %int 2
67         %61 = OpConstantComposite %v2int %int_n100 %int_n100
68         %62 = OpConstantComposite %v2int %int_100 %int_100
69     %v2bool = OpTypeVector %bool 2
70      %v3int = OpTypeVector %int 3
71         %73 = OpConstantComposite %v3int %int_n100 %int_n100 %int_n100
72         %74 = OpConstantComposite %v3int %int_100 %int_100 %int_100
73     %v3bool = OpTypeVector %bool 3
74         %83 = OpConstantComposite %v4int %int_n100 %int_n100 %int_n100 %int_n100
75         %84 = OpConstantComposite %v4int %int_100 %int_100 %int_100 %int_100
76     %v4bool = OpTypeVector %bool 4
77       %true = OpConstantTrue %bool
78         %95 = OpConstantComposite %v2int %int_n100 %int_0
79        %102 = OpConstantComposite %v3int %int_n100 %int_0 %int_75
80   %int_n200 = OpConstant %int -200
81        %120 = OpConstantComposite %v2int %int_n100 %int_n200
82    %int_200 = OpConstant %int 200
83        %122 = OpConstantComposite %v2int %int_100 %int_200
84        %131 = OpConstantComposite %v3int %int_n100 %int_n200 %int_n200
85        %132 = OpConstantComposite %v3int %int_100 %int_200 %int_50
86        %140 = OpConstantComposite %v4int %int_n100 %int_n200 %int_n200 %int_100
87    %int_300 = OpConstant %int 300
88        %142 = OpConstantComposite %v4int %int_100 %int_200 %int_50 %int_300
89        %157 = OpConstantComposite %v3int %int_n100 %int_0 %int_50
90%_ptr_Function_v4float = OpTypePointer Function %v4float
91      %int_1 = OpConstant %int 1
92      %int_2 = OpConstant %int 2
93%_entrypoint_v = OpFunction %void None %12
94         %13 = OpLabel
95         %17 = OpVariable %_ptr_Function_v2float Function
96               OpStore %17 %16
97         %19 = OpFunctionCall %v4float %main %17
98               OpStore %sk_FragColor %19
99               OpReturn
100               OpFunctionEnd
101       %main = OpFunction %v4float None %20
102         %21 = OpFunctionParameter %_ptr_Function_v2float
103         %22 = OpLabel
104  %intValues = OpVariable %_ptr_Function_v4int Function
105  %expectedA = OpVariable %_ptr_Function_v4int Function
106  %expectedB = OpVariable %_ptr_Function_v4int Function
107        %165 = OpVariable %_ptr_Function_v4float Function
108         %27 = OpAccessChain %_ptr_Uniform_v4float %7 %int_0
109         %30 = OpLoad %v4float %27
110         %32 = OpVectorTimesScalar %v4float %30 %float_100
111         %33 = OpCompositeExtract %float %32 0
112         %34 = OpConvertFToS %int %33
113         %35 = OpCompositeExtract %float %32 1
114         %36 = OpConvertFToS %int %35
115         %37 = OpCompositeExtract %float %32 2
116         %38 = OpConvertFToS %int %37
117         %39 = OpCompositeExtract %float %32 3
118         %40 = OpConvertFToS %int %39
119         %41 = OpCompositeConstruct %v4int %34 %36 %38 %40
120               OpStore %intValues %41
121               OpStore %expectedA %46
122               OpStore %expectedB %50
123         %54 = OpCompositeExtract %int %41 0
124         %53 = OpExtInst %int %1 SClamp %54 %int_n100 %int_100
125         %55 = OpIEqual %bool %53 %int_n100
126               OpSelectionMerge %57 None
127               OpBranchConditional %55 %56 %57
128         %56 = OpLabel
129         %59 = OpVectorShuffle %v2int %41 %41 0 1
130         %58 = OpExtInst %v2int %1 SClamp %59 %61 %62
131         %63 = OpVectorShuffle %v2int %46 %46 0 1
132         %64 = OpIEqual %v2bool %58 %63
133         %66 = OpAll %bool %64
134               OpBranch %57
135         %57 = OpLabel
136         %67 = OpPhi %bool %false %22 %66 %56
137               OpSelectionMerge %69 None
138               OpBranchConditional %67 %68 %69
139         %68 = OpLabel
140         %71 = OpVectorShuffle %v3int %41 %41 0 1 2
141         %70 = OpExtInst %v3int %1 SClamp %71 %73 %74
142         %75 = OpVectorShuffle %v3int %46 %46 0 1 2
143         %76 = OpIEqual %v3bool %70 %75
144         %78 = OpAll %bool %76
145               OpBranch %69
146         %69 = OpLabel
147         %79 = OpPhi %bool %false %57 %78 %68
148               OpSelectionMerge %81 None
149               OpBranchConditional %79 %80 %81
150         %80 = OpLabel
151         %82 = OpExtInst %v4int %1 SClamp %41 %83 %84
152         %85 = OpIEqual %v4bool %82 %46
153         %87 = OpAll %bool %85
154               OpBranch %81
155         %81 = OpLabel
156         %88 = OpPhi %bool %false %69 %87 %80
157               OpSelectionMerge %90 None
158               OpBranchConditional %88 %89 %90
159         %89 = OpLabel
160               OpBranch %90
161         %90 = OpLabel
162         %92 = OpPhi %bool %false %81 %true %89
163               OpSelectionMerge %94 None
164               OpBranchConditional %92 %93 %94
165         %93 = OpLabel
166         %96 = OpVectorShuffle %v2int %46 %46 0 1
167         %97 = OpIEqual %v2bool %95 %96
168         %98 = OpAll %bool %97
169               OpBranch %94
170         %94 = OpLabel
171         %99 = OpPhi %bool %false %90 %98 %93
172               OpSelectionMerge %101 None
173               OpBranchConditional %99 %100 %101
174        %100 = OpLabel
175        %103 = OpVectorShuffle %v3int %46 %46 0 1 2
176        %104 = OpIEqual %v3bool %102 %103
177        %105 = OpAll %bool %104
178               OpBranch %101
179        %101 = OpLabel
180        %106 = OpPhi %bool %false %94 %105 %100
181               OpSelectionMerge %108 None
182               OpBranchConditional %106 %107 %108
183        %107 = OpLabel
184               OpBranch %108
185        %108 = OpLabel
186        %109 = OpPhi %bool %false %101 %true %107
187               OpSelectionMerge %111 None
188               OpBranchConditional %109 %110 %111
189        %110 = OpLabel
190        %112 = OpExtInst %int %1 SClamp %54 %int_n100 %int_100
191        %113 = OpIEqual %bool %112 %int_n100
192               OpBranch %111
193        %111 = OpLabel
194        %114 = OpPhi %bool %false %108 %113 %110
195               OpSelectionMerge %116 None
196               OpBranchConditional %114 %115 %116
197        %115 = OpLabel
198        %118 = OpVectorShuffle %v2int %41 %41 0 1
199        %117 = OpExtInst %v2int %1 SClamp %118 %120 %122
200        %123 = OpVectorShuffle %v2int %50 %50 0 1
201        %124 = OpIEqual %v2bool %117 %123
202        %125 = OpAll %bool %124
203               OpBranch %116
204        %116 = OpLabel
205        %126 = OpPhi %bool %false %111 %125 %115
206               OpSelectionMerge %128 None
207               OpBranchConditional %126 %127 %128
208        %127 = OpLabel
209        %130 = OpVectorShuffle %v3int %41 %41 0 1 2
210        %129 = OpExtInst %v3int %1 SClamp %130 %131 %132
211        %133 = OpVectorShuffle %v3int %50 %50 0 1 2
212        %134 = OpIEqual %v3bool %129 %133
213        %135 = OpAll %bool %134
214               OpBranch %128
215        %128 = OpLabel
216        %136 = OpPhi %bool %false %116 %135 %127
217               OpSelectionMerge %138 None
218               OpBranchConditional %136 %137 %138
219        %137 = OpLabel
220        %139 = OpExtInst %v4int %1 SClamp %41 %140 %142
221        %143 = OpIEqual %v4bool %139 %50
222        %144 = OpAll %bool %143
223               OpBranch %138
224        %138 = OpLabel
225        %145 = OpPhi %bool %false %128 %144 %137
226               OpSelectionMerge %147 None
227               OpBranchConditional %145 %146 %147
228        %146 = OpLabel
229               OpBranch %147
230        %147 = OpLabel
231        %148 = OpPhi %bool %false %138 %true %146
232               OpSelectionMerge %150 None
233               OpBranchConditional %148 %149 %150
234        %149 = OpLabel
235        %151 = OpVectorShuffle %v2int %50 %50 0 1
236        %152 = OpIEqual %v2bool %95 %151
237        %153 = OpAll %bool %152
238               OpBranch %150
239        %150 = OpLabel
240        %154 = OpPhi %bool %false %147 %153 %149
241               OpSelectionMerge %156 None
242               OpBranchConditional %154 %155 %156
243        %155 = OpLabel
244        %158 = OpVectorShuffle %v3int %50 %50 0 1 2
245        %159 = OpIEqual %v3bool %157 %158
246        %160 = OpAll %bool %159
247               OpBranch %156
248        %156 = OpLabel
249        %161 = OpPhi %bool %false %150 %160 %155
250               OpSelectionMerge %163 None
251               OpBranchConditional %161 %162 %163
252        %162 = OpLabel
253               OpBranch %163
254        %163 = OpLabel
255        %164 = OpPhi %bool %false %156 %true %162
256               OpSelectionMerge %169 None
257               OpBranchConditional %164 %167 %168
258        %167 = OpLabel
259        %170 = OpAccessChain %_ptr_Uniform_v4float %7 %int_1
260        %172 = OpLoad %v4float %170
261               OpStore %165 %172
262               OpBranch %169
263        %168 = OpLabel
264        %173 = OpAccessChain %_ptr_Uniform_v4float %7 %int_2
265        %175 = OpLoad %v4float %173
266               OpStore %165 %175
267               OpBranch %169
268        %169 = OpLabel
269        %176 = OpLoad %v4float %165
270               OpReturnValue %176
271               OpFunctionEnd
272