1 ; RUN: %if spirv-tools %{ spirv-as %s -o - | spirv-val - %}
2 ; RUN: spirv-sim --function=simple --wave=4 --expects=0,1,2,0 -i %s
4 OpCapability GroupNonUniform
5 OpMemoryModel Logical GLSL450
6 OpEntryPoint GLCompute %main "main" %WaveIndex
7 OpExecutionMode %main LocalSize 1 1 1
9 OpName %simple "simple"
11 OpDecorate %WaveIndex BuiltIn SubgroupLocalInvocationId
13 %uint = OpTypeInt 32 0
15 %int_0 = OpConstant %int 0
16 %int_1 = OpConstant %int 1
17 %int_2 = OpConstant %int 2
18 %uint_0 = OpConstant %uint 0
20 %main_type = OpTypeFunction %void
21 %simple_type = OpTypeFunction %int
22 %uint_iptr = OpTypePointer Input %uint
23 %WaveIndex = OpVariable %uint_iptr Input
24 %main = OpFunction %void None %main_type
28 %simple = OpFunction %int None %simple_type
30 %2 = OpLoad %uint %WaveIndex
31 OpSelectionMerge %merge None
32 OpSwitch %2 %default 1 %case_1 2 %case_2
40 %4 = OpPhi %int %int_0 %default %int_1 %case_1 %int_2 %case_2