1; SPIR-V
2; Version: 1.0
3; Generator: Khronos Glslang Reference Front End; 7
4; Bound: 29
5; Schema: 0
6               OpCapability Shader
7          %1 = OpExtInstImport "GLSL.std.450"
8               OpMemoryModel Logical GLSL450
9               OpEntryPoint Fragment %main "main" %vIndex %FragColor
10               OpExecutionMode %main OriginUpperLeft
11               OpSource GLSL 450
12               OpName %main "main"
13               OpName %vIndex "vIndex"
14               OpName %FragColor "FragColor"
15               OpName %i "i"
16               OpName %j "j"
17               OpDecorate %vIndex Flat
18               OpDecorate %vIndex Location 0
19               OpDecorate %FragColor Location 0
20       %void = OpTypeVoid
21          %3 = OpTypeFunction %void
22        %int = OpTypeInt 32 1
23       %bool = OpTypeBool
24 %int_0 = OpConstant %int 0
25 %int_1 = OpConstant %int 1
26 %int_2 = OpConstant %int 2
27 %int_3 = OpConstant %int 3
28%_ptr_Input_int = OpTypePointer Input %int
29     %vIndex = OpVariable %_ptr_Input_int Input
30      %float = OpTypeFloat 32
31    %v4float = OpTypeVector %float 4
32%_ptr_Output_v4float = OpTypePointer Output %v4float
33  %FragColor = OpVariable %_ptr_Output_v4float Output
34%_ptr_Function_int = OpTypePointer Function %int
35       %main = OpFunction %void None %3
36          %header = OpLabel
37          %i = OpVariable %_ptr_Function_int Function %int_0
38          %j = OpVariable %_ptr_Function_int Function
39          %9 = OpLoad %int %vIndex
40               OpSelectionMerge %switch_merge None
41               OpSwitch %9 %default_case 100 %default_case 0 %case_0 1 %case_1 11 %case_1 2 %case_2 3 %case_3 4 %case_4 5 %case_5
42
43         %case_0 = OpLabel
44               OpBranch %default_case
45
46         %default_case = OpLabel
47               %default_case_phi = OpPhi %int %int_2 %header %int_3 %case_0
48               ; Test what happens when a case block dominates access to a variable.
49               OpStore %j %default_case_phi
50               OpBranch %case_1
51
52         %case_1 = OpLabel
53               ; Test phi nodes between case labels.
54               %case_1_phi = OpPhi %int %int_0 %default_case %int_1 %header
55               OpStore %j %case_1_phi
56               OpBranch %case_2
57
58         %case_2 = OpLabel
59               OpBranch %switch_merge
60
61         %case_3 = OpLabel
62            ; Conditionally branch to another case block. This is really dumb, but it is apparently legal.
63            %case_3_cond = OpSGreaterThan %bool %9 %int_3
64            OpBranchConditional %case_3_cond %case_4 %switch_merge
65
66         %case_4 = OpLabel
67            ; When emitted from case 3, we should *not* see fallthrough behavior.
68            OpBranch %case_5
69
70         %case_5 = OpLabel
71            OpStore %i %int_0
72            OpBranch %switch_merge
73
74         %switch_merge = OpLabel
75         %26 = OpLoad %int %i
76         %27 = OpConvertSToF %float %26
77         %28 = OpCompositeConstruct %v4float %27 %27 %27 %27
78               OpStore %FragColor %28
79               OpReturn
80               OpFunctionEnd
81