add SPIR-V 1.4 testing for Image Operands and Loop Controls (#2034)

This PR adds targeted testing for SPIR-V 1.4 features. Specifically,
this PR adds testing for:

1. The new Image Operand for SignExtend and ZeroExtend.
2. The new Loop Controls MinIterations, MaxIterations,
IterationMultiple, PeelCount, and PartialCount.
This commit is contained in:
Ben Ashbaugh
2024-10-22 09:47:31 -07:00
committed by GitHub
parent d1fe1ec252
commit 94257defea
17 changed files with 850 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 31
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability ImageBasic
OpCapability LiteralSampler
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %read_image_test "read_image_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%index_0 = OpConstant %uint 0
%void = OpTypeVoid
%v4uint = OpTypeVector %uint 4
%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint
%image2d_t = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly
%7 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4uint %image2d_t
%sampler_t = OpTypeSampler
%sampledimage_t = OpTypeSampledImage %image2d_t
%v2uint = OpTypeVector %uint 2
%float = OpTypeFloat 32
%sampler = OpConstantSampler %sampler_t None 0 Nearest
%coord_0_0 = OpConstantNull %v2uint
%float_0 = OpConstant %float 0
%read_image_test = OpFunction %void None %7
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint
%image = OpFunctionParameter %image2d_t
%entry = OpLabel
%TempSampledImage = OpSampledImage %sampledimage_t %image %sampler
%call = OpImageSampleExplicitLod %v4uint %TempSampledImage %coord_0_0 Lod|SignExtend %float_0
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %dst %index_0
OpStore %arrayidx %call Aligned 16
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,39 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 31
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpCapability ImageBasic
OpCapability LiteralSampler
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %read_image_test "read_image_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%ulong = OpTypeInt 64 0
%index_0 = OpConstant %ulong 0
%void = OpTypeVoid
%v4uint = OpTypeVector %uint 4
%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint
%image2d_t = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly
%7 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4uint %image2d_t
%sampler_t = OpTypeSampler
%sampledimage_t = OpTypeSampledImage %image2d_t
%v2uint = OpTypeVector %uint 2
%float = OpTypeFloat 32
%sampler = OpConstantSampler %sampler_t None 0 Nearest
%coord_0_0 = OpConstantNull %v2uint
%float_0 = OpConstant %float 0
%read_image_test = OpFunction %void None %7
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint
%image = OpFunctionParameter %image2d_t
%entry = OpLabel
%TempSampledImage = OpSampledImage %sampledimage_t %image %sampler
%call = OpImageSampleExplicitLod %v4uint %TempSampledImage %coord_0_0 Lod|SignExtend %float_0
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %dst %index_0
OpStore %arrayidx %call Aligned 16
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,37 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 31
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability ImageBasic
OpCapability LiteralSampler
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %read_image_test "read_image_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%index_0 = OpConstant %uint 0
%void = OpTypeVoid
%v4uint = OpTypeVector %uint 4
%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint
%image2d_t = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly
%7 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4uint %image2d_t
%sampler_t = OpTypeSampler
%sampledimage_t = OpTypeSampledImage %image2d_t
%v2uint = OpTypeVector %uint 2
%float = OpTypeFloat 32
%sampler = OpConstantSampler %sampler_t None 0 Nearest
%coord_0_0 = OpConstantNull %v2uint
%float_0 = OpConstant %float 0
%read_image_test = OpFunction %void None %7
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint
%image = OpFunctionParameter %image2d_t
%entry = OpLabel
%TempSampledImage = OpSampledImage %sampledimage_t %image %sampler
%call = OpImageSampleExplicitLod %v4uint %TempSampledImage %coord_0_0 Lod|ZeroExtend %float_0
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %dst %index_0
OpStore %arrayidx %call Aligned 16
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,39 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 31
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpCapability ImageBasic
OpCapability LiteralSampler
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %read_image_test "read_image_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%ulong = OpTypeInt 64 0
%index_0 = OpConstant %ulong 0
%void = OpTypeVoid
%v4uint = OpTypeVector %uint 4
%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint
%image2d_t = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly
%7 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4uint %image2d_t
%sampler_t = OpTypeSampler
%sampledimage_t = OpTypeSampledImage %image2d_t
%v2uint = OpTypeVector %uint 2
%float = OpTypeFloat 32
%sampler = OpConstantSampler %sampler_t None 0 Nearest
%coord_0_0 = OpConstantNull %v2uint
%float_0 = OpConstant %float 0
%read_image_test = OpFunction %void None %7
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint
%image = OpFunctionParameter %image2d_t
%entry = OpLabel
%TempSampledImage = OpSampledImage %sampledimage_t %image %sampler
%call = OpImageSampleExplicitLod %v4uint %TempSampledImage %coord_0_0 Lod|ZeroExtend %float_0
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %dst %index_0
OpStore %arrayidx %call Aligned 16
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,43 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 37
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %loop_control_test "loop_control_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %uint
%bool = OpTypeBool
%loop_control_test = OpFunction %void None %5
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%count = OpFunctionParameter %uint
%value = OpFunctionParameter %uint
%entry = OpLabel
OpBranch %for_cond
%for_cond = OpLabel
%sum_0 = OpPhi %uint %uint_0 %entry %add %for_inc
%i_0 = OpPhi %uint %uint_0 %entry %inc %for_inc
%cmp = OpSLessThan %bool %i_0 %count
OpLoopMerge %for_cond_cleanup %for_inc IterationMultiple 2
OpBranchConditional %cmp %for_body %for_cond_cleanup
%for_cond_cleanup = OpLabel
OpBranch %for_end
%for_body = OpLabel
%add = OpIAdd %uint %sum_0 %value
OpBranch %for_inc
%for_inc = OpLabel
%inc = OpIAdd %uint %i_0 %uint_1
OpBranch %for_cond
%for_end = OpLabel
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %uint_0
OpStore %arrayidx %sum_0 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,46 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 37
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %loop_control_test "loop_control_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%ulong = OpTypeInt 64 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%ulong_0 = OpConstant %ulong 0
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %uint
%bool = OpTypeBool
%loop_control_test = OpFunction %void None %5
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%count = OpFunctionParameter %uint
%value = OpFunctionParameter %uint
%entry = OpLabel
OpBranch %for_cond
%for_cond = OpLabel
%sum_0 = OpPhi %uint %uint_0 %entry %add %for_inc
%i_0 = OpPhi %uint %uint_0 %entry %inc %for_inc
%cmp = OpSLessThan %bool %i_0 %count
OpLoopMerge %for_cond_cleanup %for_inc IterationMultiple 2
OpBranchConditional %cmp %for_body %for_cond_cleanup
%for_cond_cleanup = OpLabel
OpBranch %for_end
%for_body = OpLabel
%add = OpIAdd %uint %sum_0 %value
OpBranch %for_inc
%for_inc = OpLabel
%inc = OpIAdd %uint %i_0 %uint_1
OpBranch %for_cond
%for_end = OpLabel
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %ulong_0
OpStore %arrayidx %sum_0 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,43 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 37
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %loop_control_test "loop_control_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %uint
%bool = OpTypeBool
%loop_control_test = OpFunction %void None %5
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%count = OpFunctionParameter %uint
%value = OpFunctionParameter %uint
%entry = OpLabel
OpBranch %for_cond
%for_cond = OpLabel
%sum_0 = OpPhi %uint %uint_0 %entry %add %for_inc
%i_0 = OpPhi %uint %uint_0 %entry %inc %for_inc
%cmp = OpSLessThan %bool %i_0 %count
OpLoopMerge %for_cond_cleanup %for_inc MaxIterations 16
OpBranchConditional %cmp %for_body %for_cond_cleanup
%for_cond_cleanup = OpLabel
OpBranch %for_end
%for_body = OpLabel
%add = OpIAdd %uint %sum_0 %value
OpBranch %for_inc
%for_inc = OpLabel
%inc = OpIAdd %uint %i_0 %uint_1
OpBranch %for_cond
%for_end = OpLabel
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %uint_0
OpStore %arrayidx %sum_0 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,46 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 37
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %loop_control_test "loop_control_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%ulong = OpTypeInt 64 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%ulong_0 = OpConstant %ulong 0
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %uint
%bool = OpTypeBool
%loop_control_test = OpFunction %void None %5
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%count = OpFunctionParameter %uint
%value = OpFunctionParameter %uint
%entry = OpLabel
OpBranch %for_cond
%for_cond = OpLabel
%sum_0 = OpPhi %uint %uint_0 %entry %add %for_inc
%i_0 = OpPhi %uint %uint_0 %entry %inc %for_inc
%cmp = OpSLessThan %bool %i_0 %count
OpLoopMerge %for_cond_cleanup %for_inc MaxIterations 16
OpBranchConditional %cmp %for_body %for_cond_cleanup
%for_cond_cleanup = OpLabel
OpBranch %for_end
%for_body = OpLabel
%add = OpIAdd %uint %sum_0 %value
OpBranch %for_inc
%for_inc = OpLabel
%inc = OpIAdd %uint %i_0 %uint_1
OpBranch %for_cond
%for_end = OpLabel
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %ulong_0
OpStore %arrayidx %sum_0 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,43 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 37
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %loop_control_test "loop_control_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %uint
%bool = OpTypeBool
%loop_control_test = OpFunction %void None %5
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%count = OpFunctionParameter %uint
%value = OpFunctionParameter %uint
%entry = OpLabel
OpBranch %for_cond
%for_cond = OpLabel
%sum_0 = OpPhi %uint %uint_0 %entry %add %for_inc
%i_0 = OpPhi %uint %uint_0 %entry %inc %for_inc
%cmp = OpSLessThan %bool %i_0 %count
OpLoopMerge %for_cond_cleanup %for_inc MinIterations 4
OpBranchConditional %cmp %for_body %for_cond_cleanup
%for_cond_cleanup = OpLabel
OpBranch %for_end
%for_body = OpLabel
%add = OpIAdd %uint %sum_0 %value
OpBranch %for_inc
%for_inc = OpLabel
%inc = OpIAdd %uint %i_0 %uint_1
OpBranch %for_cond
%for_end = OpLabel
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %uint_0
OpStore %arrayidx %sum_0 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,46 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 37
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %loop_control_test "loop_control_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%ulong = OpTypeInt 64 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%ulong_0 = OpConstant %ulong 0
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %uint
%bool = OpTypeBool
%loop_control_test = OpFunction %void None %5
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%count = OpFunctionParameter %uint
%value = OpFunctionParameter %uint
%entry = OpLabel
OpBranch %for_cond
%for_cond = OpLabel
%sum_0 = OpPhi %uint %uint_0 %entry %add %for_inc
%i_0 = OpPhi %uint %uint_0 %entry %inc %for_inc
%cmp = OpSLessThan %bool %i_0 %count
OpLoopMerge %for_cond_cleanup %for_inc MinIterations 4
OpBranchConditional %cmp %for_body %for_cond_cleanup
%for_cond_cleanup = OpLabel
OpBranch %for_end
%for_body = OpLabel
%add = OpIAdd %uint %sum_0 %value
OpBranch %for_inc
%for_inc = OpLabel
%inc = OpIAdd %uint %i_0 %uint_1
OpBranch %for_cond
%for_end = OpLabel
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %ulong_0
OpStore %arrayidx %sum_0 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,43 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 37
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %loop_control_test "loop_control_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %uint
%bool = OpTypeBool
%loop_control_test = OpFunction %void None %5
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%count = OpFunctionParameter %uint
%value = OpFunctionParameter %uint
%entry = OpLabel
OpBranch %for_cond
%for_cond = OpLabel
%sum_0 = OpPhi %uint %uint_0 %entry %add %for_inc
%i_0 = OpPhi %uint %uint_0 %entry %inc %for_inc
%cmp = OpSLessThan %bool %i_0 %count
OpLoopMerge %for_cond_cleanup %for_inc PartialCount 2
OpBranchConditional %cmp %for_body %for_cond_cleanup
%for_cond_cleanup = OpLabel
OpBranch %for_end
%for_body = OpLabel
%add = OpIAdd %uint %sum_0 %value
OpBranch %for_inc
%for_inc = OpLabel
%inc = OpIAdd %uint %i_0 %uint_1
OpBranch %for_cond
%for_end = OpLabel
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %uint_0
OpStore %arrayidx %sum_0 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,46 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 37
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %loop_control_test "loop_control_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%ulong = OpTypeInt 64 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%ulong_0 = OpConstant %ulong 0
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %uint
%bool = OpTypeBool
%loop_control_test = OpFunction %void None %5
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%count = OpFunctionParameter %uint
%value = OpFunctionParameter %uint
%entry = OpLabel
OpBranch %for_cond
%for_cond = OpLabel
%sum_0 = OpPhi %uint %uint_0 %entry %add %for_inc
%i_0 = OpPhi %uint %uint_0 %entry %inc %for_inc
%cmp = OpSLessThan %bool %i_0 %count
OpLoopMerge %for_cond_cleanup %for_inc PartialCount 2
OpBranchConditional %cmp %for_body %for_cond_cleanup
%for_cond_cleanup = OpLabel
OpBranch %for_end
%for_body = OpLabel
%add = OpIAdd %uint %sum_0 %value
OpBranch %for_inc
%for_inc = OpLabel
%inc = OpIAdd %uint %i_0 %uint_1
OpBranch %for_cond
%for_end = OpLabel
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %ulong_0
OpStore %arrayidx %sum_0 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,43 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 37
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %loop_control_test "loop_control_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %uint
%bool = OpTypeBool
%loop_control_test = OpFunction %void None %5
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%count = OpFunctionParameter %uint
%value = OpFunctionParameter %uint
%entry = OpLabel
OpBranch %for_cond
%for_cond = OpLabel
%sum_0 = OpPhi %uint %uint_0 %entry %add %for_inc
%i_0 = OpPhi %uint %uint_0 %entry %inc %for_inc
%cmp = OpSLessThan %bool %i_0 %count
OpLoopMerge %for_cond_cleanup %for_inc PeelCount 2
OpBranchConditional %cmp %for_body %for_cond_cleanup
%for_cond_cleanup = OpLabel
OpBranch %for_end
%for_body = OpLabel
%add = OpIAdd %uint %sum_0 %value
OpBranch %for_inc
%for_inc = OpLabel
%inc = OpIAdd %uint %i_0 %uint_1
OpBranch %for_cond
%for_end = OpLabel
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %uint_0
OpStore %arrayidx %sum_0 Aligned 4
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,46 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 37
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %loop_control_test "loop_control_test"
OpSource OpenCL_C 102000
%uint = OpTypeInt 32 0
%ulong = OpTypeInt 64 0
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%ulong_0 = OpConstant %ulong 0
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%5 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %uint %uint
%bool = OpTypeBool
%loop_control_test = OpFunction %void None %5
%dst = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%count = OpFunctionParameter %uint
%value = OpFunctionParameter %uint
%entry = OpLabel
OpBranch %for_cond
%for_cond = OpLabel
%sum_0 = OpPhi %uint %uint_0 %entry %add %for_inc
%i_0 = OpPhi %uint %uint_0 %entry %inc %for_inc
%cmp = OpSLessThan %bool %i_0 %count
OpLoopMerge %for_cond_cleanup %for_inc PeelCount 2
OpBranchConditional %cmp %for_body %for_cond_cleanup
%for_cond_cleanup = OpLabel
OpBranch %for_end
%for_body = OpLabel
%add = OpIAdd %uint %sum_0 %value
OpBranch %for_inc
%for_inc = OpLabel
%inc = OpIAdd %uint %i_0 %uint_1
OpBranch %for_cond
%for_end = OpLabel
%arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %dst %ulong_0
OpStore %arrayidx %sum_0 Aligned 4
OpReturn
OpFunctionEnd