1 ; RUN: %if spirv-tools %{ spirv-as %s -o - | spirv-val - %}
2 ; RUN: spirv-sim --function=simple --wave=4 --expects=0,2,2,4 -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_2 = OpConstant %int 2
16 %int_5 = OpConstant %int 5
17 %int_6 = OpConstant %int 6
18 %uint_0 = OpConstant %uint 0
19 %uint_2 = OpConstant %uint 2
21 %main_type = OpTypeFunction %void
22 %simple_type = OpTypeFunction %int
23 %uint_iptr = OpTypePointer Input %uint
24 %uint_fptr = OpTypePointer Function %uint
25 %WaveIndex = OpVariable %uint_iptr Input
26 %main = OpFunction %void None %main_type
30 %simple = OpFunction %int None %simple_type
33 %i = OpVariable %uint_fptr Function
34 %1 = OpLoad %uint %WaveIndex
39 %3 = OpULessThan %bool %2 %1
40 OpLoopMerge %merge %continue None
41 OpBranchConditional %3 %body %merge
42 ; while (i < WaveGetLaneIndex()) {
48 %4 = OpIAdd %uint %2 %uint_2
54 %6 = OpBitcast %int %5