blob: 0f6301cde2fe02f870abb8c1107b93695b9aa70f [file] [log] [blame]
Ryan Harrisondbc13af2022-02-21 15:19:07 +00001// Copyright 2020 The Tint Authors.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Ben Claytond368f2c2023-08-01 00:37:35 +000015#include "src/tint/lang/spirv/writer/ast_printer/helper_test.h"
Ben Claytonb0ea3682023-08-15 15:35:01 +000016#include "src/tint/lang/spirv/writer/common/spv_dump_test.h"
Ryan Harrisondbc13af2022-02-21 15:19:07 +000017
dan sinclairce6dffe2023-08-14 21:01:40 +000018using namespace tint::core::number_suffixes; // NOLINT
Ben Clayton0ce9ab02022-05-05 20:23:40 +000019
dan sinclair2dddb192023-07-26 20:31:48 +000020namespace tint::spirv::writer {
Ryan Harrisondbc13af2022-02-21 15:19:07 +000021namespace {
22
dan sinclair2dddb192023-07-26 20:31:48 +000023using SpirvASTPrinterTest = TestHelper;
Ryan Harrisondbc13af2022-02-21 15:19:07 +000024
dan sinclair2dddb192023-07-26 20:31:48 +000025TEST_F(SpirvASTPrinterTest, Loop_Empty) {
dan sinclair41e4d9a2022-05-01 14:40:55 +000026 // loop {
27 // break;
28 // }
Ryan Harrisondbc13af2022-02-21 15:19:07 +000029
dan sinclair41e4d9a2022-05-01 14:40:55 +000030 auto* loop = Loop(Block(Break()), Block());
31 WrapInFunction(loop);
Ryan Harrisondbc13af2022-02-21 15:19:07 +000032
dan sinclair2dddb192023-07-26 20:31:48 +000033 Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +000034
James Pricef885a902023-05-03 22:54:15 +000035 b.PushFunctionForTesting();
Ryan Harrisondbc13af2022-02-21 15:19:07 +000036
James Price057b7f32023-05-03 23:25:01 +000037 EXPECT_TRUE(b.GenerateLoopStatement(loop)) << b.Diagnostics();
James Pricef885a902023-05-03 22:54:15 +000038 EXPECT_EQ(DumpInstructions(b.CurrentFunction().instructions()),
dan sinclair41e4d9a2022-05-01 14:40:55 +000039 R"(OpBranch %1
Ryan Harrisondbc13af2022-02-21 15:19:07 +000040%1 = OpLabel
41OpLoopMerge %2 %3 None
42OpBranch %4
43%4 = OpLabel
44OpBranch %2
45%3 = OpLabel
46OpBranch %1
47%2 = OpLabel
48)");
49}
50
dan sinclair2dddb192023-07-26 20:31:48 +000051TEST_F(SpirvASTPrinterTest, Loop_WithoutContinuing) {
dan sinclair41e4d9a2022-05-01 14:40:55 +000052 // loop {
Ben Clayton0ce9ab02022-05-05 20:23:40 +000053 // v = 2i;
dan sinclair41e4d9a2022-05-01 14:40:55 +000054 // break;
55 // }
Ryan Harrisondbc13af2022-02-21 15:19:07 +000056
Ben Claytoncd52f382023-08-07 13:11:08 +000057 auto* var = GlobalVar("v", ty.i32(), core::AddressSpace::kPrivate);
Ben Clayton0ce9ab02022-05-05 20:23:40 +000058 auto* body = Block(Assign("v", 2_i), //
dan sinclair41e4d9a2022-05-01 14:40:55 +000059 Break());
Ryan Harrisondbc13af2022-02-21 15:19:07 +000060
dan sinclair41e4d9a2022-05-01 14:40:55 +000061 auto* loop = Loop(body, Block());
62 WrapInFunction(loop);
Ryan Harrisondbc13af2022-02-21 15:19:07 +000063
dan sinclair2dddb192023-07-26 20:31:48 +000064 Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +000065
James Pricef885a902023-05-03 22:54:15 +000066 b.PushFunctionForTesting();
James Price057b7f32023-05-03 23:25:01 +000067 ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.Diagnostics();
Ryan Harrisondbc13af2022-02-21 15:19:07 +000068
James Price057b7f32023-05-03 23:25:01 +000069 EXPECT_TRUE(b.GenerateLoopStatement(loop)) << b.Diagnostics();
James Pricef885a902023-05-03 22:54:15 +000070 EXPECT_EQ(DumpInstructions(b.Module().Types()), R"(%3 = OpTypeInt 32 1
Ryan Harrisondbc13af2022-02-21 15:19:07 +000071%2 = OpTypePointer Private %3
72%4 = OpConstantNull %3
73%1 = OpVariable %2 Private %4
74%9 = OpConstant %3 2
75)");
James Pricef885a902023-05-03 22:54:15 +000076 EXPECT_EQ(DumpInstructions(b.CurrentFunction().instructions()),
dan sinclair41e4d9a2022-05-01 14:40:55 +000077 R"(OpBranch %5
Ryan Harrisondbc13af2022-02-21 15:19:07 +000078%5 = OpLabel
79OpLoopMerge %6 %7 None
80OpBranch %8
81%8 = OpLabel
82OpStore %1 %9
83OpBranch %6
84%7 = OpLabel
85OpBranch %5
86%6 = OpLabel
87)");
88}
89
dan sinclair2dddb192023-07-26 20:31:48 +000090TEST_F(SpirvASTPrinterTest, Loop_WithContinuing) {
dan sinclair41e4d9a2022-05-01 14:40:55 +000091 // loop {
Ben Clayton0ce9ab02022-05-05 20:23:40 +000092 // a = 2i;
dan sinclair41e4d9a2022-05-01 14:40:55 +000093 // break;
94 // continuing {
Ben Clayton0ce9ab02022-05-05 20:23:40 +000095 // a = 3i;
dan sinclair41e4d9a2022-05-01 14:40:55 +000096 // }
97 // }
Ryan Harrisondbc13af2022-02-21 15:19:07 +000098
Ben Claytoncd52f382023-08-07 13:11:08 +000099 auto* var = GlobalVar("v", ty.i32(), core::AddressSpace::kPrivate);
Ben Clayton0ce9ab02022-05-05 20:23:40 +0000100 auto* body = Block(Assign("v", 2_i), //
dan sinclair41e4d9a2022-05-01 14:40:55 +0000101 Break());
Ben Clayton0ce9ab02022-05-05 20:23:40 +0000102 auto* continuing = Block(Assign("v", 3_i));
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000103
dan sinclair41e4d9a2022-05-01 14:40:55 +0000104 auto* loop = Loop(body, continuing);
105 WrapInFunction(loop);
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000106
dan sinclair2dddb192023-07-26 20:31:48 +0000107 Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000108
James Pricef885a902023-05-03 22:54:15 +0000109 b.PushFunctionForTesting();
James Price057b7f32023-05-03 23:25:01 +0000110 ASSERT_TRUE(b.GenerateGlobalVariable(var)) << b.Diagnostics();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000111
James Price057b7f32023-05-03 23:25:01 +0000112 EXPECT_TRUE(b.GenerateLoopStatement(loop)) << b.Diagnostics();
James Pricef885a902023-05-03 22:54:15 +0000113 EXPECT_EQ(DumpInstructions(b.Module().Types()), R"(%3 = OpTypeInt 32 1
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000114%2 = OpTypePointer Private %3
115%4 = OpConstantNull %3
116%1 = OpVariable %2 Private %4
117%9 = OpConstant %3 2
118%10 = OpConstant %3 3
119)");
James Pricef885a902023-05-03 22:54:15 +0000120 EXPECT_EQ(DumpInstructions(b.CurrentFunction().instructions()),
dan sinclair41e4d9a2022-05-01 14:40:55 +0000121 R"(OpBranch %5
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000122%5 = OpLabel
123OpLoopMerge %6 %7 None
124OpBranch %8
125%8 = OpLabel
126OpStore %1 %9
127OpBranch %6
128%7 = OpLabel
129OpStore %1 %10
130OpBranch %5
131%6 = OpLabel
132)");
133}
134
dan sinclair2dddb192023-07-26 20:31:48 +0000135TEST_F(SpirvASTPrinterTest, Loop_WithBodyVariableAccessInContinuing) {
dan sinclair41e4d9a2022-05-01 14:40:55 +0000136 // loop {
137 // var a : i32;
138 // break;
139 // continuing {
Ben Clayton0ce9ab02022-05-05 20:23:40 +0000140 // a = 3i;
dan sinclair41e4d9a2022-05-01 14:40:55 +0000141 // }
142 // }
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000143
dan sinclair41e4d9a2022-05-01 14:40:55 +0000144 auto* body = Block(Decl(Var("a", ty.i32())), //
145 Break());
Ben Clayton0ce9ab02022-05-05 20:23:40 +0000146 auto* continuing = Block(Assign("a", 3_i));
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000147
dan sinclair41e4d9a2022-05-01 14:40:55 +0000148 auto* loop = Loop(body, continuing);
149 WrapInFunction(loop);
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000150
dan sinclair2dddb192023-07-26 20:31:48 +0000151 Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000152
James Pricef885a902023-05-03 22:54:15 +0000153 b.PushFunctionForTesting();
James Price057b7f32023-05-03 23:25:01 +0000154 EXPECT_TRUE(b.GenerateLoopStatement(loop)) << b.Diagnostics();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000155
James Pricef885a902023-05-03 22:54:15 +0000156 EXPECT_EQ(DumpInstructions(b.Module().Types()), R"(%7 = OpTypeInt 32 1
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000157%6 = OpTypePointer Function %7
158%8 = OpConstantNull %7
159%9 = OpConstant %7 3
160)");
James Pricef885a902023-05-03 22:54:15 +0000161 EXPECT_EQ(DumpInstructions(b.CurrentFunction().instructions()),
dan sinclair41e4d9a2022-05-01 14:40:55 +0000162 R"(OpBranch %1
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000163%1 = OpLabel
164OpLoopMerge %2 %3 None
165OpBranch %4
166%4 = OpLabel
167OpBranch %2
168%3 = OpLabel
169OpStore %5 %9
170OpBranch %1
171%2 = OpLabel
172)");
173}
174
dan sinclair2dddb192023-07-26 20:31:48 +0000175TEST_F(SpirvASTPrinterTest, Loop_WithContinue) {
dan sinclair41e4d9a2022-05-01 14:40:55 +0000176 // loop {
177 // if (false) { break; }
178 // continue;
179 // }
180 auto* body = Block(If(false, Block(Break())), //
181 Continue());
182 auto* loop = Loop(body, Block());
183 WrapInFunction(loop);
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000184
dan sinclair2dddb192023-07-26 20:31:48 +0000185 Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000186
James Pricef885a902023-05-03 22:54:15 +0000187 b.PushFunctionForTesting();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000188
James Price057b7f32023-05-03 23:25:01 +0000189 EXPECT_TRUE(b.GenerateLoopStatement(loop)) << b.Diagnostics();
James Pricef885a902023-05-03 22:54:15 +0000190 EXPECT_EQ(DumpInstructions(b.CurrentFunction().instructions()),
dan sinclair41e4d9a2022-05-01 14:40:55 +0000191 R"(OpBranch %1
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000192%1 = OpLabel
193OpLoopMerge %2 %3 None
194OpBranch %4
195%4 = OpLabel
196OpSelectionMerge %7 None
197OpBranchConditional %6 %8 %7
198%8 = OpLabel
199OpBranch %2
200%7 = OpLabel
201OpBranch %3
202%3 = OpLabel
203OpBranch %1
204%2 = OpLabel
205)");
206}
207
dan sinclair2dddb192023-07-26 20:31:48 +0000208TEST_F(SpirvASTPrinterTest, Loop_WithBreak) {
dan sinclair41e4d9a2022-05-01 14:40:55 +0000209 // loop {
210 // break;
211 // }
212 auto* body = Block(create<ast::BreakStatement>());
213 auto* loop = Loop(body, Block());
214 WrapInFunction(loop);
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000215
dan sinclair2dddb192023-07-26 20:31:48 +0000216 Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000217
James Pricef885a902023-05-03 22:54:15 +0000218 b.PushFunctionForTesting();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000219
James Price057b7f32023-05-03 23:25:01 +0000220 EXPECT_TRUE(b.GenerateLoopStatement(loop)) << b.Diagnostics();
James Pricef885a902023-05-03 22:54:15 +0000221 EXPECT_EQ(DumpInstructions(b.CurrentFunction().instructions()),
dan sinclair41e4d9a2022-05-01 14:40:55 +0000222 R"(OpBranch %1
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000223%1 = OpLabel
224OpLoopMerge %2 %3 None
225OpBranch %4
226%4 = OpLabel
227OpBranch %2
228%3 = OpLabel
229OpBranch %1
230%2 = OpLabel
231)");
232}
233
dan sinclair2dddb192023-07-26 20:31:48 +0000234TEST_F(SpirvASTPrinterTest, Loop_WithContinuing_BreakIf) {
dan sinclair41e4d9a2022-05-01 14:40:55 +0000235 // loop {
236 // continuing {
dan sinclairb8b0c212022-10-20 22:45:50 +0000237 // break if (true);
dan sinclair41e4d9a2022-05-01 14:40:55 +0000238 // }
239 // }
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000240
dan sinclairb8b0c212022-10-20 22:45:50 +0000241 auto* continuing = Block(BreakIf(true));
dan sinclair41e4d9a2022-05-01 14:40:55 +0000242 auto* loop = Loop(Block(), continuing);
243 WrapInFunction(loop);
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000244
dan sinclair2dddb192023-07-26 20:31:48 +0000245 Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000246
James Pricef885a902023-05-03 22:54:15 +0000247 b.PushFunctionForTesting();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000248
James Price057b7f32023-05-03 23:25:01 +0000249 EXPECT_TRUE(b.GenerateLoopStatement(loop)) << b.Diagnostics();
James Pricef885a902023-05-03 22:54:15 +0000250 EXPECT_EQ(DumpInstructions(b.Module().Types()), R"(%5 = OpTypeBool
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000251%6 = OpConstantTrue %5
252)");
James Pricef885a902023-05-03 22:54:15 +0000253 EXPECT_EQ(DumpInstructions(b.CurrentFunction().instructions()),
dan sinclair41e4d9a2022-05-01 14:40:55 +0000254 R"(OpBranch %1
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000255%1 = OpLabel
256OpLoopMerge %2 %3 None
257OpBranch %4
258%4 = OpLabel
259OpBranch %3
260%3 = OpLabel
261OpBranchConditional %6 %2 %1
262%2 = OpLabel
263)");
264}
265
dan sinclair2dddb192023-07-26 20:31:48 +0000266TEST_F(SpirvASTPrinterTest, Loop_WithContinuing_BreakUnless) {
dan sinclair41e4d9a2022-05-01 14:40:55 +0000267 // loop {
268 // continuing {
dan sinclairb8b0c212022-10-20 22:45:50 +0000269 // break if (false);
dan sinclair41e4d9a2022-05-01 14:40:55 +0000270 // }
271 // }
dan sinclairb8b0c212022-10-20 22:45:50 +0000272 auto* continuing = Block(BreakIf(false));
dan sinclair41e4d9a2022-05-01 14:40:55 +0000273 auto* loop = Loop(Block(), continuing);
274 WrapInFunction(loop);
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000275
dan sinclair2dddb192023-07-26 20:31:48 +0000276 Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000277
James Pricef885a902023-05-03 22:54:15 +0000278 b.PushFunctionForTesting();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000279
James Price057b7f32023-05-03 23:25:01 +0000280 EXPECT_TRUE(b.GenerateLoopStatement(loop)) << b.Diagnostics();
James Pricef885a902023-05-03 22:54:15 +0000281 EXPECT_EQ(DumpInstructions(b.Module().Types()), R"(%5 = OpTypeBool
dan sinclairb8b0c212022-10-20 22:45:50 +0000282%6 = OpConstantNull %5
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000283)");
James Pricef885a902023-05-03 22:54:15 +0000284 EXPECT_EQ(DumpInstructions(b.CurrentFunction().instructions()),
dan sinclair41e4d9a2022-05-01 14:40:55 +0000285 R"(OpBranch %1
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000286%1 = OpLabel
287OpLoopMerge %2 %3 None
288OpBranch %4
289%4 = OpLabel
290OpBranch %3
291%3 = OpLabel
dan sinclairb8b0c212022-10-20 22:45:50 +0000292OpBranchConditional %6 %2 %1
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000293%2 = OpLabel
294)");
295}
296
dan sinclair2dddb192023-07-26 20:31:48 +0000297TEST_F(SpirvASTPrinterTest, Loop_WithContinuing_BreakIf_ConditionIsVar) {
dan sinclair41e4d9a2022-05-01 14:40:55 +0000298 // loop {
299 // continuing {
300 // var cond = true;
dan sinclairb8b0c212022-10-20 22:45:50 +0000301 // break if (cond);
dan sinclair41e4d9a2022-05-01 14:40:55 +0000302 // }
303 // }
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000304
Ben Clayton58794ae2022-08-19 17:28:53 +0000305 auto* cond_var = Decl(Var("cond", Expr(true)));
dan sinclairb8b0c212022-10-20 22:45:50 +0000306 auto* continuing = Block(cond_var, BreakIf("cond"));
dan sinclair41e4d9a2022-05-01 14:40:55 +0000307 auto* loop = Loop(Block(), continuing);
308 WrapInFunction(loop);
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000309
dan sinclair2dddb192023-07-26 20:31:48 +0000310 Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000311
James Pricef885a902023-05-03 22:54:15 +0000312 b.PushFunctionForTesting();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000313
James Price057b7f32023-05-03 23:25:01 +0000314 EXPECT_TRUE(b.GenerateLoopStatement(loop)) << b.Diagnostics();
James Pricef885a902023-05-03 22:54:15 +0000315 EXPECT_EQ(DumpInstructions(b.Module().Types()), R"(%5 = OpTypeBool
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000316%6 = OpConstantTrue %5
317%8 = OpTypePointer Function %5
318%9 = OpConstantNull %5
319)");
James Pricef885a902023-05-03 22:54:15 +0000320 EXPECT_EQ(DumpInstructions(b.CurrentFunction().instructions()),
dan sinclair41e4d9a2022-05-01 14:40:55 +0000321 R"(OpBranch %1
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000322%1 = OpLabel
323OpLoopMerge %2 %3 None
324OpBranch %4
325%4 = OpLabel
326OpBranch %3
327%3 = OpLabel
328OpStore %7 %6
329%10 = OpLoad %5 %7
330OpBranchConditional %10 %2 %1
331%2 = OpLabel
332)");
333}
334
dan sinclair2dddb192023-07-26 20:31:48 +0000335TEST_F(SpirvASTPrinterTest, Loop_WithContinuing_BreakIf_Nested) {
dan sinclair41e4d9a2022-05-01 14:40:55 +0000336 // Make sure the right backedge and break target are used.
337 // loop {
338 // continuing {
339 // loop {
340 // continuing {
dan sinclairb8b0c212022-10-20 22:45:50 +0000341 // break if (true);
dan sinclair41e4d9a2022-05-01 14:40:55 +0000342 // }
343 // }
dan sinclairb8b0c212022-10-20 22:45:50 +0000344 // break if (true);
dan sinclair41e4d9a2022-05-01 14:40:55 +0000345 // }
346 // }
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000347
dan sinclairb8b0c212022-10-20 22:45:50 +0000348 auto* inner_continuing = Block(BreakIf(true));
dan sinclair41e4d9a2022-05-01 14:40:55 +0000349 auto* inner_loop = Loop(Block(), inner_continuing);
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000350
dan sinclairb8b0c212022-10-20 22:45:50 +0000351 auto* outer_continuing = Block(inner_loop, BreakIf(true));
dan sinclair41e4d9a2022-05-01 14:40:55 +0000352 auto* outer_loop = Loop(Block(), outer_continuing);
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000353
dan sinclair41e4d9a2022-05-01 14:40:55 +0000354 WrapInFunction(outer_loop);
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000355
dan sinclair2dddb192023-07-26 20:31:48 +0000356 Builder& b = Build();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000357
James Pricef885a902023-05-03 22:54:15 +0000358 b.PushFunctionForTesting();
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000359
James Price057b7f32023-05-03 23:25:01 +0000360 EXPECT_TRUE(b.GenerateLoopStatement(outer_loop)) << b.Diagnostics();
James Pricef885a902023-05-03 22:54:15 +0000361 EXPECT_EQ(DumpInstructions(b.Module().Types()), R"(%9 = OpTypeBool
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000362%10 = OpConstantTrue %9
363)");
James Pricef885a902023-05-03 22:54:15 +0000364 EXPECT_EQ(DumpInstructions(b.CurrentFunction().instructions()),
dan sinclair41e4d9a2022-05-01 14:40:55 +0000365 R"(OpBranch %1
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000366%1 = OpLabel
367OpLoopMerge %2 %3 None
368OpBranch %4
369%4 = OpLabel
370OpBranch %3
371%3 = OpLabel
372OpBranch %5
373%5 = OpLabel
374OpLoopMerge %6 %7 None
375OpBranch %8
376%8 = OpLabel
377OpBranch %7
378%7 = OpLabel
379OpBranchConditional %10 %6 %5
380%6 = OpLabel
381OpBranchConditional %10 %2 %1
382%2 = OpLabel
383)");
384}
385
Ryan Harrisondbc13af2022-02-21 15:19:07 +0000386} // namespace
dan sinclair2dddb192023-07-26 20:31:48 +0000387} // namespace tint::spirv::writer