xref: /aosp_15_r20/external/skia/tests/sksl/shared/MatrixScalarMath.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 "colorGreen"
9               OpMemberName %_UniformBuffer 1 "colorRed"
10               OpMemberName %_UniformBuffer 2 "testInputs"
11               OpName %_entrypoint_v "_entrypoint_v"
12               OpName %test_bifffff22 "test_bifffff22"
13               OpName %one "one"
14               OpName %m2 "m2"
15               OpName %divisionTest_b "divisionTest_b"
16               OpName %ten "ten"
17               OpName %mat "mat"
18               OpName %div "div"
19               OpName %main "main"
20               OpName %f1 "f1"
21               OpName %f2 "f2"
22               OpName %f3 "f3"
23               OpName %f4 "f4"
24               OpName %_0_expected "_0_expected"
25               OpName %_1_one "_1_one"
26               OpName %_2_m2 "_2_m2"
27               OpDecorate %sk_FragColor RelaxedPrecision
28               OpDecorate %sk_FragColor Location 0
29               OpDecorate %sk_FragColor Index 0
30               OpMemberDecorate %_UniformBuffer 0 Offset 0
31               OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
32               OpMemberDecorate %_UniformBuffer 1 Offset 16
33               OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
34               OpMemberDecorate %_UniformBuffer 2 Offset 32
35               OpDecorate %_UniformBuffer Block
36               OpDecorate %9 Binding 0
37               OpDecorate %9 DescriptorSet 0
38               OpDecorate %40 RelaxedPrecision
39               OpDecorate %41 RelaxedPrecision
40               OpDecorate %121 RelaxedPrecision
41               OpDecorate %122 RelaxedPrecision
42               OpDecorate %124 RelaxedPrecision
43               OpDecorate %171 RelaxedPrecision
44               OpDecorate %172 RelaxedPrecision
45               OpDecorate %175 RelaxedPrecision
46               OpDecorate %176 RelaxedPrecision
47               OpDecorate %177 RelaxedPrecision
48               OpDecorate %181 RelaxedPrecision
49               OpDecorate %182 RelaxedPrecision
50               OpDecorate %183 RelaxedPrecision
51               OpDecorate %187 RelaxedPrecision
52               OpDecorate %188 RelaxedPrecision
53               OpDecorate %189 RelaxedPrecision
54               OpDecorate %200 RelaxedPrecision
55               OpDecorate %201 RelaxedPrecision
56               OpDecorate %313 RelaxedPrecision
57               OpDecorate %315 RelaxedPrecision
58               OpDecorate %316 RelaxedPrecision
59      %float = OpTypeFloat 32
60    %v4float = OpTypeVector %float 4
61%_ptr_Output_v4float = OpTypePointer Output %v4float
62%sk_FragColor = OpVariable %_ptr_Output_v4float Output
63%_UniformBuffer = OpTypeStruct %v4float %v4float %v4float
64%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
65          %9 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
66       %void = OpTypeVoid
67         %14 = OpTypeFunction %void
68    %float_0 = OpConstant %float 0
69    %v2float = OpTypeVector %float 2
70         %18 = OpConstantComposite %v2float %float_0 %float_0
71%_ptr_Function_v2float = OpTypePointer Function %v2float
72       %bool = OpTypeBool
73        %int = OpTypeInt 32 1
74%_ptr_Function_int = OpTypePointer Function %int
75%_ptr_Function_float = OpTypePointer Function %float
76%mat2v2float = OpTypeMatrix %v2float 2
77%_ptr_Function_mat2v2float = OpTypePointer Function %mat2v2float
78         %28 = OpTypeFunction %bool %_ptr_Function_int %_ptr_Function_float %_ptr_Function_float %_ptr_Function_float %_ptr_Function_float %_ptr_Function_mat2v2float
79%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
80      %int_1 = OpConstant %int 1
81    %float_1 = OpConstant %float 1
82         %61 = OpConstantComposite %v2float %float_1 %float_1
83         %62 = OpConstantComposite %mat2v2float %61 %61
84    %float_2 = OpConstant %float 2
85  %float_0_5 = OpConstant %float 0.5
86      %false = OpConstantFalse %bool
87      %int_0 = OpConstant %int 0
88        %117 = OpTypeFunction %bool
89   %float_10 = OpConstant %float 10
90      %int_2 = OpConstant %int 2
91    %float_8 = OpConstant %float 8
92        %149 = OpConstantComposite %v4float %float_8 %float_8 %float_8 %float_8
93%float_0_00999999978 = OpConstant %float 0.00999999978
94        %152 = OpConstantComposite %v4float %float_0_00999999978 %float_0_00999999978 %float_0_00999999978 %float_0_00999999978
95     %v4bool = OpTypeVector %bool 4
96        %166 = OpTypeFunction %v4float %_ptr_Function_v2float
97    %float_3 = OpConstant %float 3
98    %float_4 = OpConstant %float 4
99      %int_3 = OpConstant %int 3
100      %int_4 = OpConstant %int 4
101%_ptr_Function_v4float = OpTypePointer Function %v4float
102%_entrypoint_v = OpFunction %void None %14
103         %15 = OpLabel
104         %19 = OpVariable %_ptr_Function_v2float Function
105               OpStore %19 %18
106         %21 = OpFunctionCall %v4float %main %19
107               OpStore %sk_FragColor %21
108               OpReturn
109               OpFunctionEnd
110%test_bifffff22 = OpFunction %bool None %28
111         %29 = OpFunctionParameter %_ptr_Function_int
112         %30 = OpFunctionParameter %_ptr_Function_float
113         %31 = OpFunctionParameter %_ptr_Function_float
114         %32 = OpFunctionParameter %_ptr_Function_float
115         %33 = OpFunctionParameter %_ptr_Function_float
116         %34 = OpFunctionParameter %_ptr_Function_mat2v2float
117         %35 = OpLabel
118        %one = OpVariable %_ptr_Function_float Function
119         %m2 = OpVariable %_ptr_Function_mat2v2float Function
120         %37 = OpAccessChain %_ptr_Uniform_v4float %9 %int_1
121         %40 = OpLoad %v4float %37
122         %41 = OpCompositeExtract %float %40 0
123               OpStore %one %41
124         %43 = OpLoad %float %30
125         %44 = OpFMul %float %43 %41
126         %45 = OpLoad %float %31
127         %46 = OpFMul %float %45 %41
128         %47 = OpLoad %float %32
129         %48 = OpFMul %float %47 %41
130         %49 = OpLoad %float %33
131         %50 = OpFMul %float %49 %41
132         %51 = OpCompositeConstruct %v2float %44 %46
133         %52 = OpCompositeConstruct %v2float %48 %50
134         %53 = OpCompositeConstruct %mat2v2float %51 %52
135               OpStore %m2 %53
136         %54 = OpLoad %int %29
137               OpSelectionMerge %55 None
138               OpSwitch %54 %55 1 %56 2 %57 3 %58 4 %59
139         %56 = OpLabel
140         %63 = OpFAdd %v2float %61 %51
141         %64 = OpFAdd %v2float %61 %52
142         %65 = OpCompositeConstruct %mat2v2float %63 %64
143               OpStore %m2 %65
144               OpBranch %55
145         %57 = OpLabel
146         %66 = OpLoad %mat2v2float %m2
147         %67 = OpCompositeExtract %v2float %66 0
148         %68 = OpFSub %v2float %67 %61
149         %69 = OpCompositeExtract %v2float %66 1
150         %70 = OpFSub %v2float %69 %61
151         %71 = OpCompositeConstruct %mat2v2float %68 %70
152               OpStore %m2 %71
153               OpBranch %55
154         %58 = OpLabel
155         %72 = OpLoad %mat2v2float %m2
156         %74 = OpMatrixTimesScalar %mat2v2float %72 %float_2
157               OpStore %m2 %74
158               OpBranch %55
159         %59 = OpLabel
160         %75 = OpLoad %mat2v2float %m2
161         %77 = OpMatrixTimesScalar %mat2v2float %75 %float_0_5
162               OpStore %m2 %77
163               OpBranch %55
164         %55 = OpLabel
165         %80 = OpAccessChain %_ptr_Function_v2float %m2 %int_0
166         %81 = OpLoad %v2float %80
167         %82 = OpCompositeExtract %float %81 0
168         %83 = OpAccessChain %_ptr_Function_v2float %34 %int_0
169         %84 = OpLoad %v2float %83
170         %85 = OpCompositeExtract %float %84 0
171         %86 = OpFOrdEqual %bool %82 %85
172               OpSelectionMerge %88 None
173               OpBranchConditional %86 %87 %88
174         %87 = OpLabel
175         %89 = OpAccessChain %_ptr_Function_v2float %m2 %int_0
176         %90 = OpLoad %v2float %89
177         %91 = OpCompositeExtract %float %90 1
178         %92 = OpAccessChain %_ptr_Function_v2float %34 %int_0
179         %93 = OpLoad %v2float %92
180         %94 = OpCompositeExtract %float %93 1
181         %95 = OpFOrdEqual %bool %91 %94
182               OpBranch %88
183         %88 = OpLabel
184         %96 = OpPhi %bool %false %55 %95 %87
185               OpSelectionMerge %98 None
186               OpBranchConditional %96 %97 %98
187         %97 = OpLabel
188         %99 = OpAccessChain %_ptr_Function_v2float %m2 %int_1
189        %100 = OpLoad %v2float %99
190        %101 = OpCompositeExtract %float %100 0
191        %102 = OpAccessChain %_ptr_Function_v2float %34 %int_1
192        %103 = OpLoad %v2float %102
193        %104 = OpCompositeExtract %float %103 0
194        %105 = OpFOrdEqual %bool %101 %104
195               OpBranch %98
196         %98 = OpLabel
197        %106 = OpPhi %bool %false %88 %105 %97
198               OpSelectionMerge %108 None
199               OpBranchConditional %106 %107 %108
200        %107 = OpLabel
201        %109 = OpAccessChain %_ptr_Function_v2float %m2 %int_1
202        %110 = OpLoad %v2float %109
203        %111 = OpCompositeExtract %float %110 1
204        %112 = OpAccessChain %_ptr_Function_v2float %34 %int_1
205        %113 = OpLoad %v2float %112
206        %114 = OpCompositeExtract %float %113 1
207        %115 = OpFOrdEqual %bool %111 %114
208               OpBranch %108
209        %108 = OpLabel
210        %116 = OpPhi %bool %false %98 %115 %107
211               OpReturnValue %116
212               OpFunctionEnd
213%divisionTest_b = OpFunction %bool None %117
214        %118 = OpLabel
215        %ten = OpVariable %_ptr_Function_float Function
216        %mat = OpVariable %_ptr_Function_mat2v2float Function
217        %div = OpVariable %_ptr_Function_mat2v2float Function
218        %120 = OpAccessChain %_ptr_Uniform_v4float %9 %int_1
219        %121 = OpLoad %v4float %120
220        %122 = OpCompositeExtract %float %121 0
221        %124 = OpFMul %float %122 %float_10
222               OpStore %ten %124
223        %126 = OpCompositeConstruct %v2float %124 %124
224        %127 = OpCompositeConstruct %mat2v2float %126 %126
225               OpStore %mat %127
226        %129 = OpAccessChain %_ptr_Uniform_v4float %9 %int_2
227        %131 = OpLoad %v4float %129
228        %132 = OpCompositeExtract %float %131 0
229        %133 = OpFDiv %float %float_1 %132
230        %134 = OpMatrixTimesScalar %mat2v2float %127 %133
231               OpStore %div %134
232        %135 = OpAccessChain %_ptr_Uniform_v4float %9 %int_2
233        %136 = OpLoad %v4float %135
234        %137 = OpCompositeExtract %float %136 0
235        %138 = OpFDiv %float %float_1 %137
236        %139 = OpMatrixTimesScalar %mat2v2float %127 %138
237               OpStore %mat %139
238        %143 = OpCompositeExtract %float %134 0 0
239        %144 = OpCompositeExtract %float %134 0 1
240        %145 = OpCompositeExtract %float %134 1 0
241        %146 = OpCompositeExtract %float %134 1 1
242        %147 = OpCompositeConstruct %v4float %143 %144 %145 %146
243        %150 = OpFAdd %v4float %147 %149
244        %142 = OpExtInst %v4float %1 FAbs %150
245        %141 = OpFOrdLessThan %v4bool %142 %152
246        %140 = OpAll %bool %141
247               OpSelectionMerge %155 None
248               OpBranchConditional %140 %154 %155
249        %154 = OpLabel
250        %159 = OpCompositeExtract %float %139 0 0
251        %160 = OpCompositeExtract %float %139 0 1
252        %161 = OpCompositeExtract %float %139 1 0
253        %162 = OpCompositeExtract %float %139 1 1
254        %163 = OpCompositeConstruct %v4float %159 %160 %161 %162
255        %164 = OpFAdd %v4float %163 %149
256        %158 = OpExtInst %v4float %1 FAbs %164
257        %157 = OpFOrdLessThan %v4bool %158 %152
258        %156 = OpAll %bool %157
259               OpBranch %155
260        %155 = OpLabel
261        %165 = OpPhi %bool %false %118 %156 %154
262               OpReturnValue %165
263               OpFunctionEnd
264       %main = OpFunction %v4float None %166
265        %167 = OpFunctionParameter %_ptr_Function_v2float
266        %168 = OpLabel
267         %f1 = OpVariable %_ptr_Function_float Function
268         %f2 = OpVariable %_ptr_Function_float Function
269         %f3 = OpVariable %_ptr_Function_float Function
270         %f4 = OpVariable %_ptr_Function_float Function
271%_0_expected = OpVariable %_ptr_Function_mat2v2float Function
272     %_1_one = OpVariable %_ptr_Function_float Function
273      %_2_m2 = OpVariable %_ptr_Function_mat2v2float Function
274        %252 = OpVariable %_ptr_Function_int Function
275        %253 = OpVariable %_ptr_Function_float Function
276        %254 = OpVariable %_ptr_Function_float Function
277        %255 = OpVariable %_ptr_Function_float Function
278        %256 = OpVariable %_ptr_Function_float Function
279        %264 = OpVariable %_ptr_Function_mat2v2float Function
280        %270 = OpVariable %_ptr_Function_int Function
281        %271 = OpVariable %_ptr_Function_float Function
282        %272 = OpVariable %_ptr_Function_float Function
283        %273 = OpVariable %_ptr_Function_float Function
284        %274 = OpVariable %_ptr_Function_float Function
285        %282 = OpVariable %_ptr_Function_mat2v2float Function
286        %288 = OpVariable %_ptr_Function_int Function
287        %289 = OpVariable %_ptr_Function_float Function
288        %290 = OpVariable %_ptr_Function_float Function
289        %291 = OpVariable %_ptr_Function_float Function
290        %292 = OpVariable %_ptr_Function_float Function
291        %300 = OpVariable %_ptr_Function_mat2v2float Function
292        %307 = OpVariable %_ptr_Function_v4float Function
293        %170 = OpAccessChain %_ptr_Uniform_v4float %9 %int_0
294        %171 = OpLoad %v4float %170
295        %172 = OpCompositeExtract %float %171 1
296               OpStore %f1 %172
297        %174 = OpAccessChain %_ptr_Uniform_v4float %9 %int_0
298        %175 = OpLoad %v4float %174
299        %176 = OpCompositeExtract %float %175 1
300        %177 = OpFMul %float %float_2 %176
301               OpStore %f2 %177
302        %180 = OpAccessChain %_ptr_Uniform_v4float %9 %int_0
303        %181 = OpLoad %v4float %180
304        %182 = OpCompositeExtract %float %181 1
305        %183 = OpFMul %float %float_3 %182
306               OpStore %f3 %183
307        %186 = OpAccessChain %_ptr_Uniform_v4float %9 %int_0
308        %187 = OpLoad %v4float %186
309        %188 = OpCompositeExtract %float %187 1
310        %189 = OpFMul %float %float_4 %188
311               OpStore %f4 %189
312        %191 = OpFAdd %float %172 %float_1
313        %192 = OpFAdd %float %177 %float_1
314        %193 = OpFAdd %float %183 %float_1
315        %194 = OpFAdd %float %189 %float_1
316        %195 = OpCompositeConstruct %v2float %191 %192
317        %196 = OpCompositeConstruct %v2float %193 %194
318        %197 = OpCompositeConstruct %mat2v2float %195 %196
319               OpStore %_0_expected %197
320        %199 = OpAccessChain %_ptr_Uniform_v4float %9 %int_1
321        %200 = OpLoad %v4float %199
322        %201 = OpCompositeExtract %float %200 0
323               OpStore %_1_one %201
324        %203 = OpFMul %float %172 %201
325        %204 = OpFMul %float %177 %201
326        %205 = OpFMul %float %183 %201
327        %206 = OpFMul %float %189 %201
328        %207 = OpCompositeConstruct %v2float %203 %204
329        %208 = OpCompositeConstruct %v2float %205 %206
330        %209 = OpCompositeConstruct %mat2v2float %207 %208
331               OpStore %_2_m2 %209
332        %210 = OpFAdd %v2float %61 %207
333        %211 = OpFAdd %v2float %61 %208
334        %212 = OpCompositeConstruct %mat2v2float %210 %211
335               OpStore %_2_m2 %212
336        %213 = OpAccessChain %_ptr_Function_v2float %_2_m2 %int_0
337        %214 = OpLoad %v2float %213
338        %215 = OpCompositeExtract %float %214 0
339        %216 = OpAccessChain %_ptr_Function_v2float %_0_expected %int_0
340        %217 = OpLoad %v2float %216
341        %218 = OpCompositeExtract %float %217 0
342        %219 = OpFOrdEqual %bool %215 %218
343               OpSelectionMerge %221 None
344               OpBranchConditional %219 %220 %221
345        %220 = OpLabel
346        %222 = OpAccessChain %_ptr_Function_v2float %_2_m2 %int_0
347        %223 = OpLoad %v2float %222
348        %224 = OpCompositeExtract %float %223 1
349        %225 = OpAccessChain %_ptr_Function_v2float %_0_expected %int_0
350        %226 = OpLoad %v2float %225
351        %227 = OpCompositeExtract %float %226 1
352        %228 = OpFOrdEqual %bool %224 %227
353               OpBranch %221
354        %221 = OpLabel
355        %229 = OpPhi %bool %false %168 %228 %220
356               OpSelectionMerge %231 None
357               OpBranchConditional %229 %230 %231
358        %230 = OpLabel
359        %232 = OpAccessChain %_ptr_Function_v2float %_2_m2 %int_1
360        %233 = OpLoad %v2float %232
361        %234 = OpCompositeExtract %float %233 0
362        %235 = OpAccessChain %_ptr_Function_v2float %_0_expected %int_1
363        %236 = OpLoad %v2float %235
364        %237 = OpCompositeExtract %float %236 0
365        %238 = OpFOrdEqual %bool %234 %237
366               OpBranch %231
367        %231 = OpLabel
368        %239 = OpPhi %bool %false %221 %238 %230
369               OpSelectionMerge %241 None
370               OpBranchConditional %239 %240 %241
371        %240 = OpLabel
372        %242 = OpAccessChain %_ptr_Function_v2float %_2_m2 %int_1
373        %243 = OpLoad %v2float %242
374        %244 = OpCompositeExtract %float %243 1
375        %245 = OpAccessChain %_ptr_Function_v2float %_0_expected %int_1
376        %246 = OpLoad %v2float %245
377        %247 = OpCompositeExtract %float %246 1
378        %248 = OpFOrdEqual %bool %244 %247
379               OpBranch %241
380        %241 = OpLabel
381        %249 = OpPhi %bool %false %231 %248 %240
382               OpSelectionMerge %251 None
383               OpBranchConditional %249 %250 %251
384        %250 = OpLabel
385               OpStore %252 %int_2
386               OpStore %253 %172
387               OpStore %254 %177
388               OpStore %255 %183
389               OpStore %256 %189
390        %257 = OpFSub %float %172 %float_1
391        %258 = OpFSub %float %177 %float_1
392        %259 = OpFSub %float %183 %float_1
393        %260 = OpFSub %float %189 %float_1
394        %261 = OpCompositeConstruct %v2float %257 %258
395        %262 = OpCompositeConstruct %v2float %259 %260
396        %263 = OpCompositeConstruct %mat2v2float %261 %262
397               OpStore %264 %263
398        %265 = OpFunctionCall %bool %test_bifffff22 %252 %253 %254 %255 %256 %264
399               OpBranch %251
400        %251 = OpLabel
401        %266 = OpPhi %bool %false %241 %265 %250
402               OpSelectionMerge %268 None
403               OpBranchConditional %266 %267 %268
404        %267 = OpLabel
405               OpStore %270 %int_3
406               OpStore %271 %172
407               OpStore %272 %177
408               OpStore %273 %183
409               OpStore %274 %189
410        %275 = OpFMul %float %172 %float_2
411        %276 = OpFMul %float %177 %float_2
412        %277 = OpFMul %float %183 %float_2
413        %278 = OpFMul %float %189 %float_2
414        %279 = OpCompositeConstruct %v2float %275 %276
415        %280 = OpCompositeConstruct %v2float %277 %278
416        %281 = OpCompositeConstruct %mat2v2float %279 %280
417               OpStore %282 %281
418        %283 = OpFunctionCall %bool %test_bifffff22 %270 %271 %272 %273 %274 %282
419               OpBranch %268
420        %268 = OpLabel
421        %284 = OpPhi %bool %false %251 %283 %267
422               OpSelectionMerge %286 None
423               OpBranchConditional %284 %285 %286
424        %285 = OpLabel
425               OpStore %288 %int_4
426               OpStore %289 %172
427               OpStore %290 %177
428               OpStore %291 %183
429               OpStore %292 %189
430        %293 = OpFMul %float %172 %float_0_5
431        %294 = OpFMul %float %177 %float_0_5
432        %295 = OpFMul %float %183 %float_0_5
433        %296 = OpFMul %float %189 %float_0_5
434        %297 = OpCompositeConstruct %v2float %293 %294
435        %298 = OpCompositeConstruct %v2float %295 %296
436        %299 = OpCompositeConstruct %mat2v2float %297 %298
437               OpStore %300 %299
438        %301 = OpFunctionCall %bool %test_bifffff22 %288 %289 %290 %291 %292 %300
439               OpBranch %286
440        %286 = OpLabel
441        %302 = OpPhi %bool %false %268 %301 %285
442               OpSelectionMerge %304 None
443               OpBranchConditional %302 %303 %304
444        %303 = OpLabel
445        %305 = OpFunctionCall %bool %divisionTest_b
446               OpBranch %304
447        %304 = OpLabel
448        %306 = OpPhi %bool %false %286 %305 %303
449               OpSelectionMerge %311 None
450               OpBranchConditional %306 %309 %310
451        %309 = OpLabel
452        %312 = OpAccessChain %_ptr_Uniform_v4float %9 %int_0
453        %313 = OpLoad %v4float %312
454               OpStore %307 %313
455               OpBranch %311
456        %310 = OpLabel
457        %314 = OpAccessChain %_ptr_Uniform_v4float %9 %int_1
458        %315 = OpLoad %v4float %314
459               OpStore %307 %315
460               OpBranch %311
461        %311 = OpLabel
462        %316 = OpLoad %v4float %307
463               OpReturnValue %316
464               OpFunctionEnd
465