Skip to content

Commit 39f4d9b

Browse files
committed
convert tests to filecheck
1 parent b696bda commit 39f4d9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+5209
-1000
lines changed

llvm/test/CodeGen/SPIRV/structurizer/cf.for.continue.hlsl

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - -filetype=obj | spirv-val %}
3+
; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | spirv-sim --function=_Z7processv --wave=1 --expects=19
4+
5+
;
6+
; int process() {
7+
; int val = 0;
8+
;
9+
; for (int i = 0; i < 10; ++i) {
10+
; if (i < 5) {
11+
; continue;
12+
; }
13+
; val = i;
14+
;
15+
; {
16+
; continue;
17+
; }
18+
; val++; // No SPIR-V should be emitted for this statement.
19+
; continue; // No SPIR-V should be emitted for this statement.
20+
; while(true); // No SPIR-V should be emitted for this statement.
21+
; }
22+
;
23+
; //////////////////////////////////////////////////////////////////////////////////////
24+
; // Nested for loops with continue statements //
25+
; // Each continue statement should branch to the corresponding loop's continue block //
26+
; //////////////////////////////////////////////////////////////////////////////////////
27+
;
28+
; for (int j = 0; j < 10; ++j) {
29+
; val = j+5;
30+
;
31+
; for ( ; val < 20; ++val) {
32+
; int k = val + j;
33+
; continue;
34+
; k++; // No SPIR-V should be emitted for this statement.
35+
; }
36+
;
37+
; val -= 1;
38+
; continue;
39+
; continue; // No SPIR-V should be emitted for this statement.
40+
; val = val*10; // No SPIR-V should be emitted for this statement.
41+
; }
42+
;
43+
; return val;
44+
; }
45+
;
46+
; [numthreads(1, 1, 1)]
47+
; void main() {
48+
; process();
49+
; }
50+
51+
; CHECK: %[[#func_12:]] = OpFunction %[[#uint:]] DontInline %[[#]]
52+
; CHECK: %[[#bb44:]] = OpLabel
53+
; CHECK: OpBranch %[[#bb45:]]
54+
; CHECK: %[[#bb45:]] = OpLabel
55+
; CHECK: OpLoopMerge %[[#bb46:]] %[[#bb47:]] None
56+
; CHECK: OpBranchConditional %[[#]] %[[#bb48:]] %[[#bb46:]]
57+
; CHECK: %[[#bb46:]] = OpLabel
58+
; CHECK: OpBranch %[[#bb49:]]
59+
; CHECK: %[[#bb49:]] = OpLabel
60+
; CHECK: OpLoopMerge %[[#bb50:]] %[[#bb51:]] None
61+
; CHECK: OpBranchConditional %[[#]] %[[#bb52:]] %[[#bb50:]]
62+
; CHECK: %[[#bb50:]] = OpLabel
63+
; CHECK: OpReturnValue %[[#]]
64+
; CHECK: %[[#bb52:]] = OpLabel
65+
; CHECK: OpBranch %[[#bb53:]]
66+
; CHECK: %[[#bb53:]] = OpLabel
67+
; CHECK: OpLoopMerge %[[#bb54:]] %[[#bb55:]] None
68+
; CHECK: OpBranchConditional %[[#]] %[[#bb56:]] %[[#bb54:]]
69+
; CHECK: %[[#bb54:]] = OpLabel
70+
; CHECK: OpBranch %[[#bb51:]]
71+
; CHECK: %[[#bb51:]] = OpLabel
72+
; CHECK: OpBranch %[[#bb49:]]
73+
; CHECK: %[[#bb56:]] = OpLabel
74+
; CHECK: OpBranch %[[#bb55:]]
75+
; CHECK: %[[#bb55:]] = OpLabel
76+
; CHECK: OpBranch %[[#bb53:]]
77+
; CHECK: %[[#bb48:]] = OpLabel
78+
; CHECK: OpSelectionMerge %[[#bb57:]] None
79+
; CHECK: OpBranchConditional %[[#]] %[[#bb57:]] %[[#bb58:]]
80+
; CHECK: %[[#bb58:]] = OpLabel
81+
; CHECK: OpBranch %[[#bb57:]]
82+
; CHECK: %[[#bb57:]] = OpLabel
83+
; CHECK: OpBranch %[[#bb47:]]
84+
; CHECK: %[[#bb47:]] = OpLabel
85+
; CHECK: OpBranch %[[#bb45:]]
86+
; CHECK: OpFunctionEnd
87+
; CHECK: %[[#func_40:]] = OpFunction %[[#void:]] DontInline %[[#]]
88+
; CHECK: %[[#bb59:]] = OpLabel
89+
; CHECK: OpReturn
90+
; CHECK: OpFunctionEnd
91+
; CHECK: %[[#func_42:]] = OpFunction %[[#void:]] None %[[#]]
92+
; CHECK: %[[#bb60:]] = OpLabel
93+
; CHECK: OpReturn
94+
; CHECK: OpFunctionEnd
95+
96+
97+
98+
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"
99+
target triple = "spirv-unknown-vulkan1.3-compute"
100+
101+
; Function Attrs: convergent noinline norecurse nounwind optnone
102+
define spir_func noundef i32 @_Z7processv() #0 {
103+
entry:
104+
%0 = call token @llvm.experimental.convergence.entry()
105+
%val = alloca i32, align 4
106+
%i = alloca i32, align 4
107+
%j = alloca i32, align 4
108+
%k = alloca i32, align 4
109+
store i32 0, ptr %val, align 4
110+
store i32 0, ptr %i, align 4
111+
br label %for.cond
112+
113+
for.cond: ; preds = %for.inc, %entry
114+
%1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]
115+
%2 = load i32, ptr %i, align 4
116+
%cmp = icmp slt i32 %2, 10
117+
br i1 %cmp, label %for.body, label %for.end
118+
119+
for.body: ; preds = %for.cond
120+
%3 = load i32, ptr %i, align 4
121+
%cmp1 = icmp slt i32 %3, 5
122+
br i1 %cmp1, label %if.then, label %if.end
123+
124+
if.then: ; preds = %for.body
125+
br label %for.inc
126+
127+
if.end: ; preds = %for.body
128+
%4 = load i32, ptr %i, align 4
129+
store i32 %4, ptr %val, align 4
130+
br label %for.inc
131+
132+
for.inc: ; preds = %if.end, %if.then
133+
%5 = load i32, ptr %i, align 4
134+
%inc = add nsw i32 %5, 1
135+
store i32 %inc, ptr %i, align 4
136+
br label %for.cond
137+
138+
for.end: ; preds = %for.cond
139+
store i32 0, ptr %j, align 4
140+
br label %for.cond2
141+
142+
for.cond2: ; preds = %for.inc12, %for.end
143+
%6 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]
144+
%7 = load i32, ptr %j, align 4
145+
%cmp3 = icmp slt i32 %7, 10
146+
br i1 %cmp3, label %for.body4, label %for.end14
147+
148+
for.body4: ; preds = %for.cond2
149+
%8 = load i32, ptr %j, align 4
150+
%add = add nsw i32 %8, 5
151+
store i32 %add, ptr %val, align 4
152+
br label %for.cond5
153+
154+
for.cond5: ; preds = %for.inc9, %for.body4
155+
%9 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %6) ]
156+
%10 = load i32, ptr %val, align 4
157+
%cmp6 = icmp slt i32 %10, 20
158+
br i1 %cmp6, label %for.body7, label %for.end11
159+
160+
for.body7: ; preds = %for.cond5
161+
%11 = load i32, ptr %val, align 4
162+
%12 = load i32, ptr %j, align 4
163+
%add8 = add nsw i32 %11, %12
164+
store i32 %add8, ptr %k, align 4
165+
br label %for.inc9
166+
167+
for.inc9: ; preds = %for.body7
168+
%13 = load i32, ptr %val, align 4
169+
%inc10 = add nsw i32 %13, 1
170+
store i32 %inc10, ptr %val, align 4
171+
br label %for.cond5
172+
173+
for.end11: ; preds = %for.cond5
174+
%14 = load i32, ptr %val, align 4
175+
%sub = sub nsw i32 %14, 1
176+
store i32 %sub, ptr %val, align 4
177+
br label %for.inc12
178+
179+
for.inc12: ; preds = %for.end11
180+
%15 = load i32, ptr %j, align 4
181+
%inc13 = add nsw i32 %15, 1
182+
store i32 %inc13, ptr %j, align 4
183+
br label %for.cond2
184+
185+
for.end14: ; preds = %for.cond2
186+
%16 = load i32, ptr %val, align 4
187+
ret i32 %16
188+
}
189+
190+
; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
191+
declare token @llvm.experimental.convergence.entry() #1
192+
193+
; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)
194+
declare token @llvm.experimental.convergence.loop() #1
195+
196+
; Function Attrs: convergent noinline norecurse nounwind optnone
197+
define internal spir_func void @main() #0 {
198+
entry:
199+
%0 = call token @llvm.experimental.convergence.entry()
200+
%call1 = call spir_func noundef i32 @_Z7processv() #3 [ "convergencectrl"(token %0) ]
201+
ret void
202+
}
203+
204+
; Function Attrs: convergent norecurse
205+
define void @main.1() #2 {
206+
entry:
207+
call void @main()
208+
ret void
209+
}
210+
211+
attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
212+
attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }
213+
attributes #2 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
214+
attributes #3 = { convergent }
215+
216+
!llvm.module.flags = !{!0, !1, !2}
217+
218+
219+
!0 = !{i32 1, !"wchar_size", i32 4}
220+
!1 = !{i32 4, !"dx.disable_optimizations", i32 1}
221+
!2 = !{i32 7, !"frame-pointer", i32 2}
222+
223+

llvm/test/CodeGen/SPIRV/structurizer/cf.for.nested.hlsl

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)