xref: /aosp_15_r20/external/skia/tests/sksl/shared/SwitchWithLoops.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               OpName %_entrypoint_v "_entrypoint_v"
11               OpName %switch_with_continue_in_loop_bi "switch_with_continue_in_loop_bi"
12               OpName %val "val"
13               OpName %i "i"
14               OpName %loop_with_break_in_switch_bi "loop_with_break_in_switch_bi"
15               OpName %val_0 "val"
16               OpName %i_0 "i"
17               OpName %main "main"
18               OpName %x "x"
19               OpName %_0_val "_0_val"
20               OpName %_1_i "_1_i"
21               OpDecorate %sk_FragColor RelaxedPrecision
22               OpDecorate %sk_FragColor Location 0
23               OpDecorate %sk_FragColor Index 0
24               OpMemberDecorate %_UniformBuffer 0 Offset 0
25               OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
26               OpMemberDecorate %_UniformBuffer 1 Offset 16
27               OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
28               OpDecorate %_UniformBuffer Block
29               OpDecorate %9 Binding 0
30               OpDecorate %9 DescriptorSet 0
31               OpDecorate %84 RelaxedPrecision
32               OpDecorate %85 RelaxedPrecision
33               OpDecorate %126 RelaxedPrecision
34               OpDecorate %128 RelaxedPrecision
35               OpDecorate %129 RelaxedPrecision
36      %float = OpTypeFloat 32
37    %v4float = OpTypeVector %float 4
38%_ptr_Output_v4float = OpTypePointer Output %v4float
39%sk_FragColor = OpVariable %_ptr_Output_v4float Output
40%_UniformBuffer = OpTypeStruct %v4float %v4float
41%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
42          %9 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
43       %void = OpTypeVoid
44         %14 = OpTypeFunction %void
45    %float_0 = OpConstant %float 0
46    %v2float = OpTypeVector %float 2
47         %18 = OpConstantComposite %v2float %float_0 %float_0
48%_ptr_Function_v2float = OpTypePointer Function %v2float
49       %bool = OpTypeBool
50        %int = OpTypeInt 32 1
51%_ptr_Function_int = OpTypePointer Function %int
52         %25 = OpTypeFunction %bool %_ptr_Function_int
53      %int_0 = OpConstant %int 0
54     %int_10 = OpConstant %int 10
55      %int_1 = OpConstant %int 1
56     %int_11 = OpConstant %int 11
57      %false = OpConstantFalse %bool
58     %int_20 = OpConstant %int 20
59         %78 = OpTypeFunction %v4float %_ptr_Function_v2float
60%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
61      %int_2 = OpConstant %int 2
62%_ptr_Function_v4float = OpTypePointer Function %v4float
63%_entrypoint_v = OpFunction %void None %14
64         %15 = OpLabel
65         %19 = OpVariable %_ptr_Function_v2float Function
66               OpStore %19 %18
67         %21 = OpFunctionCall %v4float %main %19
68               OpStore %sk_FragColor %21
69               OpReturn
70               OpFunctionEnd
71%switch_with_continue_in_loop_bi = OpFunction %bool None %25
72         %26 = OpFunctionParameter %_ptr_Function_int
73         %27 = OpLabel
74        %val = OpVariable %_ptr_Function_int Function
75          %i = OpVariable %_ptr_Function_int Function
76               OpStore %val %int_0
77         %30 = OpLoad %int %26
78               OpSelectionMerge %31 None
79               OpSwitch %30 %33 1 %32
80         %32 = OpLabel
81               OpStore %i %int_0
82               OpBranch %35
83         %35 = OpLabel
84               OpLoopMerge %39 %38 None
85               OpBranch %36
86         %36 = OpLabel
87         %40 = OpLoad %int %i
88         %42 = OpSLessThan %bool %40 %int_10
89               OpBranchConditional %42 %37 %39
90         %37 = OpLabel
91         %44 = OpLoad %int %val
92         %45 = OpIAdd %int %44 %int_1
93               OpStore %val %45
94               OpBranch %38
95         %38 = OpLabel
96         %46 = OpLoad %int %i
97         %47 = OpIAdd %int %46 %int_1
98               OpStore %i %47
99               OpBranch %35
100         %39 = OpLabel
101               OpBranch %33
102         %33 = OpLabel
103         %48 = OpLoad %int %val
104         %49 = OpIAdd %int %48 %int_1
105               OpStore %val %49
106               OpBranch %31
107         %31 = OpLabel
108         %50 = OpLoad %int %val
109         %52 = OpIEqual %bool %50 %int_11
110               OpReturnValue %52
111               OpFunctionEnd
112%loop_with_break_in_switch_bi = OpFunction %bool None %25
113         %53 = OpFunctionParameter %_ptr_Function_int
114         %54 = OpLabel
115      %val_0 = OpVariable %_ptr_Function_int Function
116        %i_0 = OpVariable %_ptr_Function_int Function
117               OpStore %val_0 %int_0
118               OpStore %i_0 %int_0
119               OpBranch %57
120         %57 = OpLabel
121               OpLoopMerge %61 %60 None
122               OpBranch %58
123         %58 = OpLabel
124         %62 = OpLoad %int %i_0
125         %63 = OpSLessThan %bool %62 %int_10
126               OpBranchConditional %63 %59 %61
127         %59 = OpLabel
128         %64 = OpLoad %int %53
129               OpSelectionMerge %65 None
130               OpSwitch %64 %67 1 %66
131         %66 = OpLabel
132         %68 = OpLoad %int %val_0
133         %69 = OpIAdd %int %68 %int_1
134               OpStore %val_0 %69
135               OpBranch %65
136         %67 = OpLabel
137               OpReturnValue %false
138         %65 = OpLabel
139         %71 = OpLoad %int %val_0
140         %72 = OpIAdd %int %71 %int_1
141               OpStore %val_0 %72
142               OpBranch %60
143         %60 = OpLabel
144         %73 = OpLoad %int %i_0
145         %74 = OpIAdd %int %73 %int_1
146               OpStore %i_0 %74
147               OpBranch %57
148         %61 = OpLabel
149         %75 = OpLoad %int %val_0
150         %77 = OpIEqual %bool %75 %int_20
151               OpReturnValue %77
152               OpFunctionEnd
153       %main = OpFunction %v4float None %78
154         %79 = OpFunctionParameter %_ptr_Function_v2float
155         %80 = OpLabel
156          %x = OpVariable %_ptr_Function_int Function
157     %_0_val = OpVariable %_ptr_Function_int Function
158       %_1_i = OpVariable %_ptr_Function_int Function
159        %111 = OpVariable %_ptr_Function_int Function
160        %117 = OpVariable %_ptr_Function_int Function
161        %120 = OpVariable %_ptr_Function_v4float Function
162         %82 = OpAccessChain %_ptr_Uniform_v4float %9 %int_0
163         %84 = OpLoad %v4float %82
164         %85 = OpCompositeExtract %float %84 1
165         %86 = OpConvertFToS %int %85
166               OpStore %x %86
167               OpStore %_0_val %int_0
168               OpSelectionMerge %88 None
169               OpSwitch %86 %90 1 %89
170         %89 = OpLabel
171               OpStore %_1_i %int_0
172               OpBranch %92
173         %92 = OpLabel
174               OpLoopMerge %96 %95 None
175               OpBranch %93
176         %93 = OpLabel
177         %97 = OpLoad %int %_1_i
178         %98 = OpSLessThan %bool %97 %int_10
179               OpBranchConditional %98 %94 %96
180         %94 = OpLabel
181         %99 = OpLoad %int %_0_val
182        %100 = OpIAdd %int %99 %int_1
183               OpStore %_0_val %100
184               OpBranch %96
185         %95 = OpLabel
186        %101 = OpLoad %int %_1_i
187        %102 = OpIAdd %int %101 %int_1
188               OpStore %_1_i %102
189               OpBranch %92
190         %96 = OpLabel
191               OpBranch %90
192         %90 = OpLabel
193        %103 = OpLoad %int %_0_val
194        %104 = OpIAdd %int %103 %int_1
195               OpStore %_0_val %104
196               OpBranch %88
197         %88 = OpLabel
198        %105 = OpLoad %int %_0_val
199        %107 = OpIEqual %bool %105 %int_2
200               OpSelectionMerge %109 None
201               OpBranchConditional %107 %108 %109
202        %108 = OpLabel
203        %110 = OpLoad %int %x
204               OpStore %111 %110
205        %112 = OpFunctionCall %bool %switch_with_continue_in_loop_bi %111
206               OpBranch %109
207        %109 = OpLabel
208        %113 = OpPhi %bool %false %88 %112 %108
209               OpSelectionMerge %115 None
210               OpBranchConditional %113 %114 %115
211        %114 = OpLabel
212        %116 = OpLoad %int %x
213               OpStore %117 %116
214        %118 = OpFunctionCall %bool %loop_with_break_in_switch_bi %117
215               OpBranch %115
216        %115 = OpLabel
217        %119 = OpPhi %bool %false %109 %118 %114
218               OpSelectionMerge %124 None
219               OpBranchConditional %119 %122 %123
220        %122 = OpLabel
221        %125 = OpAccessChain %_ptr_Uniform_v4float %9 %int_0
222        %126 = OpLoad %v4float %125
223               OpStore %120 %126
224               OpBranch %124
225        %123 = OpLabel
226        %127 = OpAccessChain %_ptr_Uniform_v4float %9 %int_1
227        %128 = OpLoad %v4float %127
228               OpStore %120 %128
229               OpBranch %124
230        %124 = OpLabel
231        %129 = OpLoad %v4float %120
232               OpReturnValue %129
233               OpFunctionEnd
234