summaryrefslogtreecommitdiff
path: root/test/OpLoopMergeUnroll.spt
diff options
context:
space:
mode:
Diffstat (limited to 'test/OpLoopMergeUnroll.spt')
-rw-r--r--test/OpLoopMergeUnroll.spt88
1 files changed, 88 insertions, 0 deletions
diff --git a/test/OpLoopMergeUnroll.spt b/test/OpLoopMergeUnroll.spt
new file mode 100644
index 0000000..7253b3e
--- /dev/null
+++ b/test/OpLoopMergeUnroll.spt
@@ -0,0 +1,88 @@
+119734787 65536 458752 45 0
+2 Capability Addresses
+2 Capability Linkage
+2 Capability Kernel
+2 Capability Int64
+3 MemoryModel 2 2
+13 EntryPoint 6 1 "loop_merge_branch_conditional_unroll"
+3 Source 3 102000
+3 Name 2 "res"
+3 Name 3 "in"
+3 Name 4 "rep"
+3 Name 5 "num"
+4 Decorate 6 FuncParamAttr 5
+2 DecorationGroup 6
+4 Decorate 7 BuiltIn 28
+3 Decorate 7 Constant
+11 Decorate 7 LinkageAttributes "__spirv_GlobalInvocationId" Import
+4 GroupDecorate 6 2 3
+4 TypeInt 8 64 0
+4 TypeInt 14 32 1
+5 Constant 8 11 32 0
+4 Constant 14 15 0
+4 Constant 14 16 1
+4 TypeVector 9 8 3
+4 TypePointer 10 0 9
+2 TypeBool 12
+2 TypeVoid 13
+4 TypePointer 17 5 14
+4 TypePointer 18 7 14
+7 TypeFunction 19 13 17 17 14 14
+4 Variable 10 7 0
+
+5 Function 13 1 0 19
+3 FunctionParameter 17 2
+3 FunctionParameter 17 3
+3 FunctionParameter 14 4
+3 FunctionParameter 14 5
+
+2 Label 20
+6 Load 9 21 7 2 0
+5 CompositeExtract 8 22 21 0
+5 ShiftLeftLogical 8 23 22 11
+5 ShiftRightArithmetic 8 24 23 11
+4 SConvert 14 25 24
+4 Variable 18 26 7
+4 Variable 18 27 7
+5 Store 26 15 2 4
+5 Store 27 15 2 4
+2 Branch 28
+
+2 Label 28
+4 Load 14 29 27
+5 SLessThan 12 30 29 4
+4 LoopMerge 31 32 1
+4 BranchConditional 30 33 31
+
+2 Label 33
+4 Load 14 34 27
+5 IMul 14 35 34 5
+5 IAdd 14 36 25 35
+5 InBoundsPtrAccessChain 17 37 3 36
+4 Load 14 38 37
+4 Load 14 39 26
+5 IAdd 14 40 39 38
+5 Store 26 40 2 4
+2 Branch 32
+
+2 Label 32
+4 Load 14 41 27
+5 IAdd 14 42 41 16
+3 Store 27 42
+2 Branch 28
+
+2 Label 31
+4 Load 14 43 26
+5 InBoundsPtrAccessChain 17 44 2 24
+5 Store 44 43 2 4
+1 Return
+
+1 FunctionEnd
+
+; RUN: llvm-spirv %s -to-binary -o %t.spv
+; RUN: llvm-spirv -r %t.spv -o %t.bc
+; RUN: llvm-dis < %t.bc | FileCheck %s --check-prefix=CHECK-LLVM
+
+; CHECK-LLVM: br i1 %{{[0-9]+}}, label %{{[0-9]+}}, label %{{[0-9]+}}, !llvm.loop ![[MD:[0-9]+]]
+; CHECK-LLVM: ![[MD]] = distinct !{![[MD]], ![[MD_unroll:[0-9]+]]}
+; CHECK-LLVM: ![[MD_unroll]] = !{!"llvm.loop.unroll.full"} \ No newline at end of file