Import Tint changes from Dawn Changes: - 4fe7b1132a5249a6b0da48cfeeb9df5fa2b996e9 [ir] Make branch targets comments in disassembly by James Price <jrprice@google.com> - 7710e30ee0505d986b54c6f3d41a2f6d6c0bdcbc [ir] Change disassembled block names to $Bn by James Price <jrprice@google.com> - 10600c005fe72c2ebda8ec878f63884f213e5d40 [ir] Remove ` -> %b*` from function disassembly by James Price <jrprice@google.com> - 9fa001ed71737abb45cb74ca7d812c9bc9e1b754 [tint][fuzz][ast] Add MultiplanarExternalTexture fuzzer by Ben Clayton <bclayton@google.com> - 5ef0e21c245e5363a747dbceef3eb24de8d1e803 [tint][fuzz][ast] Add FoldConstants fuzzer by Ben Clayton <bclayton@google.com> - 6b4fab68c055edb9a9c20fd4d346b4a6690af377 [tint][fuzz][ast] Add FirstIndexOffset fuzzer by Ben Clayton <bclayton@google.com> - 976813e9896696961e217bc696724378a55b2627 [tint][fuzz][ast] Add ExpandCompoundAssignment fuzzer by Ben Clayton <bclayton@google.com> - 5b77af631846626212bb4363c89e4f18fba0ce34 [tint][fuzz][ast] Add DisableUniformityAnalysis fuzzer by Ben Clayton <bclayton@google.com> - 605f924fef3288c20aac11cfce88e26e398ceeb6 [tint][fuzz] Add basic base-64 comments to dictionary.txt by Ben Clayton <bclayton@google.com> - 752629f817e9891be7a86af43758b49a58d4e606 [tint][fuzz][ast] Add DirectVariableAccess fuzzer by Ben Clayton <bclayton@google.com> - 32715b7f43746fd3c5afc6af1ead1cbe3bf213ba [tint][fuzz][ast] Add DemoteToHelper fuzzer by Ben Clayton <bclayton@google.com> - a56b139b0097721e2427870c04b8b1b1cc074a1f [tint][fuzz][ast] Add ClampFragDepth fuzzer by Ben Clayton <bclayton@google.com> - 7320e43c215888610a197bce2ced7e344ff3f103 [tint][fuzz][ast] Add CanonicalizeEntryPointIO fuzzer by Ben Clayton <bclayton@google.com> - 8ec8ac6d714a121281269377247b1698770acd34 [tint][fuzz][ast] Add BuiltinPolyfill fuzzer by Ben Clayton <bclayton@google.com> - b3484ecaaa6df24b916c1c296ae3a65cf6a3a010 [tint][fuzz][ast] Add BindingRemapper fuzzer by Ben Clayton <bclayton@google.com> - 9904db03515a17ac833a86e61b82ed14fb9f9479 [tint][fuzz][glsl] Skip large depth_range_offsets by Ben Clayton <bclayton@google.com> GitOrigin-RevId: 4fe7b1132a5249a6b0da48cfeeb9df5fa2b996e9 Change-Id: I805af485f22b952cbd26d0eb3f57a1e9dddb2da6 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/185982 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com> Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/cmd/fuzz/wgsl/dictionary.txt b/src/tint/cmd/fuzz/wgsl/dictionary.txt index cc0d9d3..a8a1694 100644 --- a/src/tint/cmd/fuzz/wgsl/dictionary.txt +++ b/src/tint/cmd/fuzz/wgsl/dictionary.txt
@@ -55,6 +55,9 @@ "->" "." "/" +"// AAAA" +"// AAAB" +"// BAAA" "/=" ":" ";"
diff --git a/src/tint/cmd/fuzz/wgsl/dictionary.txt.tmpl b/src/tint/cmd/fuzz/wgsl/dictionary.txt.tmpl index 5ffad37..e5605d7 100644 --- a/src/tint/cmd/fuzz/wgsl/dictionary.txt.tmpl +++ b/src/tint/cmd/fuzz/wgsl/dictionary.txt.tmpl
@@ -17,7 +17,7 @@ {{- $tokens := List}} -{{- /* ============================== Operators ============================== */ -}} +{{- /* ========================= Operators & Keywords ======================== */ -}} {{- $tokens = Append $tokens "!" "!=" @@ -105,6 +105,13 @@ "true" "false" -}} +{{- /* =========================== Base64 comments =========================== */ -}} +{{- $tokens = Append $tokens + "// AAAA" + "// BAAA" + "// AAAB" +-}} + {{- /* ========================== Builtin functions ========================== */ -}} {{- range $W.Sem.Builtins}}{{$tokens = Append $tokens .Name}}{{end -}}
diff --git a/src/tint/lang/core/ir/disassembler.cc b/src/tint/lang/core/ir/disassembler.cc index 281cb61..c31cad8 100644 --- a/src/tint/lang/core/ir/disassembler.cc +++ b/src/tint/lang/core/ir/disassembler.cc
@@ -184,7 +184,7 @@ Indent(); SourceMarker sm(this); - out_ << "%b" << IdOf(blk) << " = block"; + out_ << "$B" << IdOf(blk); if (auto* merge = blk->As<MultiInBlock>()) { if (!merge->Params().IsEmpty()) { out_ << " ("; @@ -201,7 +201,7 @@ } sm.Store(blk); - out_ << " {"; + out_ << ": {"; if (!comment.empty()) { out_ << " # " << comment; } @@ -340,7 +340,7 @@ EmitReturnAttributes(func); - out_ << " -> %b" << IdOf(func->Block()) << " {"; + out_ << " {"; { // Add a comment if the function IDs or parameter IDs doesn't match their name Vector<std::string, 4> names; @@ -621,9 +621,9 @@ bool has_false = !if_->False()->IsEmpty(); - out_ << " [t: %b" << IdOf(if_->True()); + out_ << " [t: $B" << IdOf(if_->True()); if (has_false) { - out_ << ", f: %b" << IdOf(if_->False()); + out_ << ", f: $B" << IdOf(if_->False()); } out_ << "]"; sm.Store(if_); @@ -657,12 +657,12 @@ void Disassembler::EmitLoop(const Loop* l) { Vector<std::string, 3> parts; if (!l->Initializer()->IsEmpty()) { - parts.Push("i: %b" + std::to_string(IdOf(l->Initializer()))); + parts.Push("i: $B" + std::to_string(IdOf(l->Initializer()))); } - parts.Push("b: %b" + std::to_string(IdOf(l->Body()))); + parts.Push("b: $B" + std::to_string(IdOf(l->Body()))); if (!l->Continuing()->IsEmpty()) { - parts.Push("c: %b" + std::to_string(IdOf(l->Continuing()))); + parts.Push("c: $B" + std::to_string(IdOf(l->Continuing()))); } SourceMarker sm(this); if (auto results = l->Results(); !results.IsEmpty()) { @@ -734,7 +734,7 @@ EmitValue(selector.val); } } - out_ << ", %b" << IdOf(c.block) << ")"; + out_ << ", $B" << IdOf(c.block) << ")"; } out_ << "]"; sm.Store(s); @@ -760,8 +760,8 @@ out_ << "ret"; args_offset = ir::Return::kArgsOperandOffset; }, - [&](const ir::Continue* cont) { - out_ << "continue %b" << IdOf(cont->Loop()->Continuing()); + [&](const ir::Continue*) { + out_ << "continue"; args_offset = ir::Continue::kArgsOperandOffset; }, [&](const ir::ExitIf*) { @@ -776,15 +776,14 @@ out_ << "exit_loop"; args_offset = ir::ExitLoop::kArgsOperandOffset; }, - [&](const ir::NextIteration* ni) { - out_ << "next_iteration %b" << IdOf(ni->Loop()->Body()); + [&](const ir::NextIteration*) { + out_ << "next_iteration"; args_offset = ir::NextIteration::kArgsOperandOffset; }, [&](const ir::Unreachable*) { out_ << "unreachable"; }, [&](const ir::BreakIf* bi) { out_ << "break_if "; EmitValue(bi->Condition()); - out_ << " %b" << IdOf(bi->Loop()->Body()); args_offset = ir::BreakIf::kArgsOperandOffset; }, [&](const ir::TerminateInvocation*) { out_ << "terminate_invocation"; }, @@ -797,10 +796,16 @@ sm.Store(b); tint::Switch( - b, // - [&](const ir::ExitIf* e) { out_ << " # " << NameOf(e->If()); }, // - [&](const ir::ExitSwitch* e) { out_ << " # " << NameOf(e->Switch()); }, // - [&](const ir::ExitLoop* e) { out_ << " # " << NameOf(e->Loop()); } // + b, // + [&](const ir::BreakIf* bi) { + out_ << " # -> [t: exit_loop " << NameOf(bi->Loop()) << ", f: $B" + << IdOf(bi->Loop()->Body()) << "]"; + }, // + [&](const ir::Continue* c) { out_ << " # -> $B" << IdOf(c->Loop()->Continuing()); }, // + [&](const ir::ExitIf* e) { out_ << " # " << NameOf(e->If()); }, // + [&](const ir::ExitSwitch* e) { out_ << " # " << NameOf(e->Switch()); }, // + [&](const ir::ExitLoop* e) { out_ << " # " << NameOf(e->Loop()); }, // + [&](const ir::NextIteration* ni) { out_ << " # -> $B" << IdOf(ni->Loop()->Body()); } // ); }
diff --git a/src/tint/lang/core/ir/transform/add_empty_entry_point_test.cc b/src/tint/lang/core/ir/transform/add_empty_entry_point_test.cc index 541b68e..6a449d7 100644 --- a/src/tint/lang/core/ir/transform/add_empty_entry_point_test.cc +++ b/src/tint/lang/core/ir/transform/add_empty_entry_point_test.cc
@@ -38,8 +38,8 @@ TEST_F(IR_AddEmptyEntryPointTest, EmptyModule) { auto* expect = R"( -%unused_entry_point = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%unused_entry_point = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { ret } } @@ -55,8 +55,8 @@ ep->Block()->Append(b.Return(ep)); auto* expect = R"( -%main = @fragment func():void -> %b1 { - %b1 = block { +%main = @fragment func():void { + $B1: { ret } }
diff --git a/src/tint/lang/core/ir/transform/bgra8unorm_polyfill_test.cc b/src/tint/lang/core/ir/transform/bgra8unorm_polyfill_test.cc index 7028d4e..1e4b39e 100644 --- a/src/tint/lang/core/ir/transform/bgra8unorm_polyfill_test.cc +++ b/src/tint/lang/core/ir/transform/bgra8unorm_polyfill_test.cc
@@ -45,8 +45,8 @@ func->Block()->Append(b.Return(func)); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { ret } } @@ -78,12 +78,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<rgba8unorm, write>, read> = var @binding_point(1, 2) } -%foo = func(%value:vec4<f32>, %coords:vec2<u32>):void -> %b2 { - %b2 = block { +%foo = func(%value:vec4<f32>, %coords:vec2<u32>):void { + $B2: { %5:texture_storage_2d<rgba8unorm, write> = load %texture %6:void = textureStore %5, %coords, %value ret @@ -115,8 +115,8 @@ }); auto* src = R"( -%foo = func(%texture:texture_storage_2d<rgba8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void -> %b1 { - %b1 = block { +%foo = func(%texture:texture_storage_2d<rgba8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void { + $B1: { %5:void = textureStore %texture, %coords, %value ret } @@ -151,12 +151,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<bgra8unorm, write>, read> = var @binding_point(1, 2) } -%foo = func(%value:vec4<f32>, %coords:vec2<u32>):void -> %b2 { - %b2 = block { +%foo = func(%value:vec4<f32>, %coords:vec2<u32>):void { + $B2: { %5:texture_storage_2d<bgra8unorm, write> = load %texture %6:void = textureStore %5, %coords, %value ret @@ -164,12 +164,12 @@ } )"; auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<rgba8unorm, write>, read> = var @binding_point(1, 2) } -%foo = func(%value:vec4<f32>, %coords:vec2<u32>):void -> %b2 { - %b2 = block { +%foo = func(%value:vec4<f32>, %coords:vec2<u32>):void { + $B2: { %5:texture_storage_2d<rgba8unorm, write> = load %texture %6:vec4<f32> = swizzle %value, zyxw %7:void = textureStore %5, %coords, %6 @@ -201,16 +201,16 @@ }); auto* src = R"( -%foo = func(%texture:texture_storage_2d<bgra8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void -> %b1 { - %b1 = block { +%foo = func(%texture:texture_storage_2d<bgra8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void { + $B1: { %5:void = textureStore %texture, %coords, %value ret } } )"; auto* expect = R"( -%foo = func(%texture:texture_storage_2d<rgba8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void -> %b1 { - %b1 = block { +%foo = func(%texture:texture_storage_2d<rgba8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void { + $B1: { %5:vec4<f32> = swizzle %value, zyxw %6:void = textureStore %texture, %coords, %5 ret @@ -259,18 +259,18 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<bgra8unorm, write>, read> = var @binding_point(1, 2) } -%bar = func(%texture_1:texture_storage_2d<bgra8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void -> %b2 { # %texture_1: 'texture' - %b2 = block { +%bar = func(%texture_1:texture_storage_2d<bgra8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void { # %texture_1: 'texture' + $B2: { %6:void = textureStore %texture_1, %coords, %value ret } } -%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %10:texture_storage_2d<bgra8unorm, write> = load %texture %11:void = call %bar, %10, %coords_1, %value_1 ret @@ -278,19 +278,19 @@ } )"; auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<rgba8unorm, write>, read> = var @binding_point(1, 2) } -%bar = func(%texture_1:texture_storage_2d<rgba8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void -> %b2 { # %texture_1: 'texture' - %b2 = block { +%bar = func(%texture_1:texture_storage_2d<rgba8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void { # %texture_1: 'texture' + $B2: { %6:vec4<f32> = swizzle %value, zyxw %7:void = textureStore %texture_1, %coords, %6 ret } } -%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %11:texture_storage_2d<rgba8unorm, write> = load %texture %12:void = call %bar, %11, %coords_1, %value_1 ret @@ -351,22 +351,22 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture_a:ptr<handle, texture_storage_2d<bgra8unorm, write>, read> = var @binding_point(1, 2) %texture_b:ptr<handle, texture_storage_2d<bgra8unorm, write>, read> = var @binding_point(1, 3) %texture_c:ptr<handle, texture_storage_2d<bgra8unorm, write>, read> = var @binding_point(1, 4) } -%bar = func(%texture_a_1:texture_storage_2d<bgra8unorm, write>, %texture_b_1:texture_storage_2d<bgra8unorm, write>, %texture_b_2:texture_storage_2d<bgra8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void -> %b2 { # %texture_a_1: 'texture_a', %texture_b_1: 'texture_b', %texture_b_2: 'texture_b' - %b2 = block { +%bar = func(%texture_a_1:texture_storage_2d<bgra8unorm, write>, %texture_b_1:texture_storage_2d<bgra8unorm, write>, %texture_b_2:texture_storage_2d<bgra8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void { # %texture_a_1: 'texture_a', %texture_b_1: 'texture_b', %texture_b_2: 'texture_b' + $B2: { %10:void = textureStore %texture_a_1, %coords, %value %11:void = textureStore %texture_b_1, %coords, %value %12:void = textureStore %texture_b_2, %coords, %value ret } } -%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %16:texture_storage_2d<bgra8unorm, write> = load %texture_a %17:texture_storage_2d<bgra8unorm, write> = load %texture_b %18:texture_storage_2d<bgra8unorm, write> = load %texture_c @@ -376,14 +376,14 @@ } )"; auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture_a:ptr<handle, texture_storage_2d<rgba8unorm, write>, read> = var @binding_point(1, 2) %texture_b:ptr<handle, texture_storage_2d<rgba8unorm, write>, read> = var @binding_point(1, 3) %texture_c:ptr<handle, texture_storage_2d<rgba8unorm, write>, read> = var @binding_point(1, 4) } -%bar = func(%texture_a_1:texture_storage_2d<rgba8unorm, write>, %texture_b_1:texture_storage_2d<rgba8unorm, write>, %texture_b_2:texture_storage_2d<rgba8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void -> %b2 { # %texture_a_1: 'texture_a', %texture_b_1: 'texture_b', %texture_b_2: 'texture_b' - %b2 = block { +%bar = func(%texture_a_1:texture_storage_2d<rgba8unorm, write>, %texture_b_1:texture_storage_2d<rgba8unorm, write>, %texture_b_2:texture_storage_2d<rgba8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void { # %texture_a_1: 'texture_a', %texture_b_1: 'texture_b', %texture_b_2: 'texture_b' + $B2: { %10:vec4<f32> = swizzle %value, zyxw %11:void = textureStore %texture_a_1, %coords, %10 %12:vec4<f32> = swizzle %value, zyxw @@ -393,8 +393,8 @@ ret } } -%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %19:texture_storage_2d<rgba8unorm, write> = load %texture_a %20:texture_storage_2d<rgba8unorm, write> = load %texture_b %21:texture_storage_2d<rgba8unorm, write> = load %texture_c @@ -451,20 +451,20 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<bgra8unorm, write>, read> = var @binding_point(1, 2) } -%bar = func(%texture_1:texture_storage_2d<bgra8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void -> %b2 { # %texture_1: 'texture' - %b2 = block { +%bar = func(%texture_1:texture_storage_2d<bgra8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void { # %texture_1: 'texture' + $B2: { %6:void = textureStore %texture_1, %coords, %value %7:void = textureStore %texture_1, %coords, %value %8:void = textureStore %texture_1, %coords, %value ret } } -%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %12:texture_storage_2d<bgra8unorm, write> = load %texture %13:void = textureStore %12, %coords_1, %value_1 %14:texture_storage_2d<bgra8unorm, write> = load %texture @@ -476,12 +476,12 @@ } )"; auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<rgba8unorm, write>, read> = var @binding_point(1, 2) } -%bar = func(%texture_1:texture_storage_2d<rgba8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void -> %b2 { # %texture_1: 'texture' - %b2 = block { +%bar = func(%texture_1:texture_storage_2d<rgba8unorm, write>, %coords:vec2<u32>, %value:vec4<f32>):void { # %texture_1: 'texture' + $B2: { %6:vec4<f32> = swizzle %value, zyxw %7:void = textureStore %texture_1, %coords, %6 %8:vec4<f32> = swizzle %value, zyxw @@ -491,8 +491,8 @@ ret } } -%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%foo = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %15:texture_storage_2d<rgba8unorm, write> = load %texture %16:vec4<f32> = swizzle %value_1, zyxw %17:void = textureStore %15, %coords_1, %16 @@ -533,12 +533,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d_array<bgra8unorm, write>, read> = var @binding_point(1, 2) } -%foo = func(%value:vec4<f32>, %coords:vec2<u32>):void -> %b2 { - %b2 = block { +%foo = func(%value:vec4<f32>, %coords:vec2<u32>):void { + $B2: { %5:texture_storage_2d_array<bgra8unorm, write> = load %texture %6:void = textureStore %5, %coords, %index, %value ret @@ -546,12 +546,12 @@ } )"; auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d_array<rgba8unorm, write>, read> = var @binding_point(1, 2) } -%foo = func(%value:vec4<f32>, %coords:vec2<u32>):void -> %b2 { - %b2 = block { +%foo = func(%value:vec4<f32>, %coords:vec2<u32>):void { + $B2: { %5:texture_storage_2d_array<rgba8unorm, write> = load %texture %6:vec4<f32> = swizzle %value, zyxw %7:void = textureStore %5, %coords, %index, %6 @@ -585,12 +585,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<bgra8unorm, write>, read> = var @binding_point(1, 2) } -%foo = func():vec2<u32> -> %b2 { - %b2 = block { +%foo = func():vec2<u32> { + $B2: { %3:texture_storage_2d<bgra8unorm, write> = load %texture %dims:vec2<u32> = textureDimensions %3 ret %dims @@ -598,12 +598,12 @@ } )"; auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<rgba8unorm, write>, read> = var @binding_point(1, 2) } -%foo = func():vec2<u32> -> %b2 { - %b2 = block { +%foo = func():vec2<u32> { + $B2: { %3:texture_storage_2d<rgba8unorm, write> = load %texture %dims:vec2<u32> = textureDimensions %3 ret %dims @@ -638,12 +638,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<bgra8unorm, read>, read> = var @binding_point(1, 2) } -%foo = func(%coords:vec2<u32>):vec4<f32> -> %b2 { - %b2 = block { +%foo = func(%coords:vec2<u32>):vec4<f32> { + $B2: { %4:texture_storage_2d<bgra8unorm, read> = load %texture %result:vec4<f32> = textureLoad %4, %coords ret %result @@ -651,12 +651,12 @@ } )"; auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<rgba8unorm, read>, read> = var @binding_point(1, 2) } -%foo = func(%coords:vec2<u32>):vec4<f32> -> %b2 { - %b2 = block { +%foo = func(%coords:vec2<u32>):vec4<f32> { + $B2: { %4:texture_storage_2d<rgba8unorm, read> = load %texture %result:vec4<f32> = textureLoad %4, %coords %6:vec4<f32> = swizzle %result, zyxw @@ -693,12 +693,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<bgra8unorm, read_write>, read> = var @binding_point(1, 2) } -%foo = func(%coords:vec2<u32>):void -> %b2 { - %b2 = block { +%foo = func(%coords:vec2<u32>):void { + $B2: { %4:texture_storage_2d<bgra8unorm, read_write> = load %texture %result:vec4<f32> = textureLoad %4, %coords %6:void = textureStore %4, %coords, %result @@ -707,12 +707,12 @@ } )"; auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<rgba8unorm, read_write>, read> = var @binding_point(1, 2) } -%foo = func(%coords:vec2<u32>):void -> %b2 { - %b2 = block { +%foo = func(%coords:vec2<u32>):void { + $B2: { %4:texture_storage_2d<rgba8unorm, read_write> = load %texture %result:vec4<f32> = textureLoad %4, %coords %6:vec4<f32> = swizzle %result, zyxw
diff --git a/src/tint/lang/core/ir/transform/binary_polyfill_test.cc b/src/tint/lang/core/ir/transform/binary_polyfill_test.cc index 314ac0c..1711351 100644 --- a/src/tint/lang/core/ir/transform/binary_polyfill_test.cc +++ b/src/tint/lang/core/ir/transform/binary_polyfill_test.cc
@@ -65,8 +65,8 @@ TEST_F(IR_BinaryPolyfillTest, ShiftLeft_NoPolyfill) { Build(BinaryOp::kShiftLeft, ty.i32(), ty.i32(), ty.u32()); auto* src = R"( -%foo = func(%lhs:i32, %rhs:u32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:u32):i32 { + $B1: { %result:i32 = shl %lhs, %rhs ret %result } @@ -85,8 +85,8 @@ TEST_F(IR_BinaryPolyfillTest, ShiftRight_NoPolyfill) { Build(BinaryOp::kShiftRight, ty.i32(), ty.i32(), ty.u32()); auto* src = R"( -%foo = func(%lhs:i32, %rhs:u32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:u32):i32 { + $B1: { %result:i32 = shr %lhs, %rhs ret %result } @@ -105,16 +105,16 @@ TEST_F(IR_BinaryPolyfillTest, ShiftLeft_I32) { Build(BinaryOp::kShiftLeft, ty.i32(), ty.i32(), ty.u32()); auto* src = R"( -%foo = func(%lhs:i32, %rhs:u32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:u32):i32 { + $B1: { %result:i32 = shl %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:i32, %rhs:u32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:u32):i32 { + $B1: { %4:u32 = and %rhs, 31u %result:i32 = shl %lhs, %4 ret %result @@ -133,16 +133,16 @@ TEST_F(IR_BinaryPolyfillTest, ShiftLeft_U32) { Build(BinaryOp::kShiftLeft, ty.u32(), ty.u32(), ty.u32()); auto* src = R"( -%foo = func(%lhs:u32, %rhs:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%lhs:u32, %rhs:u32):u32 { + $B1: { %result:u32 = shl %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:u32, %rhs:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%lhs:u32, %rhs:u32):u32 { + $B1: { %4:u32 = and %rhs, 31u %result:u32 = shl %lhs, %4 ret %result @@ -161,16 +161,16 @@ TEST_F(IR_BinaryPolyfillTest, ShiftLeft_Vec2I32) { Build(BinaryOp::kShiftLeft, ty.vec2<i32>(), ty.vec2<i32>(), ty.vec2<u32>()); auto* src = R"( -%foo = func(%lhs:vec2<i32>, %rhs:vec2<u32>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec2<i32>, %rhs:vec2<u32>):vec2<i32> { + $B1: { %result:vec2<i32> = shl %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:vec2<i32>, %rhs:vec2<u32>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec2<i32>, %rhs:vec2<u32>):vec2<i32> { + $B1: { %4:vec2<u32> = and %rhs, vec2<u32>(31u) %result:vec2<i32> = shl %lhs, %4 ret %result @@ -189,16 +189,16 @@ TEST_F(IR_BinaryPolyfillTest, ShiftLeft_Vec3U32) { Build(BinaryOp::kShiftLeft, ty.vec3<u32>(), ty.vec3<u32>(), ty.vec3<u32>()); auto* src = R"( -%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> { + $B1: { %result:vec3<u32> = shl %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> { + $B1: { %4:vec3<u32> = and %rhs, vec3<u32>(31u) %result:vec3<u32> = shl %lhs, %4 ret %result @@ -217,16 +217,16 @@ TEST_F(IR_BinaryPolyfillTest, ShiftRight_I32) { Build(BinaryOp::kShiftRight, ty.i32(), ty.i32(), ty.u32()); auto* src = R"( -%foo = func(%lhs:i32, %rhs:u32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:u32):i32 { + $B1: { %result:i32 = shr %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:i32, %rhs:u32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:u32):i32 { + $B1: { %4:u32 = and %rhs, 31u %result:i32 = shr %lhs, %4 ret %result @@ -245,16 +245,16 @@ TEST_F(IR_BinaryPolyfillTest, ShiftRight_U32) { Build(BinaryOp::kShiftRight, ty.u32(), ty.u32(), ty.u32()); auto* src = R"( -%foo = func(%lhs:u32, %rhs:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%lhs:u32, %rhs:u32):u32 { + $B1: { %result:u32 = shr %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:u32, %rhs:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%lhs:u32, %rhs:u32):u32 { + $B1: { %4:u32 = and %rhs, 31u %result:u32 = shr %lhs, %4 ret %result @@ -273,16 +273,16 @@ TEST_F(IR_BinaryPolyfillTest, ShiftRight_Vec2I32) { Build(BinaryOp::kShiftRight, ty.vec2<i32>(), ty.vec2<i32>(), ty.vec2<u32>()); auto* src = R"( -%foo = func(%lhs:vec2<i32>, %rhs:vec2<u32>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec2<i32>, %rhs:vec2<u32>):vec2<i32> { + $B1: { %result:vec2<i32> = shr %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:vec2<i32>, %rhs:vec2<u32>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec2<i32>, %rhs:vec2<u32>):vec2<i32> { + $B1: { %4:vec2<u32> = and %rhs, vec2<u32>(31u) %result:vec2<i32> = shr %lhs, %4 ret %result @@ -301,16 +301,16 @@ TEST_F(IR_BinaryPolyfillTest, ShiftRight_Vec3U32) { Build(BinaryOp::kShiftRight, ty.vec3<u32>(), ty.vec3<u32>(), ty.vec3<u32>()); auto* src = R"( -%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> { + $B1: { %result:vec3<u32> = shr %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> { + $B1: { %4:vec3<u32> = and %rhs, vec3<u32>(31u) %result:vec3<u32> = shr %lhs, %4 ret %result @@ -329,8 +329,8 @@ TEST_F(IR_BinaryPolyfillTest, Divide_NoPolyfill) { Build(BinaryOp::kDivide, ty.i32(), ty.i32(), ty.i32()); auto* src = R"( -%foo = func(%lhs:i32, %rhs:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:i32):i32 { + $B1: { %result:i32 = div %lhs, %rhs ret %result } @@ -349,8 +349,8 @@ TEST_F(IR_BinaryPolyfillTest, Modulo_NoPolyfill) { Build(BinaryOp::kModulo, ty.i32(), ty.i32(), ty.i32()); auto* src = R"( -%foo = func(%lhs:i32, %rhs:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:i32):i32 { + $B1: { %result:i32 = mod %lhs, %rhs ret %result } @@ -369,22 +369,22 @@ TEST_F(IR_BinaryPolyfillTest, Divide_I32) { Build(BinaryOp::kDivide, ty.i32(), ty.i32(), ty.i32()); auto* src = R"( -%foo = func(%lhs:i32, %rhs:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:i32):i32 { + $B1: { %result:i32 = div %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:i32, %rhs:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:i32):i32 { + $B1: { %result:i32 = call %tint_div_i32, %lhs, %rhs ret %result } } -%tint_div_i32 = func(%lhs_1:i32, %rhs_1:i32):i32 -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_div_i32 = func(%lhs_1:i32, %rhs_1:i32):i32 { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %8:bool = eq %rhs_1, 0i %9:bool = eq %lhs_1, -2147483648i %10:bool = eq %rhs_1, -1i @@ -408,22 +408,22 @@ TEST_F(IR_BinaryPolyfillTest, Divide_U32) { Build(BinaryOp::kDivide, ty.u32(), ty.u32(), ty.u32()); auto* src = R"( -%foo = func(%lhs:u32, %rhs:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%lhs:u32, %rhs:u32):u32 { + $B1: { %result:u32 = div %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:u32, %rhs:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%lhs:u32, %rhs:u32):u32 { + $B1: { %result:u32 = call %tint_div_u32, %lhs, %rhs ret %result } } -%tint_div_u32 = func(%lhs_1:u32, %rhs_1:u32):u32 -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_div_u32 = func(%lhs_1:u32, %rhs_1:u32):u32 { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %8:bool = eq %rhs_1, 0u %9:u32 = select %rhs_1, 1u, %8 %10:u32 = div %lhs_1, %9 @@ -443,22 +443,22 @@ TEST_F(IR_BinaryPolyfillTest, Divide_Vec2I32) { Build(BinaryOp::kDivide, ty.vec2<i32>(), ty.vec2<i32>(), ty.vec2<i32>()); auto* src = R"( -%foo = func(%lhs:vec2<i32>, %rhs:vec2<i32>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec2<i32>, %rhs:vec2<i32>):vec2<i32> { + $B1: { %result:vec2<i32> = div %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:vec2<i32>, %rhs:vec2<i32>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec2<i32>, %rhs:vec2<i32>):vec2<i32> { + $B1: { %result:vec2<i32> = call %tint_div_v2i32, %lhs, %rhs ret %result } } -%tint_div_v2i32 = func(%lhs_1:vec2<i32>, %rhs_1:vec2<i32>):vec2<i32> -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_div_v2i32 = func(%lhs_1:vec2<i32>, %rhs_1:vec2<i32>):vec2<i32> { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %8:vec2<bool> = eq %rhs_1, vec2<i32>(0i) %9:vec2<bool> = eq %lhs_1, vec2<i32>(-2147483648i) %10:vec2<bool> = eq %rhs_1, vec2<i32>(-1i) @@ -482,22 +482,22 @@ TEST_F(IR_BinaryPolyfillTest, Divide_Vec3U32) { Build(BinaryOp::kDivide, ty.vec3<u32>(), ty.vec3<u32>(), ty.vec3<u32>()); auto* src = R"( -%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> { + $B1: { %result:vec3<u32> = div %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> { + $B1: { %result:vec3<u32> = call %tint_div_v3u32, %lhs, %rhs ret %result } } -%tint_div_v3u32 = func(%lhs_1:vec3<u32>, %rhs_1:vec3<u32>):vec3<u32> -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_div_v3u32 = func(%lhs_1:vec3<u32>, %rhs_1:vec3<u32>):vec3<u32> { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %8:vec3<bool> = eq %rhs_1, vec3<u32>(0u) %9:vec3<u32> = select %rhs_1, vec3<u32>(1u), %8 %10:vec3<u32> = div %lhs_1, %9 @@ -517,22 +517,22 @@ TEST_F(IR_BinaryPolyfillTest, Modulo_I32) { Build(BinaryOp::kModulo, ty.i32(), ty.i32(), ty.i32()); auto* src = R"( -%foo = func(%lhs:i32, %rhs:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:i32):i32 { + $B1: { %result:i32 = mod %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:i32, %rhs:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:i32):i32 { + $B1: { %result:i32 = call %tint_mod_i32, %lhs, %rhs ret %result } } -%tint_mod_i32 = func(%lhs_1:i32, %rhs_1:i32):i32 -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_mod_i32 = func(%lhs_1:i32, %rhs_1:i32):i32 { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %8:bool = eq %rhs_1, 0i %9:bool = eq %lhs_1, -2147483648i %10:bool = eq %rhs_1, -1i @@ -558,22 +558,22 @@ TEST_F(IR_BinaryPolyfillTest, Modulo_U32) { Build(BinaryOp::kModulo, ty.u32(), ty.u32(), ty.u32()); auto* src = R"( -%foo = func(%lhs:u32, %rhs:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%lhs:u32, %rhs:u32):u32 { + $B1: { %result:u32 = mod %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:u32, %rhs:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%lhs:u32, %rhs:u32):u32 { + $B1: { %result:u32 = call %tint_mod_u32, %lhs, %rhs ret %result } } -%tint_mod_u32 = func(%lhs_1:u32, %rhs_1:u32):u32 -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_mod_u32 = func(%lhs_1:u32, %rhs_1:u32):u32 { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %8:bool = eq %rhs_1, 0u %9:u32 = select %rhs_1, 1u, %8 %10:u32 = div %lhs_1, %9 @@ -595,22 +595,22 @@ TEST_F(IR_BinaryPolyfillTest, Modulo_Vec2I32) { Build(BinaryOp::kModulo, ty.vec2<i32>(), ty.vec2<i32>(), ty.vec2<i32>()); auto* src = R"( -%foo = func(%lhs:vec2<i32>, %rhs:vec2<i32>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec2<i32>, %rhs:vec2<i32>):vec2<i32> { + $B1: { %result:vec2<i32> = mod %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:vec2<i32>, %rhs:vec2<i32>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec2<i32>, %rhs:vec2<i32>):vec2<i32> { + $B1: { %result:vec2<i32> = call %tint_mod_v2i32, %lhs, %rhs ret %result } } -%tint_mod_v2i32 = func(%lhs_1:vec2<i32>, %rhs_1:vec2<i32>):vec2<i32> -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_mod_v2i32 = func(%lhs_1:vec2<i32>, %rhs_1:vec2<i32>):vec2<i32> { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %8:vec2<bool> = eq %rhs_1, vec2<i32>(0i) %9:vec2<bool> = eq %lhs_1, vec2<i32>(-2147483648i) %10:vec2<bool> = eq %rhs_1, vec2<i32>(-1i) @@ -636,22 +636,22 @@ TEST_F(IR_BinaryPolyfillTest, Modulo_Vec3U32) { Build(BinaryOp::kModulo, ty.vec3<u32>(), ty.vec3<u32>(), ty.vec3<u32>()); auto* src = R"( -%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> { + $B1: { %result:vec3<u32> = mod %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec3<u32>, %rhs:vec3<u32>):vec3<u32> { + $B1: { %result:vec3<u32> = call %tint_mod_v3u32, %lhs, %rhs ret %result } } -%tint_mod_v3u32 = func(%lhs_1:vec3<u32>, %rhs_1:vec3<u32>):vec3<u32> -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_mod_v3u32 = func(%lhs_1:vec3<u32>, %rhs_1:vec3<u32>):vec3<u32> { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %8:vec3<bool> = eq %rhs_1, vec3<u32>(0u) %9:vec3<u32> = select %rhs_1, vec3<u32>(1u), %8 %10:vec3<u32> = div %lhs_1, %9 @@ -673,23 +673,23 @@ TEST_F(IR_BinaryPolyfillTest, Divide_Scalar_Vector) { Build(BinaryOp::kDivide, ty.vec4<i32>(), ty.i32(), ty.vec4<i32>()); auto* src = R"( -%foo = func(%lhs:i32, %rhs:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:vec4<i32>):vec4<i32> { + $B1: { %result:vec4<i32> = div %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:i32, %rhs:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:vec4<i32>):vec4<i32> { + $B1: { %4:vec4<i32> = construct %lhs %result:vec4<i32> = call %tint_div_v4i32, %4, %rhs ret %result } } -%tint_div_v4i32 = func(%lhs_1:vec4<i32>, %rhs_1:vec4<i32>):vec4<i32> -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_div_v4i32 = func(%lhs_1:vec4<i32>, %rhs_1:vec4<i32>):vec4<i32> { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %9:vec4<bool> = eq %rhs_1, vec4<i32>(0i) %10:vec4<bool> = eq %lhs_1, vec4<i32>(-2147483648i) %11:vec4<bool> = eq %rhs_1, vec4<i32>(-1i) @@ -713,23 +713,23 @@ TEST_F(IR_BinaryPolyfillTest, Divide_Vector_Scalar) { Build(BinaryOp::kDivide, ty.vec4<i32>(), ty.vec4<i32>(), ty.i32()); auto* src = R"( -%foo = func(%lhs:vec4<i32>, %rhs:i32):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec4<i32>, %rhs:i32):vec4<i32> { + $B1: { %result:vec4<i32> = div %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:vec4<i32>, %rhs:i32):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec4<i32>, %rhs:i32):vec4<i32> { + $B1: { %4:vec4<i32> = construct %rhs %result:vec4<i32> = call %tint_div_v4i32, %lhs, %4 ret %result } } -%tint_div_v4i32 = func(%lhs_1:vec4<i32>, %rhs_1:vec4<i32>):vec4<i32> -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_div_v4i32 = func(%lhs_1:vec4<i32>, %rhs_1:vec4<i32>):vec4<i32> { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %9:vec4<bool> = eq %rhs_1, vec4<i32>(0i) %10:vec4<bool> = eq %lhs_1, vec4<i32>(-2147483648i) %11:vec4<bool> = eq %rhs_1, vec4<i32>(-1i) @@ -753,23 +753,23 @@ TEST_F(IR_BinaryPolyfillTest, Modulo_Scalar_Vector) { Build(BinaryOp::kModulo, ty.vec4<i32>(), ty.i32(), ty.vec4<i32>()); auto* src = R"( -%foo = func(%lhs:i32, %rhs:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:vec4<i32>):vec4<i32> { + $B1: { %result:vec4<i32> = mod %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:i32, %rhs:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:i32, %rhs:vec4<i32>):vec4<i32> { + $B1: { %4:vec4<i32> = construct %lhs %result:vec4<i32> = call %tint_mod_v4i32, %4, %rhs ret %result } } -%tint_mod_v4i32 = func(%lhs_1:vec4<i32>, %rhs_1:vec4<i32>):vec4<i32> -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_mod_v4i32 = func(%lhs_1:vec4<i32>, %rhs_1:vec4<i32>):vec4<i32> { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %9:vec4<bool> = eq %rhs_1, vec4<i32>(0i) %10:vec4<bool> = eq %lhs_1, vec4<i32>(-2147483648i) %11:vec4<bool> = eq %rhs_1, vec4<i32>(-1i) @@ -795,23 +795,23 @@ TEST_F(IR_BinaryPolyfillTest, Modulo_Vector_Scalar) { Build(BinaryOp::kModulo, ty.vec4<i32>(), ty.vec4<i32>(), ty.i32()); auto* src = R"( -%foo = func(%lhs:vec4<i32>, %rhs:i32):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec4<i32>, %rhs:i32):vec4<i32> { + $B1: { %result:vec4<i32> = mod %lhs, %rhs ret %result } } )"; auto* expect = R"( -%foo = func(%lhs:vec4<i32>, %rhs:i32):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%lhs:vec4<i32>, %rhs:i32):vec4<i32> { + $B1: { %4:vec4<i32> = construct %rhs %result:vec4<i32> = call %tint_mod_v4i32, %lhs, %4 ret %result } } -%tint_mod_v4i32 = func(%lhs_1:vec4<i32>, %rhs_1:vec4<i32>):vec4<i32> -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%tint_mod_v4i32 = func(%lhs_1:vec4<i32>, %rhs_1:vec4<i32>):vec4<i32> { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %9:vec4<bool> = eq %rhs_1, vec4<i32>(0i) %10:vec4<bool> = eq %lhs_1, vec4<i32>(-2147483648i) %11:vec4<bool> = eq %rhs_1, vec4<i32>(-1i) @@ -893,8 +893,8 @@ } auto* src = R"( -%foo_i32 = func(%lhs:i32, %rhs:i32):void -> %b1 { - %b1 = block { +%foo_i32 = func(%lhs:i32, %rhs:i32):void { + $B1: { %4:i32 = div %lhs, %rhs %5:i32 = div %lhs, %rhs %6:i32 = mod %lhs, %rhs @@ -902,8 +902,8 @@ ret } } -%foo_u32 = func(%lhs_1:u32, %rhs_1:u32):void -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%foo_u32 = func(%lhs_1:u32, %rhs_1:u32):void { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %11:u32 = div %lhs_1, %rhs_1 %12:u32 = div %lhs_1, %rhs_1 %13:u32 = mod %lhs_1, %rhs_1 @@ -911,8 +911,8 @@ ret } } -%foo_vec4i = func(%lhs_2:vec4<i32>, %rhs_2:vec4<i32>):void -> %b3 { # %lhs_2: 'lhs', %rhs_2: 'rhs' - %b3 = block { +%foo_vec4i = func(%lhs_2:vec4<i32>, %rhs_2:vec4<i32>):void { # %lhs_2: 'lhs', %rhs_2: 'rhs' + $B3: { %18:vec4<i32> = div %lhs_2, %rhs_2 %19:vec4<i32> = div %lhs_2, %rhs_2 %20:vec4<i32> = mod %lhs_2, %rhs_2 @@ -920,8 +920,8 @@ ret } } -%foo_vec4u = func(%lhs_3:vec4<u32>, %rhs_3:vec4<u32>):void -> %b4 { # %lhs_3: 'lhs', %rhs_3: 'rhs' - %b4 = block { +%foo_vec4u = func(%lhs_3:vec4<u32>, %rhs_3:vec4<u32>):void { # %lhs_3: 'lhs', %rhs_3: 'rhs' + $B4: { %25:vec4<u32> = div %lhs_3, %rhs_3 %26:vec4<u32> = div %lhs_3, %rhs_3 %27:vec4<u32> = mod %lhs_3, %rhs_3 @@ -931,8 +931,8 @@ } )"; auto* expect = R"( -%foo_i32 = func(%lhs:i32, %rhs:i32):void -> %b1 { - %b1 = block { +%foo_i32 = func(%lhs:i32, %rhs:i32):void { + $B1: { %4:i32 = call %tint_div_i32, %lhs, %rhs %6:i32 = call %tint_div_i32, %lhs, %rhs %7:i32 = call %tint_mod_i32, %lhs, %rhs @@ -940,8 +940,8 @@ ret } } -%foo_u32 = func(%lhs_1:u32, %rhs_1:u32):void -> %b2 { # %lhs_1: 'lhs', %rhs_1: 'rhs' - %b2 = block { +%foo_u32 = func(%lhs_1:u32, %rhs_1:u32):void { # %lhs_1: 'lhs', %rhs_1: 'rhs' + $B2: { %13:u32 = call %tint_div_u32, %lhs_1, %rhs_1 %15:u32 = call %tint_div_u32, %lhs_1, %rhs_1 %16:u32 = call %tint_mod_u32, %lhs_1, %rhs_1 @@ -949,8 +949,8 @@ ret } } -%foo_vec4i = func(%lhs_2:vec4<i32>, %rhs_2:vec4<i32>):void -> %b3 { # %lhs_2: 'lhs', %rhs_2: 'rhs' - %b3 = block { +%foo_vec4i = func(%lhs_2:vec4<i32>, %rhs_2:vec4<i32>):void { # %lhs_2: 'lhs', %rhs_2: 'rhs' + $B3: { %22:vec4<i32> = call %tint_div_v4i32, %lhs_2, %rhs_2 %24:vec4<i32> = call %tint_div_v4i32, %lhs_2, %rhs_2 %25:vec4<i32> = call %tint_mod_v4i32, %lhs_2, %rhs_2 @@ -958,8 +958,8 @@ ret } } -%foo_vec4u = func(%lhs_3:vec4<u32>, %rhs_3:vec4<u32>):void -> %b4 { # %lhs_3: 'lhs', %rhs_3: 'rhs' - %b4 = block { +%foo_vec4u = func(%lhs_3:vec4<u32>, %rhs_3:vec4<u32>):void { # %lhs_3: 'lhs', %rhs_3: 'rhs' + $B4: { %31:vec4<u32> = call %tint_div_v4u32, %lhs_3, %rhs_3 %33:vec4<u32> = call %tint_div_v4u32, %lhs_3, %rhs_3 %34:vec4<u32> = call %tint_mod_v4u32, %lhs_3, %rhs_3 @@ -967,8 +967,8 @@ ret } } -%tint_div_i32 = func(%lhs_4:i32, %rhs_4:i32):i32 -> %b5 { # %lhs_4: 'lhs', %rhs_4: 'rhs' - %b5 = block { +%tint_div_i32 = func(%lhs_4:i32, %rhs_4:i32):i32 { # %lhs_4: 'lhs', %rhs_4: 'rhs' + $B5: { %39:bool = eq %rhs_4, 0i %40:bool = eq %lhs_4, -2147483648i %41:bool = eq %rhs_4, -1i @@ -979,8 +979,8 @@ ret %45 } } -%tint_mod_i32 = func(%lhs_5:i32, %rhs_5:i32):i32 -> %b6 { # %lhs_5: 'lhs', %rhs_5: 'rhs' - %b6 = block { +%tint_mod_i32 = func(%lhs_5:i32, %rhs_5:i32):i32 { # %lhs_5: 'lhs', %rhs_5: 'rhs' + $B6: { %48:bool = eq %rhs_5, 0i %49:bool = eq %lhs_5, -2147483648i %50:bool = eq %rhs_5, -1i @@ -993,16 +993,16 @@ ret %56 } } -%tint_div_u32 = func(%lhs_6:u32, %rhs_6:u32):u32 -> %b7 { # %lhs_6: 'lhs', %rhs_6: 'rhs' - %b7 = block { +%tint_div_u32 = func(%lhs_6:u32, %rhs_6:u32):u32 { # %lhs_6: 'lhs', %rhs_6: 'rhs' + $B7: { %59:bool = eq %rhs_6, 0u %60:u32 = select %rhs_6, 1u, %59 %61:u32 = div %lhs_6, %60 ret %61 } } -%tint_mod_u32 = func(%lhs_7:u32, %rhs_7:u32):u32 -> %b8 { # %lhs_7: 'lhs', %rhs_7: 'rhs' - %b8 = block { +%tint_mod_u32 = func(%lhs_7:u32, %rhs_7:u32):u32 { # %lhs_7: 'lhs', %rhs_7: 'rhs' + $B8: { %64:bool = eq %rhs_7, 0u %65:u32 = select %rhs_7, 1u, %64 %66:u32 = div %lhs_7, %65 @@ -1011,8 +1011,8 @@ ret %68 } } -%tint_div_v4i32 = func(%lhs_8:vec4<i32>, %rhs_8:vec4<i32>):vec4<i32> -> %b9 { # %lhs_8: 'lhs', %rhs_8: 'rhs' - %b9 = block { +%tint_div_v4i32 = func(%lhs_8:vec4<i32>, %rhs_8:vec4<i32>):vec4<i32> { # %lhs_8: 'lhs', %rhs_8: 'rhs' + $B9: { %71:vec4<bool> = eq %rhs_8, vec4<i32>(0i) %72:vec4<bool> = eq %lhs_8, vec4<i32>(-2147483648i) %73:vec4<bool> = eq %rhs_8, vec4<i32>(-1i) @@ -1023,8 +1023,8 @@ ret %77 } } -%tint_mod_v4i32 = func(%lhs_9:vec4<i32>, %rhs_9:vec4<i32>):vec4<i32> -> %b10 { # %lhs_9: 'lhs', %rhs_9: 'rhs' - %b10 = block { +%tint_mod_v4i32 = func(%lhs_9:vec4<i32>, %rhs_9:vec4<i32>):vec4<i32> { # %lhs_9: 'lhs', %rhs_9: 'rhs' + $B10: { %80:vec4<bool> = eq %rhs_9, vec4<i32>(0i) %81:vec4<bool> = eq %lhs_9, vec4<i32>(-2147483648i) %82:vec4<bool> = eq %rhs_9, vec4<i32>(-1i) @@ -1037,16 +1037,16 @@ ret %88 } } -%tint_div_v4u32 = func(%lhs_10:vec4<u32>, %rhs_10:vec4<u32>):vec4<u32> -> %b11 { # %lhs_10: 'lhs', %rhs_10: 'rhs' - %b11 = block { +%tint_div_v4u32 = func(%lhs_10:vec4<u32>, %rhs_10:vec4<u32>):vec4<u32> { # %lhs_10: 'lhs', %rhs_10: 'rhs' + $B11: { %91:vec4<bool> = eq %rhs_10, vec4<u32>(0u) %92:vec4<u32> = select %rhs_10, vec4<u32>(1u), %91 %93:vec4<u32> = div %lhs_10, %92 ret %93 } } -%tint_mod_v4u32 = func(%lhs_11:vec4<u32>, %rhs_11:vec4<u32>):vec4<u32> -> %b12 { # %lhs_11: 'lhs', %rhs_11: 'rhs' - %b12 = block { +%tint_mod_v4u32 = func(%lhs_11:vec4<u32>, %rhs_11:vec4<u32>):vec4<u32> { # %lhs_11: 'lhs', %rhs_11: 'rhs' + $B12: { %96:vec4<bool> = eq %rhs_11, vec4<u32>(0u) %97:vec4<u32> = select %rhs_11, vec4<u32>(1u), %96 %98:vec4<u32> = div %lhs_11, %97
diff --git a/src/tint/lang/core/ir/transform/binding_remapper_test.cc b/src/tint/lang/core/ir/transform/binding_remapper_test.cc index 11987b7..15eda22 100644 --- a/src/tint/lang/core/ir/transform/binding_remapper_test.cc +++ b/src/tint/lang/core/ir/transform/binding_remapper_test.cc
@@ -45,7 +45,7 @@ mod.root_block->Append(buffer); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, i32, read> = var @binding_point(0, 0) } @@ -66,7 +66,7 @@ mod.root_block->Append(buffer); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, i32, read> = var @binding_point(0, 0) } @@ -88,7 +88,7 @@ mod.root_block->Append(buffer); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, i32, read> = var @binding_point(1, 2) } @@ -96,7 +96,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, i32, read> = var @binding_point(3, 2) } @@ -115,7 +115,7 @@ mod.root_block->Append(buffer); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, i32, read> = var @binding_point(1, 2) } @@ -123,7 +123,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, i32, read> = var @binding_point(1, 3) } @@ -142,7 +142,7 @@ mod.root_block->Append(buffer); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, i32, read> = var @binding_point(1, 2) } @@ -150,7 +150,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, i32, read> = var @binding_point(3, 4) } @@ -172,7 +172,7 @@ mod.root_block->Append(buffer_b); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer_a:ptr<uniform, i32, read> = var @binding_point(1, 2) %buffer_b:ptr<uniform, i32, read> = var @binding_point(3, 4) } @@ -181,7 +181,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer_a:ptr<uniform, i32, read> = var @binding_point(3, 4) %buffer_b:ptr<uniform, i32, read> = var @binding_point(1, 2) } @@ -212,13 +212,13 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer_a:ptr<uniform, i32, read> = var @binding_point(1, 2) %buffer_b:ptr<uniform, i32, read> = var @binding_point(3, 4) } -%main = @fragment func():void -> %b2 { - %b2 = block { +%main = @fragment func():void { + $B2: { %4:i32 = load %buffer_a %5:i32 = load %buffer_b ret @@ -228,13 +228,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer_a:ptr<uniform, i32, read> = var @binding_point(0, 1) %buffer_b:ptr<uniform, i32, read> = var @binding_point(0, 1) } -%main = @fragment func():void -> %b2 { - %b2 = block { +%main = @fragment func():void { + $B2: { %4:i32 = load %buffer_a %5:i32 = load %buffer_b ret
diff --git a/src/tint/lang/core/ir/transform/block_decorated_structs_test.cc b/src/tint/lang/core/ir/transform/block_decorated_structs_test.cc index 714e39c..f85e4dd 100644 --- a/src/tint/lang/core/ir/transform/block_decorated_structs_test.cc +++ b/src/tint/lang/core/ir/transform/block_decorated_structs_test.cc
@@ -47,8 +47,8 @@ func->Block()->Append(b.Return(func)); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { ret } } @@ -75,12 +75,12 @@ tint_symbol:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<uniform, tint_symbol_1, read> = var @binding_point(0, 0) } -%foo = func():i32 -> %b2 { - %b2 = block { +%foo = func():i32 { + $B2: { %3:ptr<uniform, i32, read> = access %1, 0u %4:i32 = load %3 ret %4 @@ -107,12 +107,12 @@ tint_symbol:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, tint_symbol_1, read_write> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<storage, i32, read_write> = access %1, 0u store %3, 42i ret @@ -139,12 +139,12 @@ tint_symbol:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<push_constant, tint_symbol_1, read> = var } -%foo = func():i32 -> %b2 { - %b2 = block { +%foo = func():i32 { + $B2: { %3:ptr<push_constant, i32, read> = access %1, 0u %4:i32 = load %3 ret %4 @@ -175,12 +175,12 @@ tint_symbol:array<i32> @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, tint_symbol_1, read_write> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<storage, array<i32>, read_write> = access %1, 0u %4:ptr<storage, i32, read_write> = access %3, 1u store %4, 42i @@ -223,12 +223,12 @@ arr:array<i32> @offset(4) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, MyStruct, read_write> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<storage, i32, read_write> = access %1, 0u %4:i32 = load %3 %5:ptr<storage, i32, read_write> = access %1, 1u, 3u @@ -268,12 +268,12 @@ arr:array<i32> @offset(4) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, MyStruct, read_write> = var @binding_point(0, 0) } -%foo = func():u32 -> %b2 { - %b2 = block { +%foo = func():u32 { + $B2: { %root:ptr<storage, MyStruct, read_write> = let %1 %4:ptr<storage, array<i32>, read_write> = access %root, 1u %arr:ptr<storage, array<i32>, read_write> = let %4 @@ -316,13 +316,13 @@ tint_symbol:MyStruct @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, tint_symbol_1, read_write> = var @binding_point(0, 0) %2:ptr<private, MyStruct, read_write> = var } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %4:MyStruct = load %2 %5:ptr<storage, MyStruct, read_write> = access %1, 0u store %5, %4 @@ -369,14 +369,14 @@ tint_symbol_4:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, tint_symbol_1, read_write> = var @binding_point(0, 0) %2:ptr<storage, tint_symbol_3, read_write> = var @binding_point(0, 1) %3:ptr<storage, tint_symbol_5, read_write> = var @binding_point(0, 2) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %5:ptr<storage, i32, read_write> = access %2, 0u %6:i32 = load %5 %7:ptr<storage, i32, read_write> = access %3, 0u
diff --git a/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc b/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc index 6c6f910..0e1dd0a 100644 --- a/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc +++ b/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc
@@ -64,8 +64,8 @@ TEST_F(IR_BuiltinPolyfillTest, Saturate_NoPolyfill) { Build(core::BuiltinFn::kSaturate, ty.f32(), Vector{ty.f32()}); auto* src = R"( -%foo = func(%arg:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%arg:f32):f32 { + $B1: { %result:f32 = saturate %arg ret %result } @@ -84,16 +84,16 @@ TEST_F(IR_BuiltinPolyfillTest, Saturate_F32) { Build(core::BuiltinFn::kSaturate, ty.f32(), Vector{ty.f32()}); auto* src = R"( -%foo = func(%arg:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%arg:f32):f32 { + $B1: { %result:f32 = saturate %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%arg:f32):f32 { + $B1: { %result:f32 = clamp %arg, 0.0f, 1.0f ret %result } @@ -111,16 +111,16 @@ TEST_F(IR_BuiltinPolyfillTest, Saturate_F16) { Build(core::BuiltinFn::kSaturate, ty.f16(), Vector{ty.f16()}); auto* src = R"( -%foo = func(%arg:f16):f16 -> %b1 { - %b1 = block { +%foo = func(%arg:f16):f16 { + $B1: { %result:f16 = saturate %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:f16):f16 -> %b1 { - %b1 = block { +%foo = func(%arg:f16):f16 { + $B1: { %result:f16 = clamp %arg, 0.0h, 1.0h ret %result } @@ -137,16 +137,16 @@ TEST_F(IR_BuiltinPolyfillTest, Saturate_Vec2F32) { Build(core::BuiltinFn::kSaturate, ty.vec2<f32>(), Vector{ty.vec2<f32>()}); auto* src = R"( -%foo = func(%arg:vec2<f32>):vec2<f32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec2<f32>):vec2<f32> { + $B1: { %result:vec2<f32> = saturate %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec2<f32>):vec2<f32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec2<f32>):vec2<f32> { + $B1: { %result:vec2<f32> = clamp %arg, vec2<f32>(0.0f), vec2<f32>(1.0f) ret %result } @@ -164,16 +164,16 @@ TEST_F(IR_BuiltinPolyfillTest, Saturate_Vec4F16) { Build(core::BuiltinFn::kSaturate, ty.vec4<f16>(), Vector{ty.vec4<f16>()}); auto* src = R"( -%foo = func(%arg:vec4<f16>):vec4<f16> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<f16>):vec4<f16> { + $B1: { %result:vec4<f16> = saturate %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec4<f16>):vec4<f16> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<f16>):vec4<f16> { + $B1: { %result:vec4<f16> = clamp %arg, vec4<f16>(0.0h), vec4<f16>(1.0h) ret %result } @@ -191,8 +191,8 @@ TEST_F(IR_BuiltinPolyfillTest, CountLeadingZeros_NoPolyfill) { Build(core::BuiltinFn::kCountLeadingZeros, ty.u32(), Vector{ty.u32()}); auto* src = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %result:u32 = countLeadingZeros %arg ret %result } @@ -211,16 +211,16 @@ TEST_F(IR_BuiltinPolyfillTest, CountLeadingZeros_U32) { Build(core::BuiltinFn::kCountLeadingZeros, ty.u32(), Vector{ty.u32()}); auto* src = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %result:u32 = countLeadingZeros %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %3:bool = lte %arg, 65535u %4:u32 = select 0u, 16u, %3 %5:u32 = shl %arg, %4 @@ -259,16 +259,16 @@ TEST_F(IR_BuiltinPolyfillTest, CountLeadingZeros_I32) { Build(core::BuiltinFn::kCountLeadingZeros, ty.i32(), Vector{ty.i32()}); auto* src = R"( -%foo = func(%arg:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%arg:i32):i32 { + $B1: { %result:i32 = countLeadingZeros %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%arg:i32):i32 { + $B1: { %3:u32 = bitcast %arg %4:bool = lte %3, 65535u %5:u32 = select 0u, 16u, %4 @@ -309,16 +309,16 @@ TEST_F(IR_BuiltinPolyfillTest, CountLeadingZeros_Vec2U32) { Build(core::BuiltinFn::kCountLeadingZeros, ty.vec2<u32>(), Vector{ty.vec2<u32>()}); auto* src = R"( -%foo = func(%arg:vec2<u32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec2<u32>):vec2<u32> { + $B1: { %result:vec2<u32> = countLeadingZeros %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec2<u32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec2<u32>):vec2<u32> { + $B1: { %3:vec2<bool> = lte %arg, vec2<u32>(65535u) %4:vec2<u32> = select vec2<u32>(0u), vec2<u32>(16u), %3 %5:vec2<u32> = shl %arg, %4 @@ -357,16 +357,16 @@ TEST_F(IR_BuiltinPolyfillTest, CountLeadingZeros_Vec4I32) { Build(core::BuiltinFn::kCountLeadingZeros, ty.vec4<i32>(), Vector{ty.vec4<i32>()}); auto* src = R"( -%foo = func(%arg:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):vec4<i32> { + $B1: { %result:vec4<i32> = countLeadingZeros %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):vec4<i32> { + $B1: { %3:vec4<u32> = bitcast %arg %4:vec4<bool> = lte %3, vec4<u32>(65535u) %5:vec4<u32> = select vec4<u32>(0u), vec4<u32>(16u), %4 @@ -407,8 +407,8 @@ TEST_F(IR_BuiltinPolyfillTest, CountTrailingZeros_NoPolyfill) { Build(core::BuiltinFn::kCountTrailingZeros, ty.u32(), Vector{ty.u32()}); auto* src = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %result:u32 = countTrailingZeros %arg ret %result } @@ -427,16 +427,16 @@ TEST_F(IR_BuiltinPolyfillTest, CountTrailingZeros_U32) { Build(core::BuiltinFn::kCountTrailingZeros, ty.u32(), Vector{ty.u32()}); auto* src = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %result:u32 = countTrailingZeros %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %3:u32 = and %arg, 65535u %4:bool = eq %3, 0u %5:u32 = select 0u, 16u, %4 @@ -479,16 +479,16 @@ TEST_F(IR_BuiltinPolyfillTest, CountTrailingZeros_I32) { Build(core::BuiltinFn::kCountTrailingZeros, ty.i32(), Vector{ty.i32()}); auto* src = R"( -%foo = func(%arg:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%arg:i32):i32 { + $B1: { %result:i32 = countTrailingZeros %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%arg:i32):i32 { + $B1: { %3:u32 = bitcast %arg %4:u32 = and %3, 65535u %5:bool = eq %4, 0u @@ -533,16 +533,16 @@ TEST_F(IR_BuiltinPolyfillTest, CountTrailingZeros_Vec2U32) { Build(core::BuiltinFn::kCountTrailingZeros, ty.vec2<u32>(), Vector{ty.vec2<u32>()}); auto* src = R"( -%foo = func(%arg:vec2<u32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec2<u32>):vec2<u32> { + $B1: { %result:vec2<u32> = countTrailingZeros %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec2<u32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec2<u32>):vec2<u32> { + $B1: { %3:vec2<u32> = and %arg, vec2<u32>(65535u) %4:vec2<bool> = eq %3, vec2<u32>(0u) %5:vec2<u32> = select vec2<u32>(0u), vec2<u32>(16u), %4 @@ -585,16 +585,16 @@ TEST_F(IR_BuiltinPolyfillTest, CountTrailingZeros_Vec4I32) { Build(core::BuiltinFn::kCountTrailingZeros, ty.vec4<i32>(), Vector{ty.vec4<i32>()}); auto* src = R"( -%foo = func(%arg:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):vec4<i32> { + $B1: { %result:vec4<i32> = countTrailingZeros %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):vec4<i32> { + $B1: { %result:vec4<i32> = countTrailingZeros %arg ret %result } @@ -612,8 +612,8 @@ TEST_F(IR_BuiltinPolyfillTest, ExtractBits_NoPolyfill) { Build(core::BuiltinFn::kExtractBits, ty.u32(), Vector{ty.u32(), ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32):u32 -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32):u32 { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %result:u32 = extractBits %arg, %arg_1, %arg_2 ret %result } @@ -632,16 +632,16 @@ TEST_F(IR_BuiltinPolyfillTest, ExtractBits_ClampArgs_U32) { Build(core::BuiltinFn::kExtractBits, ty.u32(), Vector{ty.u32(), ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32):u32 -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32):u32 { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %result:u32 = extractBits %arg, %arg_1, %arg_2 ret %result } } )"; auto* expect = R"( -%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32):u32 -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32):u32 { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %5:u32 = min %arg_1, 32u %6:u32 = sub 32u, %5 %7:u32 = min %arg_2, %6 @@ -662,16 +662,16 @@ TEST_F(IR_BuiltinPolyfillTest, ExtractBits_ClampArgs_I32) { Build(core::BuiltinFn::kExtractBits, ty.i32(), Vector{ty.i32(), ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:i32, %arg_1:u32, %arg_2:u32):i32 -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:i32, %arg_1:u32, %arg_2:u32):i32 { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %result:i32 = extractBits %arg, %arg_1, %arg_2 ret %result } } )"; auto* expect = R"( -%foo = func(%arg:i32, %arg_1:u32, %arg_2:u32):i32 -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:i32, %arg_1:u32, %arg_2:u32):i32 { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %5:u32 = min %arg_1, 32u %6:u32 = sub 32u, %5 %7:u32 = min %arg_2, %6 @@ -693,16 +693,16 @@ Build(core::BuiltinFn::kExtractBits, ty.vec2<u32>(), Vector{ty.vec2<u32>(), ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:vec2<u32>, %arg_1:u32, %arg_2:u32):vec2<u32> -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:vec2<u32>, %arg_1:u32, %arg_2:u32):vec2<u32> { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %result:vec2<u32> = extractBits %arg, %arg_1, %arg_2 ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec2<u32>, %arg_1:u32, %arg_2:u32):vec2<u32> -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:vec2<u32>, %arg_1:u32, %arg_2:u32):vec2<u32> { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %5:u32 = min %arg_1, 32u %6:u32 = sub 32u, %5 %7:u32 = min %arg_2, %6 @@ -724,16 +724,16 @@ Build(core::BuiltinFn::kExtractBits, ty.vec4<i32>(), Vector{ty.vec4<i32>(), ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:vec4<i32>, %arg_1:u32, %arg_2:u32):vec4<i32> -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:vec4<i32>, %arg_1:u32, %arg_2:u32):vec4<i32> { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %result:vec4<i32> = extractBits %arg, %arg_1, %arg_2 ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec4<i32>, %arg_1:u32, %arg_2:u32):vec4<i32> -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:vec4<i32>, %arg_1:u32, %arg_2:u32):vec4<i32> { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %5:u32 = min %arg_1, 32u %6:u32 = sub 32u, %5 %7:u32 = min %arg_2, %6 @@ -754,8 +754,8 @@ TEST_F(IR_BuiltinPolyfillTest, FirstLeadingBit_NoPolyfill) { Build(core::BuiltinFn::kFirstLeadingBit, ty.u32(), Vector{ty.u32()}); auto* src = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %result:u32 = firstLeadingBit %arg ret %result } @@ -774,16 +774,16 @@ TEST_F(IR_BuiltinPolyfillTest, FirstLeadingBit_U32) { Build(core::BuiltinFn::kFirstLeadingBit, ty.u32(), Vector{ty.u32()}); auto* src = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %result:u32 = firstLeadingBit %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %3:u32 = and %arg, 4294901760u %4:bool = eq %3, 0u %5:u32 = select 16u, 0u, %4 @@ -825,16 +825,16 @@ TEST_F(IR_BuiltinPolyfillTest, FirstLeadingBit_I32) { Build(core::BuiltinFn::kFirstLeadingBit, ty.i32(), Vector{ty.i32()}); auto* src = R"( -%foo = func(%arg:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%arg:i32):i32 { + $B1: { %result:i32 = firstLeadingBit %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%arg:i32):i32 { + $B1: { %3:u32 = bitcast %arg %4:u32 = complement %3 %5:bool = lt %3, 2147483648u @@ -881,16 +881,16 @@ TEST_F(IR_BuiltinPolyfillTest, FirstLeadingBit_Vec2U32) { Build(core::BuiltinFn::kFirstLeadingBit, ty.vec2<u32>(), Vector{ty.vec2<u32>()}); auto* src = R"( -%foo = func(%arg:vec2<u32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec2<u32>):vec2<u32> { + $B1: { %result:vec2<u32> = firstLeadingBit %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec2<u32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec2<u32>):vec2<u32> { + $B1: { %3:vec2<u32> = and %arg, vec2<u32>(4294901760u) %4:vec2<bool> = eq %3, vec2<u32>(0u) %5:vec2<u32> = select vec2<u32>(16u), vec2<u32>(0u), %4 @@ -932,16 +932,16 @@ TEST_F(IR_BuiltinPolyfillTest, FirstLeadingBit_Vec4I32) { Build(core::BuiltinFn::kFirstLeadingBit, ty.vec4<i32>(), Vector{ty.vec4<i32>()}); auto* src = R"( -%foo = func(%arg:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):vec4<i32> { + $B1: { %result:vec4<i32> = firstLeadingBit %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):vec4<i32> { + $B1: { %3:vec4<u32> = bitcast %arg %4:vec4<u32> = complement %3 %5:vec4<bool> = lt %3, vec4<u32>(2147483648u) @@ -988,8 +988,8 @@ TEST_F(IR_BuiltinPolyfillTest, FirstTrailingBit_NoPolyfill) { Build(core::BuiltinFn::kFirstTrailingBit, ty.u32(), Vector{ty.u32()}); auto* src = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %result:u32 = firstTrailingBit %arg ret %result } @@ -1008,16 +1008,16 @@ TEST_F(IR_BuiltinPolyfillTest, FirstTrailingBit_U32) { Build(core::BuiltinFn::kFirstTrailingBit, ty.u32(), Vector{ty.u32()}); auto* src = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %result:u32 = firstTrailingBit %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:u32):u32 { + $B1: { %3:u32 = and %arg, 65535u %4:bool = eq %3, 0u %5:u32 = select 0u, 16u, %4 @@ -1059,16 +1059,16 @@ TEST_F(IR_BuiltinPolyfillTest, FirstTrailingBit_I32) { Build(core::BuiltinFn::kFirstTrailingBit, ty.i32(), Vector{ty.i32()}); auto* src = R"( -%foo = func(%arg:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%arg:i32):i32 { + $B1: { %result:i32 = firstTrailingBit %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%arg:i32):i32 { + $B1: { %3:u32 = bitcast %arg %4:u32 = and %3, 65535u %5:bool = eq %4, 0u @@ -1112,16 +1112,16 @@ TEST_F(IR_BuiltinPolyfillTest, FirstTrailingBit_Vec2U32) { Build(core::BuiltinFn::kFirstTrailingBit, ty.vec2<u32>(), Vector{ty.vec2<u32>()}); auto* src = R"( -%foo = func(%arg:vec2<u32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec2<u32>):vec2<u32> { + $B1: { %result:vec2<u32> = firstTrailingBit %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec2<u32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec2<u32>):vec2<u32> { + $B1: { %3:vec2<u32> = and %arg, vec2<u32>(65535u) %4:vec2<bool> = eq %3, vec2<u32>(0u) %5:vec2<u32> = select vec2<u32>(0u), vec2<u32>(16u), %4 @@ -1163,16 +1163,16 @@ TEST_F(IR_BuiltinPolyfillTest, FirstTrailingBit_Vec4I32) { Build(core::BuiltinFn::kFirstTrailingBit, ty.vec4<i32>(), Vector{ty.vec4<i32>()}); auto* src = R"( -%foo = func(%arg:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):vec4<i32> { + $B1: { %result:vec4<i32> = firstTrailingBit %arg ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):vec4<i32> { + $B1: { %3:vec4<u32> = bitcast %arg %4:vec4<u32> = and %3, vec4<u32>(65535u) %5:vec4<bool> = eq %4, vec4<u32>(0u) @@ -1216,8 +1216,8 @@ TEST_F(IR_BuiltinPolyfillTest, InsertBits_NoPolyfill) { Build(core::BuiltinFn::kInsertBits, ty.u32(), Vector{ty.u32(), ty.u32(), ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32, %arg_3:u32):u32 -> %b1 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' - %b1 = block { +%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32, %arg_3:u32):u32 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' + $B1: { %result:u32 = insertBits %arg, %arg_1, %arg_2, %arg_3 ret %result } @@ -1236,16 +1236,16 @@ TEST_F(IR_BuiltinPolyfillTest, InsertBits_ClampArgs_U32) { Build(core::BuiltinFn::kInsertBits, ty.u32(), Vector{ty.u32(), ty.u32(), ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32, %arg_3:u32):u32 -> %b1 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' - %b1 = block { +%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32, %arg_3:u32):u32 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' + $B1: { %result:u32 = insertBits %arg, %arg_1, %arg_2, %arg_3 ret %result } } )"; auto* expect = R"( -%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32, %arg_3:u32):u32 -> %b1 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' - %b1 = block { +%foo = func(%arg:u32, %arg_1:u32, %arg_2:u32, %arg_3:u32):u32 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' + $B1: { %6:u32 = min %arg_2, 32u %7:u32 = sub 32u, %6 %8:u32 = min %arg_3, %7 @@ -1266,16 +1266,16 @@ TEST_F(IR_BuiltinPolyfillTest, InsertBits_ClampArgs_I32) { Build(core::BuiltinFn::kInsertBits, ty.i32(), Vector{ty.i32(), ty.i32(), ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:i32, %arg_1:i32, %arg_2:u32, %arg_3:u32):i32 -> %b1 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' - %b1 = block { +%foo = func(%arg:i32, %arg_1:i32, %arg_2:u32, %arg_3:u32):i32 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' + $B1: { %result:i32 = insertBits %arg, %arg_1, %arg_2, %arg_3 ret %result } } )"; auto* expect = R"( -%foo = func(%arg:i32, %arg_1:i32, %arg_2:u32, %arg_3:u32):i32 -> %b1 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' - %b1 = block { +%foo = func(%arg:i32, %arg_1:i32, %arg_2:u32, %arg_3:u32):i32 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' + $B1: { %6:u32 = min %arg_2, 32u %7:u32 = sub 32u, %6 %8:u32 = min %arg_3, %7 @@ -1297,16 +1297,16 @@ Build(core::BuiltinFn::kInsertBits, ty.vec2<u32>(), Vector{ty.vec2<u32>(), ty.vec2<u32>(), ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:vec2<u32>, %arg_1:vec2<u32>, %arg_2:u32, %arg_3:u32):vec2<u32> -> %b1 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' - %b1 = block { +%foo = func(%arg:vec2<u32>, %arg_1:vec2<u32>, %arg_2:u32, %arg_3:u32):vec2<u32> { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' + $B1: { %result:vec2<u32> = insertBits %arg, %arg_1, %arg_2, %arg_3 ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec2<u32>, %arg_1:vec2<u32>, %arg_2:u32, %arg_3:u32):vec2<u32> -> %b1 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' - %b1 = block { +%foo = func(%arg:vec2<u32>, %arg_1:vec2<u32>, %arg_2:u32, %arg_3:u32):vec2<u32> { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' + $B1: { %6:u32 = min %arg_2, 32u %7:u32 = sub 32u, %6 %8:u32 = min %arg_3, %7 @@ -1328,16 +1328,16 @@ Build(core::BuiltinFn::kInsertBits, ty.vec4<i32>(), Vector{ty.vec4<i32>(), ty.vec4<i32>(), ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:vec4<i32>, %arg_1:vec4<i32>, %arg_2:u32, %arg_3:u32):vec4<i32> -> %b1 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' - %b1 = block { +%foo = func(%arg:vec4<i32>, %arg_1:vec4<i32>, %arg_2:u32, %arg_3:u32):vec4<i32> { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' + $B1: { %result:vec4<i32> = insertBits %arg, %arg_1, %arg_2, %arg_3 ret %result } } )"; auto* expect = R"( -%foo = func(%arg:vec4<i32>, %arg_1:vec4<i32>, %arg_2:u32, %arg_3:u32):vec4<i32> -> %b1 { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' - %b1 = block { +%foo = func(%arg:vec4<i32>, %arg_1:vec4<i32>, %arg_2:u32, %arg_3:u32):vec4<i32> { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg' + $B1: { %6:u32 = min %arg_2, 32u %7:u32 = sub 32u, %6 %8:u32 = min %arg_3, %7 @@ -1361,8 +1361,8 @@ Build(core::BuiltinFn::kTextureSampleBaseClampToEdge, ty.vec4<f32>(), Vector{texture_ty, ty.sampler(), ty.vec2<f32>()}); auto* src = R"( -%foo = func(%arg:texture_2d<f32>, %arg_1:sampler, %arg_2:vec2<f32>):vec4<f32> -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:texture_2d<f32>, %arg_1:sampler, %arg_2:vec2<f32>):vec4<f32> { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %result:vec4<f32> = textureSampleBaseClampToEdge %arg, %arg_1, %arg_2 ret %result } @@ -1384,16 +1384,16 @@ Build(core::BuiltinFn::kTextureSampleBaseClampToEdge, ty.vec4<f32>(), Vector{texture_ty, ty.sampler(), ty.vec2<f32>()}); auto* src = R"( -%foo = func(%arg:texture_2d<f32>, %arg_1:sampler, %arg_2:vec2<f32>):vec4<f32> -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:texture_2d<f32>, %arg_1:sampler, %arg_2:vec2<f32>):vec4<f32> { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %result:vec4<f32> = textureSampleBaseClampToEdge %arg, %arg_1, %arg_2 ret %result } } )"; auto* expect = R"( -%foo = func(%arg:texture_2d<f32>, %arg_1:sampler, %arg_2:vec2<f32>):vec4<f32> -> %b1 { # %arg_1: 'arg', %arg_2: 'arg' - %b1 = block { +%foo = func(%arg:texture_2d<f32>, %arg_1:sampler, %arg_2:vec2<f32>):vec4<f32> { # %arg_1: 'arg', %arg_2: 'arg' + $B1: { %5:vec2<u32> = textureDimensions %arg %6:vec2<f32> = convert %5 %7:vec2<f32> = div vec2<f32>(0.5f), %6 @@ -1417,8 +1417,8 @@ Build(core::BuiltinFn::kPack4XI8, ty.u32(), Vector{ty.vec4<i32>()}); auto* src = R"( -%foo = func(%arg:vec4<i32>):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):u32 { + $B1: { %result:u32 = pack4xI8 %arg ret %result } @@ -1427,8 +1427,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:vec4<i32>):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):u32 { + $B1: { %3:vec4<u32> = construct 0u, 8u, 16u, 24u %4:vec4<u32> = bitcast %arg %5:vec4<u32> = construct 255u @@ -1452,8 +1452,8 @@ Build(core::BuiltinFn::kPack4XU8, ty.u32(), Vector{ty.vec4<u32>()}); auto* src = R"( -%foo = func(%arg:vec4<u32>):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<u32>):u32 { + $B1: { %result:u32 = pack4xU8 %arg ret %result } @@ -1462,8 +1462,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:vec4<u32>):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<u32>):u32 { + $B1: { %3:vec4<u32> = construct 0u, 8u, 16u, 24u %4:vec4<u32> = construct 255u %5:vec4<u32> = and %arg, %4 @@ -1486,8 +1486,8 @@ Build(core::BuiltinFn::kPack4XI8Clamp, ty.u32(), Vector{ty.vec4<i32>()}); auto* src = R"( -%foo = func(%arg:vec4<i32>):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):u32 { + $B1: { %result:u32 = pack4xI8Clamp %arg ret %result } @@ -1496,8 +1496,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:vec4<i32>):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<i32>):u32 { + $B1: { %3:vec4<u32> = construct 0u, 8u, 16u, 24u %4:vec4<i32> = construct -128i %5:vec4<i32> = construct 127i @@ -1524,8 +1524,8 @@ Build(core::BuiltinFn::kPack4XU8Clamp, ty.u32(), Vector{ty.vec4<u32>()}); auto* src = R"( -%foo = func(%arg:vec4<u32>):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<u32>):u32 { + $B1: { %result:u32 = pack4xU8Clamp %arg ret %result } @@ -1534,8 +1534,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:vec4<u32>):u32 -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<u32>):u32 { + $B1: { %3:vec4<u32> = construct 0u, 8u, 16u, 24u %4:vec4<u32> = construct 0u %5:vec4<u32> = construct 255u @@ -1559,8 +1559,8 @@ Build(core::BuiltinFn::kUnpack4XI8, ty.vec4<i32>(), Vector{ty.u32()}); auto* src = R"( -%foo = func(%arg:u32):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%arg:u32):vec4<i32> { + $B1: { %result:vec4<i32> = unpack4xI8 %arg ret %result } @@ -1569,8 +1569,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:u32):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%arg:u32):vec4<i32> { + $B1: { %3:vec4<u32> = construct 24u, 16u, 8u, 0u %4:vec4<u32> = construct %arg %5:vec4<u32> = shl %4, %3 @@ -1593,8 +1593,8 @@ Build(core::BuiltinFn::kUnpack4XU8, ty.vec4<u32>(), Vector{ty.u32()}); auto* src = R"( -%foo = func(%arg:u32):vec4<u32> -> %b1 { - %b1 = block { +%foo = func(%arg:u32):vec4<u32> { + $B1: { %result:vec4<u32> = unpack4xU8 %arg ret %result } @@ -1603,8 +1603,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:u32):vec4<u32> -> %b1 { - %b1 = block { +%foo = func(%arg:u32):vec4<u32> { + $B1: { %3:vec4<u32> = construct 0u, 8u, 16u, 24u %4:vec4<u32> = construct %arg %5:vec4<u32> = shr %4, %3 @@ -1626,8 +1626,8 @@ Build(core::BuiltinFn::kDot4I8Packed, ty.i32(), Vector{ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:u32, %arg_1:u32):i32 -> %b1 { # %arg_1: 'arg' - %b1 = block { +%foo = func(%arg:u32, %arg_1:u32):i32 { # %arg_1: 'arg' + $B1: { %result:i32 = dot4I8Packed %arg, %arg_1 ret %result } @@ -1636,8 +1636,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:u32, %arg_1:u32):i32 -> %b1 { # %arg_1: 'arg' - %b1 = block { +%foo = func(%arg:u32, %arg_1:u32):i32 { # %arg_1: 'arg' + $B1: { %4:vec4<u32> = construct 24u, 16u, 8u, 0u %5:vec4<u32> = construct %arg %6:vec4<u32> = shl %5, %4 @@ -1667,8 +1667,8 @@ Build(core::BuiltinFn::kDot4U8Packed, ty.u32(), Vector{ty.u32(), ty.u32()}); auto* src = R"( -%foo = func(%arg:u32, %arg_1:u32):u32 -> %b1 { # %arg_1: 'arg' - %b1 = block { +%foo = func(%arg:u32, %arg_1:u32):u32 { # %arg_1: 'arg' + $B1: { %result:u32 = dot4U8Packed %arg, %arg_1 ret %result } @@ -1677,8 +1677,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:u32, %arg_1:u32):u32 -> %b1 { # %arg_1: 'arg' - %b1 = block { +%foo = func(%arg:u32, %arg_1:u32):u32 { # %arg_1: 'arg' + $B1: { %4:vec4<u32> = construct 0u, 8u, 16u, 24u %5:vec4<u32> = construct %arg %6:vec4<u32> = shr %5, %4
diff --git a/src/tint/lang/core/ir/transform/combine_access_instructions_test.cc b/src/tint/lang/core/ir/transform/combine_access_instructions_test.cc index 8fd46fd..2d07019 100644 --- a/src/tint/lang/core/ir/transform/combine_access_instructions_test.cc +++ b/src/tint/lang/core/ir/transform/combine_access_instructions_test.cc
@@ -73,12 +73,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, MyStruct, read> = access %buffer %4:MyStruct = load %3 %5:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u @@ -127,12 +127,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u %4:ptr<uniform, mat3x3<f32>, read> = access %3, 1u %5:ptr<uniform, vec3<f32>, read> = access %4, 2u @@ -148,12 +148,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, vec3<f32>, read> = access %buffer, 0u, 1u, 2u %4:vec3<f32> = load %3 ret @@ -191,12 +191,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, MyStruct, read> = access %buffer %4:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %3, 0u %5:array<mat3x3<f32>, 4> = load %4 @@ -211,12 +211,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u %4:array<mat3x3<f32>, 4> = load %3 ret @@ -255,12 +255,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u %4:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %3 %5:ptr<uniform, mat3x3<f32>, read> = access %4, 1u @@ -276,12 +276,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, mat3x3<f32>, read> = access %buffer, 0u, 1u %4:mat3x3<f32> = load %3 ret @@ -320,12 +320,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u %4:ptr<uniform, mat3x3<f32>, read> = access %3, 1u %5:ptr<uniform, mat3x3<f32>, read> = access %4 @@ -341,12 +341,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, mat3x3<f32>, read> = access %buffer, 0u, 1u %4:mat3x3<f32> = load %3 ret @@ -399,12 +399,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u %4:ptr<uniform, mat3x3<f32>, read> = access %3, 1u %5:ptr<uniform, vec3<f32>, read> = access %4, 2u @@ -426,12 +426,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, vec3<f32>, read> = access %buffer, 0u, 1u, 2u %4:vec3<f32> = load %3 %5:ptr<uniform, vec3<f32>, read> = access %buffer, 0u, 2u, 0u @@ -486,12 +486,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u %4:ptr<uniform, mat3x3<f32>, read> = access %3, 1u %5:ptr<uniform, vec3<f32>, read> = access %4, 2u @@ -511,12 +511,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, vec3<f32>, read> = access %buffer, 0u, 1u, 2u %4:vec3<f32> = load %3 %5:ptr<uniform, vec3<f32>, read> = access %buffer, 0u, 1u, 0u @@ -561,12 +561,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u %4:array<mat3x3<f32>, 4> = load %3 %5:ptr<uniform, mat3x3<f32>, read> = access %3, 1u @@ -583,12 +583,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u %4:array<mat3x3<f32>, 4> = load %3 %5:ptr<uniform, vec3<f32>, read> = access %buffer, 0u, 1u, 2u @@ -631,12 +631,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u %4:ptr<uniform, mat3x3<f32>, read> = access %3, 1u %5:mat3x3<f32> = load %4 @@ -653,12 +653,12 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, mat3x3<f32>, read> = access %buffer, 0u, 1u %4:mat3x3<f32> = load %3 %5:ptr<uniform, vec3<f32>, read> = access %buffer, 0u, 1u, 2u @@ -684,8 +684,8 @@ }); auto* src = R"( -%foo = func():f32 -> %b1 { - %b1 = block { +%foo = func():f32 { + $B1: { %2:u32 = access %indices, 1u %4:f32 = access %values, %2 ret %4 @@ -734,20 +734,20 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u - if true [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + if true [t: $B3, f: $B4] { # if_1 + $B3: { # true %4:ptr<uniform, mat3x3<f32>, read> = access %3, 1u %5:mat3x3<f32> = load %4 exit_if # if_1 } - %b4 = block { # false + $B4: { # false %6:ptr<uniform, mat3x3<f32>, read> = access %3, 2u %7:mat3x3<f32> = load %6 exit_if # if_1 @@ -764,19 +764,19 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { - if true [t: %b3, f: %b4] { # if_1 - %b3 = block { # true +%foo = func():void { + $B2: { + if true [t: $B3, f: $B4] { # if_1 + $B3: { # true %3:ptr<uniform, mat3x3<f32>, read> = access %buffer, 0u, 1u %4:mat3x3<f32> = load %3 exit_if # if_1 } - %b4 = block { # false + $B4: { # false %5:ptr<uniform, mat3x3<f32>, read> = access %buffer, 0u, 2u %6:mat3x3<f32> = load %5 exit_if # if_1 @@ -825,23 +825,23 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<mat3x3<f32>, 4>, read> = access %buffer, 0u - loop [b: %b3, c: %b4] { # loop_1 - %b3 = block { # body + loop [b: $B3, c: $B4] { # loop_1 + $B3: { # body %4:ptr<uniform, mat3x3<f32>, read> = access %3, 2u %5:mat3x3<f32> = load %4 - continue %b4 + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %6:ptr<uniform, mat3x3<f32>, read> = access %3, 3u %7:mat3x3<f32> = load %6 - break_if true %b3 + break_if true # -> [t: exit_loop loop_1, f: $B3] } } ret @@ -855,22 +855,22 @@ a:array<mat3x3<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { - loop [b: %b3, c: %b4] { # loop_1 - %b3 = block { # body +%foo = func():void { + $B2: { + loop [b: $B3, c: $B4] { # loop_1 + $B3: { # body %3:ptr<uniform, mat3x3<f32>, read> = access %buffer, 0u, 2u %4:mat3x3<f32> = load %3 - continue %b4 + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %5:ptr<uniform, mat3x3<f32>, read> = access %buffer, 0u, 3u %6:mat3x3<f32> = load %5 - break_if true %b3 + break_if true # -> [t: exit_loop loop_1, f: $B3] } } ret
diff --git a/src/tint/lang/core/ir/transform/conversion_polyfill_test.cc b/src/tint/lang/core/ir/transform/conversion_polyfill_test.cc index 214ca29..cdb2db9 100644 --- a/src/tint/lang/core/ir/transform/conversion_polyfill_test.cc +++ b/src/tint/lang/core/ir/transform/conversion_polyfill_test.cc
@@ -58,8 +58,8 @@ TEST_F(IR_ConversionPolyfillTest, I32_to_F32) { Build(ty.i32(), ty.f32()); auto* src = R"( -%foo = func(%src:i32):f32 -> %b1 { - %b1 = block { +%foo = func(%src:i32):f32 { + $B1: { %result:f32 = convert %src ret %result } @@ -79,8 +79,8 @@ TEST_F(IR_ConversionPolyfillTest, U32_to_F32) { Build(ty.u32(), ty.f32()); auto* src = R"( -%foo = func(%src:u32):f32 -> %b1 { - %b1 = block { +%foo = func(%src:u32):f32 { + $B1: { %result:f32 = convert %src ret %result } @@ -99,8 +99,8 @@ TEST_F(IR_ConversionPolyfillTest, F32_to_I32_NoPolyfill) { Build(ty.f32(), ty.i32()); auto* src = R"( -%foo = func(%src:f32):i32 -> %b1 { - %b1 = block { +%foo = func(%src:f32):i32 { + $B1: { %result:i32 = convert %src ret %result } @@ -119,22 +119,22 @@ TEST_F(IR_ConversionPolyfillTest, F32_to_I32) { Build(ty.f32(), ty.i32()); auto* src = R"( -%foo = func(%src:f32):i32 -> %b1 { - %b1 = block { +%foo = func(%src:f32):i32 { + $B1: { %result:i32 = convert %src ret %result } } )"; auto* expect = R"( -%foo = func(%src:f32):i32 -> %b1 { - %b1 = block { +%foo = func(%src:f32):i32 { + $B1: { %result:i32 = call %tint_f32_to_i32, %src ret %result } } -%tint_f32_to_i32 = func(%value:f32):i32 -> %b2 { - %b2 = block { +%tint_f32_to_i32 = func(%value:f32):i32 { + $B2: { %6:i32 = convert %value %7:bool = gte %value, -2147483648.0f %8:i32 = select -2147483648i, %6, %7 @@ -156,22 +156,22 @@ TEST_F(IR_ConversionPolyfillTest, F32_to_U32) { Build(ty.f32(), ty.u32()); auto* src = R"( -%foo = func(%src:f32):u32 -> %b1 { - %b1 = block { +%foo = func(%src:f32):u32 { + $B1: { %result:u32 = convert %src ret %result } } )"; auto* expect = R"( -%foo = func(%src:f32):u32 -> %b1 { - %b1 = block { +%foo = func(%src:f32):u32 { + $B1: { %result:u32 = call %tint_f32_to_u32, %src ret %result } } -%tint_f32_to_u32 = func(%value:f32):u32 -> %b2 { - %b2 = block { +%tint_f32_to_u32 = func(%value:f32):u32 { + $B2: { %6:u32 = convert %value %7:bool = gte %value, 0.0f %8:u32 = select 0u, %6, %7 @@ -193,22 +193,22 @@ TEST_F(IR_ConversionPolyfillTest, F32_to_I32_Vec2) { Build(ty.vec2<f32>(), ty.vec2<i32>()); auto* src = R"( -%foo = func(%src:vec2<f32>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%src:vec2<f32>):vec2<i32> { + $B1: { %result:vec2<i32> = convert %src ret %result } } )"; auto* expect = R"( -%foo = func(%src:vec2<f32>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%src:vec2<f32>):vec2<i32> { + $B1: { %result:vec2<i32> = call %tint_v2f32_to_v2i32, %src ret %result } } -%tint_v2f32_to_v2i32 = func(%value:vec2<f32>):vec2<i32> -> %b2 { - %b2 = block { +%tint_v2f32_to_v2i32 = func(%value:vec2<f32>):vec2<i32> { + $B2: { %6:vec2<i32> = convert %value %7:vec2<bool> = gte %value, vec2<f32>(-2147483648.0f) %8:vec2<i32> = select vec2<i32>(-2147483648i), %6, %7 @@ -230,22 +230,22 @@ TEST_F(IR_ConversionPolyfillTest, F32_to_U32_Vec3) { Build(ty.vec2<f32>(), ty.vec2<u32>()); auto* src = R"( -%foo = func(%src:vec2<f32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%src:vec2<f32>):vec2<u32> { + $B1: { %result:vec2<u32> = convert %src ret %result } } )"; auto* expect = R"( -%foo = func(%src:vec2<f32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%src:vec2<f32>):vec2<u32> { + $B1: { %result:vec2<u32> = call %tint_v2f32_to_v2u32, %src ret %result } } -%tint_v2f32_to_v2u32 = func(%value:vec2<f32>):vec2<u32> -> %b2 { - %b2 = block { +%tint_v2f32_to_v2u32 = func(%value:vec2<f32>):vec2<u32> { + $B2: { %6:vec2<u32> = convert %value %7:vec2<bool> = gte %value, vec2<f32>(0.0f) %8:vec2<u32> = select vec2<u32>(0u), %6, %7 @@ -267,22 +267,22 @@ TEST_F(IR_ConversionPolyfillTest, F16_to_I32) { Build(ty.f16(), ty.i32()); auto* src = R"( -%foo = func(%src:f16):i32 -> %b1 { - %b1 = block { +%foo = func(%src:f16):i32 { + $B1: { %result:i32 = convert %src ret %result } } )"; auto* expect = R"( -%foo = func(%src:f16):i32 -> %b1 { - %b1 = block { +%foo = func(%src:f16):i32 { + $B1: { %result:i32 = call %tint_f16_to_i32, %src ret %result } } -%tint_f16_to_i32 = func(%value:f16):i32 -> %b2 { - %b2 = block { +%tint_f16_to_i32 = func(%value:f16):i32 { + $B2: { %6:i32 = convert %value %7:bool = gte %value, -65504.0h %8:i32 = select -2147483648i, %6, %7 @@ -304,22 +304,22 @@ TEST_F(IR_ConversionPolyfillTest, F16_to_U32) { Build(ty.f16(), ty.u32()); auto* src = R"( -%foo = func(%src:f16):u32 -> %b1 { - %b1 = block { +%foo = func(%src:f16):u32 { + $B1: { %result:u32 = convert %src ret %result } } )"; auto* expect = R"( -%foo = func(%src:f16):u32 -> %b1 { - %b1 = block { +%foo = func(%src:f16):u32 { + $B1: { %result:u32 = call %tint_f16_to_u32, %src ret %result } } -%tint_f16_to_u32 = func(%value:f16):u32 -> %b2 { - %b2 = block { +%tint_f16_to_u32 = func(%value:f16):u32 { + $B2: { %6:u32 = convert %value %7:bool = gte %value, 0.0h %8:u32 = select 0u, %6, %7 @@ -341,22 +341,22 @@ TEST_F(IR_ConversionPolyfillTest, F16_to_I32_Vec2) { Build(ty.vec2<f16>(), ty.vec2<i32>()); auto* src = R"( -%foo = func(%src:vec2<f16>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%src:vec2<f16>):vec2<i32> { + $B1: { %result:vec2<i32> = convert %src ret %result } } )"; auto* expect = R"( -%foo = func(%src:vec2<f16>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%src:vec2<f16>):vec2<i32> { + $B1: { %result:vec2<i32> = call %tint_v2f16_to_v2i32, %src ret %result } } -%tint_v2f16_to_v2i32 = func(%value:vec2<f16>):vec2<i32> -> %b2 { - %b2 = block { +%tint_v2f16_to_v2i32 = func(%value:vec2<f16>):vec2<i32> { + $B2: { %6:vec2<i32> = convert %value %7:vec2<bool> = gte %value, vec2<f16>(-65504.0h) %8:vec2<i32> = select vec2<i32>(-2147483648i), %6, %7 @@ -378,22 +378,22 @@ TEST_F(IR_ConversionPolyfillTest, F16_to_U32_Vec3) { Build(ty.vec2<f16>(), ty.vec2<u32>()); auto* src = R"( -%foo = func(%src:vec2<f16>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%src:vec2<f16>):vec2<u32> { + $B1: { %result:vec2<u32> = convert %src ret %result } } )"; auto* expect = R"( -%foo = func(%src:vec2<f16>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%src:vec2<f16>):vec2<u32> { + $B1: { %result:vec2<u32> = call %tint_v2f16_to_v2u32, %src ret %result } } -%tint_v2f16_to_v2u32 = func(%value:vec2<f16>):vec2<u32> -> %b2 { - %b2 = block { +%tint_v2f16_to_v2u32 = func(%value:vec2<f16>):vec2<u32> { + $B2: { %6:vec2<u32> = convert %value %7:vec2<bool> = gte %value, vec2<f16>(0.0h) %8:vec2<u32> = select vec2<u32>(0u), %6, %7
diff --git a/src/tint/lang/core/ir/transform/demote_to_helper_test.cc b/src/tint/lang/core/ir/transform/demote_to_helper_test.cc index e997e41..e26ff8d 100644 --- a/src/tint/lang/core/ir/transform/demote_to_helper_test.cc +++ b/src/tint/lang/core/ir/transform/demote_to_helper_test.cc
@@ -56,12 +56,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, i32, read_write> = var @binding_point(0, 0) } -%ep = @fragment func():f32 [@location(0)] -> %b2 { - %b2 = block { +%ep = @fragment func():f32 [@location(0)] { + $B2: { store %buffer, 42i ret 0.5f } @@ -98,14 +98,14 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, i32, read_write> = var @binding_point(0, 0) } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true discard exit_if # if_1 } @@ -118,30 +118,30 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, i32, read_write> = var @binding_point(0, 0) %continue_execution:ptr<private, bool, read_write> = var, true } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true store %continue_execution, false exit_if # if_1 } } %5:bool = load %continue_execution - if %5 [t: %b4] { # if_2 - %b4 = block { # true + if %5 [t: $B4] { # if_2 + $B4: { # true store %buffer, 42i exit_if # if_2 } } %6:bool = load %continue_execution %7:bool = eq %6, false - if %7 [t: %b5] { # if_3 - %b5 = block { # true + if %7 [t: $B5] { # if_3 + $B5: { # true terminate_invocation } } @@ -183,20 +183,20 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, i32, read_write> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { store %buffer, 42i ret } } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b3 { - %b3 = block { - if %front_facing [t: %b4] { # if_1 - %b4 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B3: { + if %front_facing [t: $B4] { # if_1 + $B4: { # true discard exit_if # if_1 } @@ -209,16 +209,16 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, i32, read_write> = var @binding_point(0, 0) %continue_execution:ptr<private, bool, read_write> = var, true } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %4:bool = load %continue_execution - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true store %buffer, 42i exit_if # if_1 } @@ -226,10 +226,10 @@ ret } } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b4 { - %b4 = block { - if %front_facing [t: %b5] { # if_2 - %b5 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B4: { + if %front_facing [t: $B5] { # if_2 + $B5: { # true store %continue_execution, false exit_if # if_2 } @@ -237,8 +237,8 @@ %7:void = call %foo %8:bool = load %continue_execution %9:bool = eq %8, false - if %9 [t: %b6] { # if_3 - %b6 = block { # true + if %9 [t: $B6] { # if_3 + $B6: { # true terminate_invocation } } @@ -282,14 +282,14 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, i32, read_write> = var @binding_point(0, 0) } -%foo = func(%cond:bool):void -> %b2 { - %b2 = block { - if %cond [t: %b3] { # if_1 - %b3 = block { # true +%foo = func(%cond:bool):void { + $B2: { + if %cond [t: $B3] { # if_1 + $B3: { # true discard exit_if # if_1 } @@ -297,8 +297,8 @@ ret } } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b4 { - %b4 = block { +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B4: { %6:void = call %foo, %front_facing store %buffer, 42i ret 0.5f @@ -308,15 +308,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, i32, read_write> = var @binding_point(0, 0) %continue_execution:ptr<private, bool, read_write> = var, true } -%foo = func(%cond:bool):void -> %b2 { - %b2 = block { - if %cond [t: %b3] { # if_1 - %b3 = block { # true +%foo = func(%cond:bool):void { + $B2: { + if %cond [t: $B3] { # if_1 + $B3: { # true store %continue_execution, false exit_if # if_1 } @@ -324,20 +324,20 @@ ret } } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b4 { - %b4 = block { +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B4: { %7:void = call %foo, %front_facing %8:bool = load %continue_execution - if %8 [t: %b5] { # if_2 - %b5 = block { # true + if %8 [t: $B5] { # if_2 + $B5: { # true store %buffer, 42i exit_if # if_2 } } %9:bool = load %continue_execution %10:bool = eq %9, false - if %10 [t: %b6] { # if_3 - %b6 = block { # true + if %10 [t: $B6] { # if_3 + $B6: { # true terminate_invocation } } @@ -381,14 +381,14 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, i32, read_write> = var @binding_point(0, 0) } -%foo = func(%cond:bool):void -> %b2 { - %b2 = block { - if %cond [t: %b3] { # if_1 - %b3 = block { # true +%foo = func(%cond:bool):void { + $B2: { + if %cond [t: $B3] { # if_1 + $B3: { # true discard exit_if # if_1 } @@ -397,8 +397,8 @@ ret } } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b4 { - %b4 = block { +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B4: { %6:void = call %foo, %front_facing ret 0.5f } @@ -407,22 +407,22 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, i32, read_write> = var @binding_point(0, 0) %continue_execution:ptr<private, bool, read_write> = var, true } -%foo = func(%cond:bool):void -> %b2 { - %b2 = block { - if %cond [t: %b3] { # if_1 - %b3 = block { # true +%foo = func(%cond:bool):void { + $B2: { + if %cond [t: $B3] { # if_1 + $B3: { # true store %continue_execution, false exit_if # if_1 } } %5:bool = load %continue_execution - if %5 [t: %b4] { # if_2 - %b4 = block { # true + if %5 [t: $B4] { # if_2 + $B4: { # true store %buffer, 42i exit_if # if_2 } @@ -430,13 +430,13 @@ ret } } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b5 { - %b5 = block { +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B5: { %8:void = call %foo, %front_facing %9:bool = load %continue_execution %10:bool = eq %9, false - if %10 [t: %b6] { # if_3 - %b6 = block { # true + if %10 [t: $B6] { # if_3 + $B6: { # true terminate_invocation } } @@ -471,15 +471,15 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %priv:ptr<private, i32, read_write> = var } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b2 { - %b2 = block { +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B2: { %func:ptr<function, i32, read_write> = var - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true + if %front_facing [t: $B3] { # if_1 + $B3: { # true discard exit_if # if_1 } @@ -493,16 +493,16 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %priv:ptr<private, i32, read_write> = var %continue_execution:ptr<private, bool, read_write> = var, true } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b2 { - %b2 = block { +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B2: { %func:ptr<function, i32, read_write> = var - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true + if %front_facing [t: $B3] { # if_1 + $B3: { # true store %continue_execution, false exit_if # if_1 } @@ -511,8 +511,8 @@ store %func, 42i %6:bool = load %continue_execution %7:bool = eq %6, false - if %7 [t: %b4] { # if_2 - %b4 = block { # true + if %7 [t: $B4] { # if_2 + $B4: { # true terminate_invocation } } @@ -555,14 +555,14 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<r32float, write>, read> = var @binding_point(0, 0) } -%ep = @fragment func(%front_facing:bool [@front_facing], %coord:vec2<i32>):f32 [@location(0)] -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing], %coord:vec2<i32>):f32 [@location(0)] { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true discard exit_if # if_1 } @@ -576,31 +576,31 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<r32float, write>, read> = var @binding_point(0, 0) %continue_execution:ptr<private, bool, read_write> = var, true } -%ep = @fragment func(%front_facing:bool [@front_facing], %coord:vec2<i32>):f32 [@location(0)] -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing], %coord:vec2<i32>):f32 [@location(0)] { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true store %continue_execution, false exit_if # if_1 } } %6:texture_storage_2d<r32float, write> = load %texture %7:bool = load %continue_execution - if %7 [t: %b4] { # if_2 - %b4 = block { # true + if %7 [t: $B4] { # if_2 + $B4: { # true %8:void = textureStore %6, %coord, vec4<f32>(0.5f) exit_if # if_2 } } %9:bool = load %continue_execution %10:bool = eq %9, false - if %10 [t: %b5] { # if_3 - %b5 = block { # true + if %10 [t: $B5] { # if_3 + $B5: { # true terminate_invocation } } @@ -636,14 +636,14 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, atomic<i32>, read_write> = var @binding_point(0, 0) } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true discard exit_if # if_1 } @@ -656,30 +656,30 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, atomic<i32>, read_write> = var @binding_point(0, 0) %continue_execution:ptr<private, bool, read_write> = var, true } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true store %continue_execution, false exit_if # if_1 } } %5:bool = load %continue_execution - if %5 [t: %b4] { # if_2 - %b4 = block { # true + if %5 [t: $B4] { # if_2 + $B4: { # true %6:void = atomicStore %buffer, 42i exit_if # if_2 } } %7:bool = load %continue_execution %8:bool = eq %7, false - if %8 [t: %b5] { # if_3 - %b5 = block { # true + if %8 [t: $B5] { # if_3 + $B5: { # true terminate_invocation } } @@ -716,14 +716,14 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, atomic<i32>, read_write> = var @binding_point(0, 0) } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true discard exit_if # if_1 } @@ -737,22 +737,22 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, atomic<i32>, read_write> = var @binding_point(0, 0) %continue_execution:ptr<private, bool, read_write> = var, true } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true store %continue_execution, false exit_if # if_1 } } %5:bool = load %continue_execution - %6:i32 = if %5 [t: %b4] { # if_2 - %b4 = block { # true + %6:i32 = if %5 [t: $B4] { # if_2 + $B4: { # true %7:i32 = atomicAdd %buffer, 42i exit_if %7 # if_2 } @@ -761,8 +761,8 @@ %8:i32 = add %6, 1i %9:bool = load %continue_execution %10:bool = eq %9, false - if %10 [t: %b5] { # if_3 - %b5 = block { # true + if %10 [t: $B5] { # if_3 + $B5: { # true terminate_invocation } } @@ -806,14 +806,14 @@ exchanged:bool @offset(4) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, atomic<i32>, read_write> = var @binding_point(0, 0) } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true discard exit_if # if_1 } @@ -833,22 +833,22 @@ exchanged:bool @offset(4) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, atomic<i32>, read_write> = var @binding_point(0, 0) %continue_execution:ptr<private, bool, read_write> = var, true } -%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%ep = @fragment func(%front_facing:bool [@front_facing]):f32 [@location(0)] { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true store %continue_execution, false exit_if # if_1 } } %5:bool = load %continue_execution - %6:__atomic_compare_exchange_result_i32 = if %5 [t: %b4] { # if_2 - %b4 = block { # true + %6:__atomic_compare_exchange_result_i32 = if %5 [t: $B4] { # if_2 + $B4: { # true %7:__atomic_compare_exchange_result_i32 = atomicCompareExchangeWeak %buffer, 0i, 42i exit_if %7 # if_2 } @@ -858,8 +858,8 @@ %9:i32 = add %8, 1i %10:bool = load %continue_execution %11:bool = eq %10, false - if %11 [t: %b5] { # if_3 - %b5 = block { # true + if %11 [t: $B5] { # if_3 + $B5: { # true terminate_invocation } } @@ -882,8 +882,8 @@ }); auto* src = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { discard ret } @@ -892,12 +892,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %continue_execution:ptr<private, bool, read_write> = var, true } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { store %continue_execution, false ret }
diff --git a/src/tint/lang/core/ir/transform/direct_variable_access_test.cc b/src/tint/lang/core/ir/transform/direct_variable_access_test.cc index 4919a26..cf464d3 100644 --- a/src/tint/lang/core/ir/transform/direct_variable_access_test.cc +++ b/src/tint/lang/core/ir/transform/direct_variable_access_test.cc
@@ -75,12 +75,12 @@ b.Append(u->Block(), [&] { b.Return(u, b.Load(p)); }); auto* src = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } -%u = func(%pre:i32, %p:ptr<uniform, i32, read>, %post:i32):i32 -> %b2 { - %b2 = block { +%u = func(%pre:i32, %p:ptr<uniform, i32, read>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } @@ -90,7 +90,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } @@ -114,12 +114,12 @@ b.Append(s->Block(), [&] { b.Return(s, b.Load(p)); }); auto* src = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } -%s = func(%pre:i32, %p:ptr<storage, i32, read>, %post:i32):i32 -> %b2 { - %b2 = block { +%s = func(%pre:i32, %p:ptr<storage, i32, read>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } @@ -129,7 +129,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } @@ -153,12 +153,12 @@ b.Append(w->Block(), [&] { b.Return(w, b.Load(p)); }); auto* src = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } -%w = func(%pre:i32, %p:ptr<workgroup, i32, read_write>, %post:i32):i32 -> %b2 { - %b2 = block { +%w = func(%pre:i32, %p:ptr<workgroup, i32, read_write>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } @@ -168,7 +168,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } @@ -192,12 +192,12 @@ b.Append(f->Block(), [&] { b.Return(f, b.Load(p)); }); auto* src = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } -%f = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 -> %b2 { - %b2 = block { +%f = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } @@ -226,12 +226,12 @@ b.Append(f->Block(), [&] { b.Return(f, b.Load(p)); }); auto* src = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } -%f = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 -> %b2 { - %b2 = block { +%f = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } @@ -241,7 +241,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } @@ -264,12 +264,12 @@ b.Append(f->Block(), [&] { b.Return(f, b.Load(p)); }); auto* src = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } -%f = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 -> %b2 { - %b2 = block { +%f = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } @@ -298,12 +298,12 @@ b.Append(f->Block(), [&] { b.Return(f, b.Load(p)); }); auto* src = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } -%f = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 -> %b2 { - %b2 = block { +%f = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } @@ -312,7 +312,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %keep_me:ptr<private, i32, read_write> = var, 42i } @@ -384,18 +384,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %U:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read> = var @binding_point(0, 0) } -%a = func(%pre:i32, %p:ptr<uniform, vec4<i32>, read>, %post:i32):vec4<i32> -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<uniform, vec4<i32>, read>, %post:i32):vec4<i32> { + $B2: { %6:vec4<i32> = load %p ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %p0:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read> = let %U %p1:ptr<uniform, array<array<vec4<i32>, 8>, 8>, read> = access %p0, 1i %p2:ptr<uniform, array<vec4<i32>, 8>, read> = access %p1, 2i @@ -404,8 +404,8 @@ ret } } -%c = func(%p_1:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read>):void -> %b4 { # %p_1: 'p' - %b4 = block { +%c = func(%p_1:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read>):void { # %p_1: 'p' + $B4: { %p0_1:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read> = let %p_1 # %p0_1: 'p0' %p1_1:ptr<uniform, array<array<vec4<i32>, 8>, 8>, read> = access %p0_1, 1i # %p1_1: 'p1' %p2_1:ptr<uniform, array<vec4<i32>, 8>, read> = access %p1_1, 2i # %p2_1: 'p2' @@ -414,8 +414,8 @@ ret } } -%d = func():void -> %b5 { - %b5 = block { +%d = func():void { + $B5: { %21:void = call %c, %U ret } @@ -426,12 +426,12 @@ auto* expect = R"( -%b1 = block { # root +$B1: { # root %U:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read> = var @binding_point(0, 0) } -%a = func(%pre:i32, %p_indices:array<u32, 3>, %post:i32):vec4<i32> -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p_indices:array<u32, 3>, %post:i32):vec4<i32> { + $B2: { %6:u32 = access %p_indices, 0u %7:u32 = access %p_indices, 1u %8:u32 = access %p_indices, 2u @@ -440,8 +440,8 @@ ret %10 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %12:u32 = convert 3i %13:u32 = convert 2i %14:u32 = convert 1i @@ -450,8 +450,8 @@ ret } } -%c = func():void -> %b4 { - %b4 = block { +%c = func():void { + $B4: { %18:u32 = convert 3i %19:u32 = convert 2i %20:u32 = convert 1i @@ -460,8 +460,8 @@ ret } } -%d = func():void -> %b5 { - %b5 = block { +%d = func():void { + $B5: { %24:void = call %c ret } @@ -539,13 +539,13 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %U:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read> = var @binding_point(0, 0) %i:ptr<private, i32, read_write> = var } -%first = func():i32 -> %b2 { - %b2 = block { +%first = func():i32 { + $B2: { %4:i32 = load %i %5:i32 = add %4, 1i store %i, %5 @@ -553,8 +553,8 @@ ret %6 } } -%second = func():i32 -> %b3 { - %b3 = block { +%second = func():i32 { + $B3: { %8:i32 = load %i %9:i32 = add %8, 1i store %i, %9 @@ -562,8 +562,8 @@ ret %10 } } -%third = func():i32 -> %b4 { - %b4 = block { +%third = func():i32 { + $B4: { %12:i32 = load %i %13:i32 = add %12, 1i store %i, %13 @@ -571,14 +571,14 @@ ret %14 } } -%a = func(%pre:i32, %p:ptr<uniform, vec4<i32>, read>, %post:i32):vec4<i32> -> %b5 { - %b5 = block { +%a = func(%pre:i32, %p:ptr<uniform, vec4<i32>, read>, %post:i32):vec4<i32> { + $B5: { %19:vec4<i32> = load %p ret %19 } } -%b = func():void -> %b6 { - %b6 = block { +%b = func():void { + $B6: { %p0:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read> = let %U %22:i32 = call %first %p1:ptr<uniform, array<array<vec4<i32>, 8>, 8>, read> = access %p0, %22 @@ -589,8 +589,8 @@ ret } } -%c = func(%p_1:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read>):void -> %b7 { # %p_1: 'p' - %b7 = block { +%c = func(%p_1:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read>):void { # %p_1: 'p' + $B7: { %p0_1:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read> = let %p_1 # %p0_1: 'p0' %31:i32 = call %first %p1_1:ptr<uniform, array<array<vec4<i32>, 8>, 8>, read> = access %p0_1, %31 # %p1_1: 'p1' @@ -601,8 +601,8 @@ ret } } -%d = func():void -> %b8 { - %b8 = block { +%d = func():void { + $B8: { %38:void = call %c, %U ret } @@ -612,13 +612,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %U:ptr<uniform, array<array<array<vec4<i32>, 8>, 8>, 8>, read> = var @binding_point(0, 0) %i:ptr<private, i32, read_write> = var } -%first = func():i32 -> %b2 { - %b2 = block { +%first = func():i32 { + $B2: { %4:i32 = load %i %5:i32 = add %4, 1i store %i, %5 @@ -626,8 +626,8 @@ ret %6 } } -%second = func():i32 -> %b3 { - %b3 = block { +%second = func():i32 { + $B3: { %8:i32 = load %i %9:i32 = add %8, 1i store %i, %9 @@ -635,8 +635,8 @@ ret %10 } } -%third = func():i32 -> %b4 { - %b4 = block { +%third = func():i32 { + $B4: { %12:i32 = load %i %13:i32 = add %12, 1i store %i, %13 @@ -644,8 +644,8 @@ ret %14 } } -%a = func(%pre:i32, %p_indices:array<u32, 3>, %post:i32):vec4<i32> -> %b5 { - %b5 = block { +%a = func(%pre:i32, %p_indices:array<u32, 3>, %post:i32):vec4<i32> { + $B5: { %19:u32 = access %p_indices, 0u %20:u32 = access %p_indices, 1u %21:u32 = access %p_indices, 2u @@ -654,8 +654,8 @@ ret %23 } } -%b = func():void -> %b6 { - %b6 = block { +%b = func():void { + $B6: { %25:i32 = call %first %26:i32 = call %second %27:i32 = call %third @@ -667,8 +667,8 @@ ret } } -%c = func():void -> %b7 { - %b7 = block { +%c = func():void { + $B7: { %34:i32 = call %first %35:i32 = call %second %36:i32 = call %third @@ -680,8 +680,8 @@ ret } } -%d = func():void -> %b8 { - %b8 = block { +%d = func():void { + $B8: { %43:void = call %c ret } @@ -726,18 +726,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %U:ptr<uniform, i32, read> = var @binding_point(0, 0) } -%a = func(%pre:i32, %p:ptr<uniform, i32, read>, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<uniform, i32, read>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %8:i32 = call %a, 10i, %U, 20i ret } @@ -747,19 +747,19 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %U:ptr<uniform, i32, read> = var @binding_point(0, 0) } -%a = func(%pre:i32, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %post:i32):i32 { + $B2: { %5:ptr<uniform, i32, read> = access %U %6:i32 = load %5 ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %8:i32 = call %a, 10i, 20i ret } @@ -797,18 +797,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %U:ptr<uniform, array<vec4<i32>, 8>, read> = var @binding_point(0, 0) } -%a = func(%pre:i32, %p:ptr<uniform, vec4<i32>, read>, %post:i32):vec4<i32> -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<uniform, vec4<i32>, read>, %post:i32):vec4<i32> { + $B2: { %6:vec4<i32> = load %p ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %I:i32 = let 3i %9:ptr<uniform, vec4<i32>, read> = access %U, %I %10:vec4<i32> = call %a, 10i, %9, 20i @@ -820,20 +820,20 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %U:ptr<uniform, array<vec4<i32>, 8>, read> = var @binding_point(0, 0) } -%a = func(%pre:i32, %p_indices:array<u32, 1>, %post:i32):vec4<i32> -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p_indices:array<u32, 1>, %post:i32):vec4<i32> { + $B2: { %6:u32 = access %p_indices, 0u %7:ptr<uniform, vec4<i32>, read> = access %U, %6 %8:vec4<i32> = load %7 ret %8 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %I:i32 = let 3i %11:u32 = convert %I %12:array<u32, 1> = construct %11 @@ -952,18 +952,18 @@ mat:mat3x4<f32> @offset(192) } -%b1 = block { # root +$B1: { # root %U:ptr<uniform, Outer, read> = var @binding_point(0, 0) } -%f0 = func(%p:ptr<uniform, vec4<f32>, read>):f32 -> %b2 { - %b2 = block { +%f0 = func(%p:ptr<uniform, vec4<f32>, read>):f32 { + $B2: { %4:f32 = load_vector_element %p, 0u ret %4 } } -%f1 = func(%p_1:ptr<uniform, mat3x4<f32>, read>):f32 -> %b3 { # %p_1: 'p' - %b3 = block { +%f1 = func(%p_1:ptr<uniform, mat3x4<f32>, read>):f32 { # %p_1: 'p' + $B3: { %res:ptr<function, f32, read_write> = var %8:ptr<uniform, vec4<f32>, read> = access %p_1, 1i %9:f32 = call %f0, %8 @@ -989,15 +989,15 @@ ret %24 } } -%f2 = func(%p_2:ptr<uniform, Inner, read>):f32 -> %b4 { # %p_2: 'p' - %b4 = block { +%f2 = func(%p_2:ptr<uniform, Inner, read>):f32 { # %p_2: 'p' + $B4: { %p_mat:ptr<uniform, mat3x4<f32>, read> = access %p_2, 0u %28:f32 = call %f1, %p_mat ret %28 } } -%f3 = func(%p0:ptr<uniform, array<Inner, 4>, read>, %p1:ptr<uniform, mat3x4<f32>, read>):f32 -> %b5 { - %b5 = block { +%f3 = func(%p0:ptr<uniform, array<Inner, 4>, read>, %p1:ptr<uniform, mat3x4<f32>, read>):f32 { + $B5: { %p0_inner:ptr<uniform, Inner, read> = access %p0, 3i %33:f32 = call %f2, %p0_inner %34:f32 = call %f1, %p1 @@ -1005,16 +1005,16 @@ ret %35 } } -%f4 = func(%p_3:ptr<uniform, Outer, read>):f32 -> %b6 { # %p_3: 'p' - %b6 = block { +%f4 = func(%p_3:ptr<uniform, Outer, read>):f32 { # %p_3: 'p' + $B6: { %38:ptr<uniform, array<Inner, 4>, read> = access %p_3, 0u %39:ptr<uniform, mat3x4<f32>, read> = access %U, 1u %40:f32 = call %f3, %38, %39 ret %40 } } -%b = func():void -> %b7 { - %b7 = block { +%b = func():void { + $B7: { %42:f32 = call %f4, %U ret } @@ -1033,20 +1033,20 @@ mat:mat3x4<f32> @offset(192) } -%b1 = block { # root +$B1: { # root %U:ptr<uniform, Outer, read> = var @binding_point(0, 0) } -%f0 = func(%p_indices:array<u32, 1>):f32 -> %b2 { - %b2 = block { +%f0 = func(%p_indices:array<u32, 1>):f32 { + $B2: { %4:u32 = access %p_indices, 0u %5:ptr<uniform, vec4<f32>, read> = access %U, 1u, %4 %6:f32 = load_vector_element %5, 0u ret %6 } } -%f0_1 = func(%p_indices_1:array<u32, 2>):f32 -> %b3 { # %f0_1: 'f0', %p_indices_1: 'p_indices' - %b3 = block { +%f0_1 = func(%p_indices_1:array<u32, 2>):f32 { # %f0_1: 'f0', %p_indices_1: 'p_indices' + $B3: { %9:u32 = access %p_indices_1, 0u %10:u32 = access %p_indices_1, 1u %11:ptr<uniform, vec4<f32>, read> = access %U, 0u, %9, 0u, %10 @@ -1054,8 +1054,8 @@ ret %12 } } -%f1 = func():f32 -> %b4 { - %b4 = block { +%f1 = func():f32 { + $B4: { %res:ptr<function, f32, read_write> = var %15:u32 = convert 1i %16:array<u32, 1> = construct %15 @@ -1087,8 +1087,8 @@ ret %37 } } -%f1_1 = func(%p_indices_2:array<u32, 1>):f32 -> %b5 { # %f1_1: 'f1', %p_indices_2: 'p_indices' - %b5 = block { +%f1_1 = func(%p_indices_2:array<u32, 1>):f32 { # %f1_1: 'f1', %p_indices_2: 'p_indices' + $B5: { %40:u32 = access %p_indices_2, 0u %res_1:ptr<function, f32, read_write> = var # %res_1: 'res' %42:u32 = convert 1i @@ -1121,16 +1121,16 @@ ret %64 } } -%f2 = func(%p_indices_3:array<u32, 1>):f32 -> %b6 { # %p_indices_3: 'p_indices' - %b6 = block { +%f2 = func(%p_indices_3:array<u32, 1>):f32 { # %p_indices_3: 'p_indices' + $B6: { %67:u32 = access %p_indices_3, 0u %68:array<u32, 1> = construct %67 %69:f32 = call %f1_1, %68 ret %69 } } -%f3 = func():f32 -> %b7 { - %b7 = block { +%f3 = func():f32 { + $B7: { %71:u32 = convert 3i %72:array<u32, 1> = construct %71 %73:f32 = call %f2, %72 @@ -1139,14 +1139,14 @@ ret %75 } } -%f4 = func():f32 -> %b8 { - %b8 = block { +%f4 = func():f32 { + $B8: { %77:f32 = call %f3 ret %77 } } -%b = func():void -> %b9 { - %b9 = block { +%b = func():void { + $B9: { %79:f32 = call %f4 ret } @@ -1202,33 +1202,33 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %U:ptr<uniform, array<array<array<vec4<i32>, 5>, 5>, 5>, read> = var @binding_point(0, 0) } -%f2 = func(%p:ptr<uniform, array<vec4<i32>, 5>, read>):vec4<i32> -> %b2 { - %b2 = block { +%f2 = func(%p:ptr<uniform, array<vec4<i32>, 5>, read>):vec4<i32> { + $B2: { %4:ptr<uniform, vec4<i32>, read> = access %p, 3u %5:vec4<i32> = load %4 ret %5 } } -%f1 = func(%p_1:ptr<uniform, array<array<vec4<i32>, 5>, 5>, read>):vec4<i32> -> %b3 { # %p_1: 'p' - %b3 = block { +%f1 = func(%p_1:ptr<uniform, array<array<vec4<i32>, 5>, 5>, read>):vec4<i32> { # %p_1: 'p' + $B3: { %8:ptr<uniform, array<vec4<i32>, 5>, read> = access %p_1, 2u %9:vec4<i32> = call %f2, %8 ret %9 } } -%f0 = func(%p_2:ptr<uniform, array<array<array<vec4<i32>, 5>, 5>, 5>, read>):vec4<i32> -> %b4 { # %p_2: 'p' - %b4 = block { +%f0 = func(%p_2:ptr<uniform, array<array<array<vec4<i32>, 5>, 5>, 5>, read>):vec4<i32> { # %p_2: 'p' + $B4: { %12:ptr<uniform, array<array<vec4<i32>, 5>, 5>, read> = access %p_2, 1u %13:vec4<i32> = call %f1, %12 ret %13 } } -%main = func():void -> %b5 { - %b5 = block { +%main = func():void { + $B5: { %15:vec4<i32> = call %f0, %U ret } @@ -1238,12 +1238,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %U:ptr<uniform, array<array<array<vec4<i32>, 5>, 5>, 5>, read> = var @binding_point(0, 0) } -%f2 = func(%p_indices:array<u32, 2>):vec4<i32> -> %b2 { - %b2 = block { +%f2 = func(%p_indices:array<u32, 2>):vec4<i32> { + $B2: { %4:u32 = access %p_indices, 0u %5:u32 = access %p_indices, 1u %6:ptr<uniform, array<vec4<i32>, 5>, read> = access %U, %4, %5 @@ -1252,23 +1252,23 @@ ret %8 } } -%f1 = func(%p_indices_1:array<u32, 1>):vec4<i32> -> %b3 { # %p_indices_1: 'p_indices' - %b3 = block { +%f1 = func(%p_indices_1:array<u32, 1>):vec4<i32> { # %p_indices_1: 'p_indices' + $B3: { %11:u32 = access %p_indices_1, 0u %12:array<u32, 2> = construct %11, 2u %13:vec4<i32> = call %f2, %12 ret %13 } } -%f0 = func():vec4<i32> -> %b4 { - %b4 = block { +%f0 = func():vec4<i32> { + $B4: { %15:array<u32, 1> = construct 1u %16:vec4<i32> = call %f1, %15 ret %16 } } -%main = func():void -> %b5 { - %b5 = block { +%main = func():void { + $B5: { %18:vec4<i32> = call %f0 ret } @@ -1322,18 +1322,18 @@ i:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %S:ptr<storage, str, read> = var @binding_point(0, 0) } -%a = func(%pre:i32, %p:ptr<storage, i32, read>, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<storage, i32, read>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %8:ptr<storage, i32, read> = access %S, 0u %9:i32 = call %a, 10i, %8, 20i ret @@ -1348,19 +1348,19 @@ i:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %S:ptr<storage, str, read> = var @binding_point(0, 0) } -%a = func(%pre:i32, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %post:i32):i32 { + $B2: { %5:ptr<storage, i32, read> = access %S, 0u %6:i32 = load %5 ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %8:i32 = call %a, 10i, 20i ret } @@ -1409,18 +1409,18 @@ arr:array<i32, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %S:ptr<storage, str, read_write> = var @binding_point(0, 0) } -%a = func(%pre:i32, %p:ptr<storage, array<i32, 4>, read_write>, %post:i32):void -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<storage, array<i32, 4>, read_write>, %post:i32):void { + $B2: { store %p, array<i32, 4>(0i) ret } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %7:ptr<storage, array<i32, 4>, read_write> = access %S, 0u %8:void = call %a, 10i, %7, 20i ret @@ -1435,19 +1435,19 @@ arr:array<i32, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %S:ptr<storage, str, read_write> = var @binding_point(0, 0) } -%a = func(%pre:i32, %post:i32):void -> %b2 { - %b2 = block { +%a = func(%pre:i32, %post:i32):void { + $B2: { %5:ptr<storage, array<i32, 4>, read_write> = access %S, 0u store %5, array<i32, 4>(0i) ret } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %7:void = call %a, 10i, 20i ret } @@ -1488,18 +1488,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %S:ptr<storage, array<vec4<i32>, 8>, read_write> = var @binding_point(0, 0) } -%a = func(%pre:i32, %p:ptr<storage, vec4<i32>, read_write>, %post:i32):void -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<storage, vec4<i32>, read_write>, %post:i32):void { + $B2: { store %p, vec4<i32>(0i) ret } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %I:i32 = let 3i %8:ptr<storage, vec4<i32>, read_write> = access %S, %I %9:void = call %a, 10i, %8, 20i @@ -1511,20 +1511,20 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %S:ptr<storage, array<vec4<i32>, 8>, read_write> = var @binding_point(0, 0) } -%a = func(%pre:i32, %p_indices:array<u32, 1>, %post:i32):void -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p_indices:array<u32, 1>, %post:i32):void { + $B2: { %6:u32 = access %p_indices, 0u %7:ptr<storage, vec4<i32>, read_write> = access %S, %6 store %7, vec4<i32>(0i) ret } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %I:i32 = let 3i %10:u32 = convert %I %11:array<u32, 1> = construct %10 @@ -1643,18 +1643,18 @@ mat:mat3x4<f32> @offset(192) } -%b1 = block { # root +$B1: { # root %S:ptr<storage, Outer, read> = var @binding_point(0, 0) } -%f0 = func(%p:ptr<storage, vec4<f32>, read>):f32 -> %b2 { - %b2 = block { +%f0 = func(%p:ptr<storage, vec4<f32>, read>):f32 { + $B2: { %4:f32 = load_vector_element %p, 0u ret %4 } } -%f1 = func(%p_1:ptr<storage, mat3x4<f32>, read>):f32 -> %b3 { # %p_1: 'p' - %b3 = block { +%f1 = func(%p_1:ptr<storage, mat3x4<f32>, read>):f32 { # %p_1: 'p' + $B3: { %res:ptr<function, f32, read_write> = var %8:ptr<storage, vec4<f32>, read> = access %p_1, 1i %9:f32 = call %f0, %8 @@ -1680,15 +1680,15 @@ ret %24 } } -%f2 = func(%p_2:ptr<storage, Inner, read>):f32 -> %b4 { # %p_2: 'p' - %b4 = block { +%f2 = func(%p_2:ptr<storage, Inner, read>):f32 { # %p_2: 'p' + $B4: { %p_mat:ptr<storage, mat3x4<f32>, read> = access %p_2, 0u %28:f32 = call %f1, %p_mat ret %28 } } -%f3 = func(%p0:ptr<storage, array<Inner, 4>, read>, %p1:ptr<storage, mat3x4<f32>, read>):f32 -> %b5 { - %b5 = block { +%f3 = func(%p0:ptr<storage, array<Inner, 4>, read>, %p1:ptr<storage, mat3x4<f32>, read>):f32 { + $B5: { %p0_inner:ptr<storage, Inner, read> = access %p0, 3i %33:f32 = call %f2, %p0_inner %34:f32 = call %f1, %p1 @@ -1696,16 +1696,16 @@ ret %35 } } -%f4 = func(%p_3:ptr<storage, Outer, read>):f32 -> %b6 { # %p_3: 'p' - %b6 = block { +%f4 = func(%p_3:ptr<storage, Outer, read>):f32 { # %p_3: 'p' + $B6: { %38:ptr<storage, array<Inner, 4>, read> = access %p_3, 0u %39:ptr<storage, mat3x4<f32>, read> = access %S, 1u %40:f32 = call %f3, %38, %39 ret %40 } } -%b = func():void -> %b7 { - %b7 = block { +%b = func():void { + $B7: { %42:f32 = call %f4, %S ret } @@ -1724,20 +1724,20 @@ mat:mat3x4<f32> @offset(192) } -%b1 = block { # root +$B1: { # root %S:ptr<storage, Outer, read> = var @binding_point(0, 0) } -%f0 = func(%p_indices:array<u32, 1>):f32 -> %b2 { - %b2 = block { +%f0 = func(%p_indices:array<u32, 1>):f32 { + $B2: { %4:u32 = access %p_indices, 0u %5:ptr<storage, vec4<f32>, read> = access %S, 1u, %4 %6:f32 = load_vector_element %5, 0u ret %6 } } -%f0_1 = func(%p_indices_1:array<u32, 2>):f32 -> %b3 { # %f0_1: 'f0', %p_indices_1: 'p_indices' - %b3 = block { +%f0_1 = func(%p_indices_1:array<u32, 2>):f32 { # %f0_1: 'f0', %p_indices_1: 'p_indices' + $B3: { %9:u32 = access %p_indices_1, 0u %10:u32 = access %p_indices_1, 1u %11:ptr<storage, vec4<f32>, read> = access %S, 0u, %9, 0u, %10 @@ -1745,8 +1745,8 @@ ret %12 } } -%f1 = func():f32 -> %b4 { - %b4 = block { +%f1 = func():f32 { + $B4: { %res:ptr<function, f32, read_write> = var %15:u32 = convert 1i %16:array<u32, 1> = construct %15 @@ -1778,8 +1778,8 @@ ret %37 } } -%f1_1 = func(%p_indices_2:array<u32, 1>):f32 -> %b5 { # %f1_1: 'f1', %p_indices_2: 'p_indices' - %b5 = block { +%f1_1 = func(%p_indices_2:array<u32, 1>):f32 { # %f1_1: 'f1', %p_indices_2: 'p_indices' + $B5: { %40:u32 = access %p_indices_2, 0u %res_1:ptr<function, f32, read_write> = var # %res_1: 'res' %42:u32 = convert 1i @@ -1812,16 +1812,16 @@ ret %64 } } -%f2 = func(%p_indices_3:array<u32, 1>):f32 -> %b6 { # %p_indices_3: 'p_indices' - %b6 = block { +%f2 = func(%p_indices_3:array<u32, 1>):f32 { # %p_indices_3: 'p_indices' + $B6: { %67:u32 = access %p_indices_3, 0u %68:array<u32, 1> = construct %67 %69:f32 = call %f1_1, %68 ret %69 } } -%f3 = func():f32 -> %b7 { - %b7 = block { +%f3 = func():f32 { + $B7: { %71:u32 = convert 3i %72:array<u32, 1> = construct %71 %73:f32 = call %f2, %72 @@ -1830,14 +1830,14 @@ ret %75 } } -%f4 = func():f32 -> %b8 { - %b8 = block { +%f4 = func():f32 { + $B8: { %77:f32 = call %f3 ret %77 } } -%b = func():void -> %b9 { - %b9 = block { +%b = func():void { + $B9: { %79:f32 = call %f4 ret } @@ -1893,33 +1893,33 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %U:ptr<storage, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write> = var @binding_point(0, 0) } -%f2 = func(%p:ptr<storage, array<vec4<i32>, 5>, read_write>):vec4<i32> -> %b2 { - %b2 = block { +%f2 = func(%p:ptr<storage, array<vec4<i32>, 5>, read_write>):vec4<i32> { + $B2: { %4:ptr<storage, vec4<i32>, read_write> = access %p, 3u %5:vec4<i32> = load %4 ret %5 } } -%f1 = func(%p_1:ptr<storage, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> -> %b3 { # %p_1: 'p' - %b3 = block { +%f1 = func(%p_1:ptr<storage, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> { # %p_1: 'p' + $B3: { %8:ptr<storage, array<vec4<i32>, 5>, read_write> = access %p_1, 2u %9:vec4<i32> = call %f2, %8 ret %9 } } -%f0 = func(%p_2:ptr<storage, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> -> %b4 { # %p_2: 'p' - %b4 = block { +%f0 = func(%p_2:ptr<storage, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> { # %p_2: 'p' + $B4: { %12:ptr<storage, array<array<vec4<i32>, 5>, 5>, read_write> = access %p_2, 1u %13:vec4<i32> = call %f1, %12 ret %13 } } -%main = func():void -> %b5 { - %b5 = block { +%main = func():void { + $B5: { %15:vec4<i32> = call %f0, %U ret } @@ -1929,12 +1929,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %U:ptr<storage, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write> = var @binding_point(0, 0) } -%f2 = func(%p_indices:array<u32, 2>):vec4<i32> -> %b2 { - %b2 = block { +%f2 = func(%p_indices:array<u32, 2>):vec4<i32> { + $B2: { %4:u32 = access %p_indices, 0u %5:u32 = access %p_indices, 1u %6:ptr<storage, array<vec4<i32>, 5>, read_write> = access %U, %4, %5 @@ -1943,23 +1943,23 @@ ret %8 } } -%f1 = func(%p_indices_1:array<u32, 1>):vec4<i32> -> %b3 { # %p_indices_1: 'p_indices' - %b3 = block { +%f1 = func(%p_indices_1:array<u32, 1>):vec4<i32> { # %p_indices_1: 'p_indices' + $B3: { %11:u32 = access %p_indices_1, 0u %12:array<u32, 2> = construct %11, 2u %13:vec4<i32> = call %f2, %12 ret %13 } } -%f0 = func():vec4<i32> -> %b4 { - %b4 = block { +%f0 = func():vec4<i32> { + $B4: { %15:array<u32, 1> = construct 1u %16:vec4<i32> = call %f1, %15 ret %16 } } -%main = func():void -> %b5 { - %b5 = block { +%main = func():void { + $B5: { %18:vec4<i32> = call %f0 ret } @@ -2004,18 +2004,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %W:ptr<workgroup, array<vec4<i32>, 8>, read_write> = var } -%a = func(%pre:i32, %p:ptr<workgroup, vec4<i32>, read_write>, %post:i32):vec4<i32> -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<workgroup, vec4<i32>, read_write>, %post:i32):vec4<i32> { + $B2: { %6:vec4<i32> = load %p ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %8:ptr<workgroup, vec4<i32>, read_write> = access %W, 3i %9:vec4<i32> = call %a, 10i, %8, 20i ret @@ -2026,20 +2026,20 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %W:ptr<workgroup, array<vec4<i32>, 8>, read_write> = var } -%a = func(%pre:i32, %p_indices:array<u32, 1>, %post:i32):vec4<i32> -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p_indices:array<u32, 1>, %post:i32):vec4<i32> { + $B2: { %6:u32 = access %p_indices, 0u %7:ptr<workgroup, vec4<i32>, read_write> = access %W, %6 %8:vec4<i32> = load %7 ret %8 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %10:u32 = convert 3i %11:array<u32, 1> = construct %10 %12:vec4<i32> = call %a, 10i, %11, 20i @@ -2080,18 +2080,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %W:ptr<workgroup, array<vec4<i32>, 8>, read_write> = var } -%a = func(%pre:i32, %p:ptr<workgroup, vec4<i32>, read_write>, %post:i32):void -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<workgroup, vec4<i32>, read_write>, %post:i32):void { + $B2: { store %p, vec4<i32>(0i) ret } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %7:ptr<workgroup, vec4<i32>, read_write> = access %W, 3i %8:void = call %a, 10i, %7, 20i ret @@ -2102,20 +2102,20 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %W:ptr<workgroup, array<vec4<i32>, 8>, read_write> = var } -%a = func(%pre:i32, %p_indices:array<u32, 1>, %post:i32):void -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p_indices:array<u32, 1>, %post:i32):void { + $B2: { %6:u32 = access %p_indices, 0u %7:ptr<workgroup, vec4<i32>, read_write> = access %W, %6 store %7, vec4<i32>(0i) ret } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %9:u32 = convert 3i %10:array<u32, 1> = construct %9 %11:void = call %a, 10i, %10, 20i @@ -2232,18 +2232,18 @@ mat:mat3x4<f32> @offset(192) } -%b1 = block { # root +$B1: { # root %W:ptr<workgroup, Outer, read_write> = var } -%f0 = func(%p:ptr<workgroup, vec4<f32>, read_write>):f32 -> %b2 { - %b2 = block { +%f0 = func(%p:ptr<workgroup, vec4<f32>, read_write>):f32 { + $B2: { %4:f32 = load_vector_element %p, 0u ret %4 } } -%f1 = func(%p_1:ptr<workgroup, mat3x4<f32>, read_write>):f32 -> %b3 { # %p_1: 'p' - %b3 = block { +%f1 = func(%p_1:ptr<workgroup, mat3x4<f32>, read_write>):f32 { # %p_1: 'p' + $B3: { %res:ptr<function, f32, read_write> = var %8:ptr<workgroup, vec4<f32>, read_write> = access %p_1, 1i %9:f32 = call %f0, %8 @@ -2269,15 +2269,15 @@ ret %24 } } -%f2 = func(%p_2:ptr<workgroup, Inner, read_write>):f32 -> %b4 { # %p_2: 'p' - %b4 = block { +%f2 = func(%p_2:ptr<workgroup, Inner, read_write>):f32 { # %p_2: 'p' + $B4: { %p_mat:ptr<workgroup, mat3x4<f32>, read_write> = access %p_2, 0u %28:f32 = call %f1, %p_mat ret %28 } } -%f3 = func(%p0:ptr<workgroup, array<Inner, 4>, read_write>, %p1:ptr<workgroup, mat3x4<f32>, read_write>):f32 -> %b5 { - %b5 = block { +%f3 = func(%p0:ptr<workgroup, array<Inner, 4>, read_write>, %p1:ptr<workgroup, mat3x4<f32>, read_write>):f32 { + $B5: { %p0_inner:ptr<workgroup, Inner, read_write> = access %p0, 3i %33:f32 = call %f2, %p0_inner %34:f32 = call %f1, %p1 @@ -2285,16 +2285,16 @@ ret %35 } } -%f4 = func(%p_3:ptr<workgroup, Outer, read_write>):f32 -> %b6 { # %p_3: 'p' - %b6 = block { +%f4 = func(%p_3:ptr<workgroup, Outer, read_write>):f32 { # %p_3: 'p' + $B6: { %38:ptr<workgroup, array<Inner, 4>, read_write> = access %p_3, 0u %39:ptr<workgroup, mat3x4<f32>, read_write> = access %W, 1u %40:f32 = call %f3, %38, %39 ret %40 } } -%b = func():void -> %b7 { - %b7 = block { +%b = func():void { + $B7: { %42:f32 = call %f4, %W ret } @@ -2313,20 +2313,20 @@ mat:mat3x4<f32> @offset(192) } -%b1 = block { # root +$B1: { # root %W:ptr<workgroup, Outer, read_write> = var } -%f0 = func(%p_indices:array<u32, 1>):f32 -> %b2 { - %b2 = block { +%f0 = func(%p_indices:array<u32, 1>):f32 { + $B2: { %4:u32 = access %p_indices, 0u %5:ptr<workgroup, vec4<f32>, read_write> = access %W, 1u, %4 %6:f32 = load_vector_element %5, 0u ret %6 } } -%f0_1 = func(%p_indices_1:array<u32, 2>):f32 -> %b3 { # %f0_1: 'f0', %p_indices_1: 'p_indices' - %b3 = block { +%f0_1 = func(%p_indices_1:array<u32, 2>):f32 { # %f0_1: 'f0', %p_indices_1: 'p_indices' + $B3: { %9:u32 = access %p_indices_1, 0u %10:u32 = access %p_indices_1, 1u %11:ptr<workgroup, vec4<f32>, read_write> = access %W, 0u, %9, 0u, %10 @@ -2334,8 +2334,8 @@ ret %12 } } -%f1 = func():f32 -> %b4 { - %b4 = block { +%f1 = func():f32 { + $B4: { %res:ptr<function, f32, read_write> = var %15:u32 = convert 1i %16:array<u32, 1> = construct %15 @@ -2367,8 +2367,8 @@ ret %37 } } -%f1_1 = func(%p_indices_2:array<u32, 1>):f32 -> %b5 { # %f1_1: 'f1', %p_indices_2: 'p_indices' - %b5 = block { +%f1_1 = func(%p_indices_2:array<u32, 1>):f32 { # %f1_1: 'f1', %p_indices_2: 'p_indices' + $B5: { %40:u32 = access %p_indices_2, 0u %res_1:ptr<function, f32, read_write> = var # %res_1: 'res' %42:u32 = convert 1i @@ -2401,16 +2401,16 @@ ret %64 } } -%f2 = func(%p_indices_3:array<u32, 1>):f32 -> %b6 { # %p_indices_3: 'p_indices' - %b6 = block { +%f2 = func(%p_indices_3:array<u32, 1>):f32 { # %p_indices_3: 'p_indices' + $B6: { %67:u32 = access %p_indices_3, 0u %68:array<u32, 1> = construct %67 %69:f32 = call %f1_1, %68 ret %69 } } -%f3 = func():f32 -> %b7 { - %b7 = block { +%f3 = func():f32 { + $B7: { %71:u32 = convert 3i %72:array<u32, 1> = construct %71 %73:f32 = call %f2, %72 @@ -2419,14 +2419,14 @@ ret %75 } } -%f4 = func():f32 -> %b8 { - %b8 = block { +%f4 = func():f32 { + $B8: { %77:f32 = call %f3 ret %77 } } -%b = func():void -> %b9 { - %b9 = block { +%b = func():void { + $B9: { %79:f32 = call %f4 ret } @@ -2482,33 +2482,33 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %U:ptr<workgroup, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write> = var @binding_point(0, 0) } -%f2 = func(%p:ptr<workgroup, array<vec4<i32>, 5>, read_write>):vec4<i32> -> %b2 { - %b2 = block { +%f2 = func(%p:ptr<workgroup, array<vec4<i32>, 5>, read_write>):vec4<i32> { + $B2: { %4:ptr<workgroup, vec4<i32>, read_write> = access %p, 3u %5:vec4<i32> = load %4 ret %5 } } -%f1 = func(%p_1:ptr<workgroup, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> -> %b3 { # %p_1: 'p' - %b3 = block { +%f1 = func(%p_1:ptr<workgroup, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> { # %p_1: 'p' + $B3: { %8:ptr<workgroup, array<vec4<i32>, 5>, read_write> = access %p_1, 2u %9:vec4<i32> = call %f2, %8 ret %9 } } -%f0 = func(%p_2:ptr<workgroup, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> -> %b4 { # %p_2: 'p' - %b4 = block { +%f0 = func(%p_2:ptr<workgroup, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> { # %p_2: 'p' + $B4: { %12:ptr<workgroup, array<array<vec4<i32>, 5>, 5>, read_write> = access %p_2, 1u %13:vec4<i32> = call %f1, %12 ret %13 } } -%main = func():void -> %b5 { - %b5 = block { +%main = func():void { + $B5: { %15:vec4<i32> = call %f0, %U ret } @@ -2518,12 +2518,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %U:ptr<workgroup, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write> = var @binding_point(0, 0) } -%f2 = func(%p_indices:array<u32, 2>):vec4<i32> -> %b2 { - %b2 = block { +%f2 = func(%p_indices:array<u32, 2>):vec4<i32> { + $B2: { %4:u32 = access %p_indices, 0u %5:u32 = access %p_indices, 1u %6:ptr<workgroup, array<vec4<i32>, 5>, read_write> = access %U, %4, %5 @@ -2532,23 +2532,23 @@ ret %8 } } -%f1 = func(%p_indices_1:array<u32, 1>):vec4<i32> -> %b3 { # %p_indices_1: 'p_indices' - %b3 = block { +%f1 = func(%p_indices_1:array<u32, 1>):vec4<i32> { # %p_indices_1: 'p_indices' + $B3: { %11:u32 = access %p_indices_1, 0u %12:array<u32, 2> = construct %11, 2u %13:vec4<i32> = call %f2, %12 ret %13 } } -%f0 = func():vec4<i32> -> %b4 { - %b4 = block { +%f0 = func():vec4<i32> { + $B4: { %15:array<u32, 1> = construct 1u %16:vec4<i32> = call %f1, %15 ret %16 } } -%main = func():void -> %b5 { - %b5 = block { +%main = func():void { + $B5: { %18:vec4<i32> = call %f0 ret } @@ -2592,18 +2592,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %P:ptr<private, i32, read_write> = var } -%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %8:i32 = call %a, 10i, %P, 20i ret } @@ -2613,19 +2613,19 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %P:ptr<private, i32, read_write> = var } -%a = func(%pre:i32, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %post:i32):i32 { + $B2: { %5:ptr<private, i32, read_write> = access %P %6:i32 = load %5 ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %8:i32 = call %a, 10i, 20i ret } @@ -2663,18 +2663,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %P:ptr<private, i32, read_write> = var } -%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):void -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):void { + $B2: { store %p, 42i ret } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %7:void = call %a, 10i, %P, 20i ret } @@ -2684,19 +2684,19 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %P:ptr<private, i32, read_write> = var } -%a = func(%pre:i32, %post:i32):void -> %b2 { - %b2 = block { +%a = func(%pre:i32, %post:i32):void { + $B2: { %5:ptr<private, i32, read_write> = access %P store %5, 42i ret } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %7:void = call %a, 10i, 20i ret } @@ -2740,18 +2740,18 @@ i:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %P:ptr<private, str, read_write> = var } -%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %8:ptr<private, i32, read_write> = access %P, 0u %9:i32 = call %a, 10i, %8, 20i ret @@ -2766,19 +2766,19 @@ i:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %P:ptr<private, str, read_write> = var } -%a = func(%pre:i32, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %post:i32):i32 { + $B2: { %5:ptr<private, i32, read_write> = access %P, 0u %6:i32 = load %5 ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %8:i32 = call %a, 10i, 20i ret } @@ -2822,18 +2822,18 @@ i:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %P:ptr<private, str, read_write> = var } -%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 { + $B2: { %6:i32 = load %p ret %6 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %8:ptr<private, i32, read_write> = access %P, 0u %9:i32 = call %a, 10i, %8, 20i ret @@ -2886,18 +2886,18 @@ arr:array<i32, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %P:ptr<private, str, read_write> = var } -%a = func(%pre:i32, %p:ptr<private, array<i32, 4>, read_write>, %post:i32):void -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<private, array<i32, 4>, read_write>, %post:i32):void { + $B2: { store %p, array<i32, 4>(0i) ret } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %7:ptr<private, array<i32, 4>, read_write> = access %P, 0u %8:void = call %a, 10i, %7, 20i ret @@ -2912,19 +2912,19 @@ arr:array<i32, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %P:ptr<private, str, read_write> = var } -%a = func(%pre:i32, %post:i32):void -> %b2 { - %b2 = block { +%a = func(%pre:i32, %post:i32):void { + $B2: { %5:ptr<private, array<i32, 4>, read_write> = access %P, 0u store %5, array<i32, 4>(0i) ret } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %7:void = call %a, 10i, 20i ret } @@ -2972,18 +2972,18 @@ arr:array<i32, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %P:ptr<private, str, read_write> = var } -%a = func(%pre:i32, %p:ptr<private, array<i32, 4>, read_write>, %post:i32):void -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<private, array<i32, 4>, read_write>, %post:i32):void { + $B2: { store %p, array<i32, 4>(0i) ret } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %7:ptr<private, array<i32, 4>, read_write> = access %P, 0u %8:void = call %a, 10i, %7, 20i ret @@ -3045,20 +3045,20 @@ i:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %Pi:ptr<private, i32, read_write> = var %Ps:ptr<private, str, read_write> = var %Pa:ptr<private, array<i32, 4>, read_write> = var } -%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 { + $B2: { %8:i32 = load %p ret %8 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %10:i32 = call %a, 10i, %Pi, 20i %11:ptr<private, i32, read_write> = access %Ps, 0u %12:i32 = call %a, 30i, %11, 40i @@ -3076,36 +3076,36 @@ i:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %Pi:ptr<private, i32, read_write> = var %Ps:ptr<private, str, read_write> = var %Pa:ptr<private, array<i32, 4>, read_write> = var } -%a = func(%pre:i32, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %post:i32):i32 { + $B2: { %7:ptr<private, i32, read_write> = access %Pi %8:i32 = load %7 ret %8 } } -%a_1 = func(%pre_1:i32, %post_1:i32):i32 -> %b3 { # %a_1: 'a', %pre_1: 'pre', %post_1: 'post' - %b3 = block { +%a_1 = func(%pre_1:i32, %post_1:i32):i32 { # %a_1: 'a', %pre_1: 'pre', %post_1: 'post' + $B3: { %12:ptr<private, i32, read_write> = access %Ps, 0u %13:i32 = load %12 ret %13 } } -%a_2 = func(%pre_2:i32, %p_indices:array<u32, 1>, %post_2:i32):i32 -> %b4 { # %a_2: 'a', %pre_2: 'pre', %post_2: 'post' - %b4 = block { +%a_2 = func(%pre_2:i32, %p_indices:array<u32, 1>, %post_2:i32):i32 { # %a_2: 'a', %pre_2: 'pre', %post_2: 'post' + $B4: { %18:u32 = access %p_indices, 0u %19:ptr<private, i32, read_write> = access %Pa, %18 %20:i32 = load %19 ret %20 } } -%b = func():void -> %b5 { - %b5 = block { +%b = func():void { + $B5: { %22:i32 = call %a, 10i, 20i %23:i32 = call %a_1, 30i, 40i %24:u32 = convert 2i @@ -3166,20 +3166,20 @@ i:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %Pi:ptr<private, i32, read_write> = var %Ps:ptr<private, str, read_write> = var %Pa:ptr<private, array<i32, 4>, read_write> = var } -%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %p:ptr<private, i32, read_write>, %post:i32):i32 { + $B2: { %8:i32 = load %p ret %8 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %10:i32 = call %a, 10i, %Pi, 20i %11:ptr<private, i32, read_write> = access %Ps, 0u %12:i32 = call %a, 30i, %11, 40i @@ -3302,18 +3302,18 @@ mat:mat3x4<f32> @offset(192) } -%b1 = block { # root +$B1: { # root %P:ptr<private, Outer, read_write> = var } -%f0 = func(%p:ptr<private, vec4<f32>, read_write>):f32 -> %b2 { - %b2 = block { +%f0 = func(%p:ptr<private, vec4<f32>, read_write>):f32 { + $B2: { %4:f32 = load_vector_element %p, 0u ret %4 } } -%f1 = func(%p_1:ptr<private, mat3x4<f32>, read_write>):f32 -> %b3 { # %p_1: 'p' - %b3 = block { +%f1 = func(%p_1:ptr<private, mat3x4<f32>, read_write>):f32 { # %p_1: 'p' + $B3: { %res:ptr<function, f32, read_write> = var %8:ptr<private, vec4<f32>, read_write> = access %p_1, 1i %9:f32 = call %f0, %8 @@ -3339,15 +3339,15 @@ ret %24 } } -%f2 = func(%p_2:ptr<private, Inner, read_write>):f32 -> %b4 { # %p_2: 'p' - %b4 = block { +%f2 = func(%p_2:ptr<private, Inner, read_write>):f32 { # %p_2: 'p' + $B4: { %p_mat:ptr<private, mat3x4<f32>, read_write> = access %p_2, 0u %28:f32 = call %f1, %p_mat ret %28 } } -%f3 = func(%p0:ptr<private, array<Inner, 4>, read_write>, %p1:ptr<private, mat3x4<f32>, read_write>):f32 -> %b5 { - %b5 = block { +%f3 = func(%p0:ptr<private, array<Inner, 4>, read_write>, %p1:ptr<private, mat3x4<f32>, read_write>):f32 { + $B5: { %p0_inner:ptr<private, Inner, read_write> = access %p0, 3i %33:f32 = call %f2, %p0_inner %34:f32 = call %f1, %p1 @@ -3355,16 +3355,16 @@ ret %35 } } -%f4 = func(%p_3:ptr<private, Outer, read_write>):f32 -> %b6 { # %p_3: 'p' - %b6 = block { +%f4 = func(%p_3:ptr<private, Outer, read_write>):f32 { # %p_3: 'p' + $B6: { %38:ptr<private, array<Inner, 4>, read_write> = access %p_3, 0u %39:ptr<private, mat3x4<f32>, read_write> = access %P, 1u %40:f32 = call %f3, %38, %39 ret %40 } } -%b = func():void -> %b7 { - %b7 = block { +%b = func():void { + $B7: { %42:f32 = call %f4, %P ret } @@ -3383,20 +3383,20 @@ mat:mat3x4<f32> @offset(192) } -%b1 = block { # root +$B1: { # root %P:ptr<private, Outer, read_write> = var } -%f0 = func(%p_indices:array<u32, 1>):f32 -> %b2 { - %b2 = block { +%f0 = func(%p_indices:array<u32, 1>):f32 { + $B2: { %4:u32 = access %p_indices, 0u %5:ptr<private, vec4<f32>, read_write> = access %P, 1u, %4 %6:f32 = load_vector_element %5, 0u ret %6 } } -%f0_1 = func(%p_indices_1:array<u32, 2>):f32 -> %b3 { # %f0_1: 'f0', %p_indices_1: 'p_indices' - %b3 = block { +%f0_1 = func(%p_indices_1:array<u32, 2>):f32 { # %f0_1: 'f0', %p_indices_1: 'p_indices' + $B3: { %9:u32 = access %p_indices_1, 0u %10:u32 = access %p_indices_1, 1u %11:ptr<private, vec4<f32>, read_write> = access %P, 0u, %9, 0u, %10 @@ -3404,8 +3404,8 @@ ret %12 } } -%f1 = func():f32 -> %b4 { - %b4 = block { +%f1 = func():f32 { + $B4: { %res:ptr<function, f32, read_write> = var %15:u32 = convert 1i %16:array<u32, 1> = construct %15 @@ -3437,8 +3437,8 @@ ret %37 } } -%f1_1 = func(%p_indices_2:array<u32, 1>):f32 -> %b5 { # %f1_1: 'f1', %p_indices_2: 'p_indices' - %b5 = block { +%f1_1 = func(%p_indices_2:array<u32, 1>):f32 { # %f1_1: 'f1', %p_indices_2: 'p_indices' + $B5: { %40:u32 = access %p_indices_2, 0u %res_1:ptr<function, f32, read_write> = var # %res_1: 'res' %42:u32 = convert 1i @@ -3471,16 +3471,16 @@ ret %64 } } -%f2 = func(%p_indices_3:array<u32, 1>):f32 -> %b6 { # %p_indices_3: 'p_indices' - %b6 = block { +%f2 = func(%p_indices_3:array<u32, 1>):f32 { # %p_indices_3: 'p_indices' + $B6: { %67:u32 = access %p_indices_3, 0u %68:array<u32, 1> = construct %67 %69:f32 = call %f1_1, %68 ret %69 } } -%f3 = func():f32 -> %b7 { - %b7 = block { +%f3 = func():f32 { + $B7: { %71:u32 = convert 3i %72:array<u32, 1> = construct %71 %73:f32 = call %f2, %72 @@ -3489,14 +3489,14 @@ ret %75 } } -%f4 = func():f32 -> %b8 { - %b8 = block { +%f4 = func():f32 { + $B8: { %77:f32 = call %f3 ret %77 } } -%b = func():void -> %b9 { - %b9 = block { +%b = func():void { + $B9: { %79:f32 = call %f4 ret } @@ -3611,18 +3611,18 @@ mat:mat3x4<f32> @offset(192) } -%b1 = block { # root +$B1: { # root %P:ptr<private, Outer, read_write> = var } -%f0 = func(%p:ptr<private, vec4<f32>, read_write>):f32 -> %b2 { - %b2 = block { +%f0 = func(%p:ptr<private, vec4<f32>, read_write>):f32 { + $B2: { %4:f32 = load_vector_element %p, 0u ret %4 } } -%f1 = func(%p_1:ptr<private, mat3x4<f32>, read_write>):f32 -> %b3 { # %p_1: 'p' - %b3 = block { +%f1 = func(%p_1:ptr<private, mat3x4<f32>, read_write>):f32 { # %p_1: 'p' + $B3: { %res:ptr<function, f32, read_write> = var %8:ptr<private, vec4<f32>, read_write> = access %p_1, 1i %9:f32 = call %f0, %8 @@ -3648,15 +3648,15 @@ ret %24 } } -%f2 = func(%p_2:ptr<private, Inner, read_write>):f32 -> %b4 { # %p_2: 'p' - %b4 = block { +%f2 = func(%p_2:ptr<private, Inner, read_write>):f32 { # %p_2: 'p' + $B4: { %p_mat:ptr<private, mat3x4<f32>, read_write> = access %p_2, 0u %28:f32 = call %f1, %p_mat ret %28 } } -%f3 = func(%p0:ptr<private, array<Inner, 4>, read_write>, %p1:ptr<private, mat3x4<f32>, read_write>):f32 -> %b5 { - %b5 = block { +%f3 = func(%p0:ptr<private, array<Inner, 4>, read_write>, %p1:ptr<private, mat3x4<f32>, read_write>):f32 { + $B5: { %p0_inner:ptr<private, Inner, read_write> = access %p0, 3i %33:f32 = call %f2, %p0_inner %34:f32 = call %f1, %p1 @@ -3664,16 +3664,16 @@ ret %35 } } -%f4 = func(%p_3:ptr<private, Outer, read_write>):f32 -> %b6 { # %p_3: 'p' - %b6 = block { +%f4 = func(%p_3:ptr<private, Outer, read_write>):f32 { # %p_3: 'p' + $B6: { %38:ptr<private, array<Inner, 4>, read_write> = access %p_3, 0u %39:ptr<private, mat3x4<f32>, read_write> = access %P, 1u %40:f32 = call %f3, %38, %39 ret %40 } } -%b = func():void -> %b7 { - %b7 = block { +%b = func():void { + $B7: { %42:f32 = call %f4, %P ret } @@ -3733,33 +3733,33 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %P:ptr<private, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write> = var } -%f2 = func(%p:ptr<private, array<vec4<i32>, 5>, read_write>):vec4<i32> -> %b2 { - %b2 = block { +%f2 = func(%p:ptr<private, array<vec4<i32>, 5>, read_write>):vec4<i32> { + $B2: { %4:ptr<private, vec4<i32>, read_write> = access %p, 3u %5:vec4<i32> = load %4 ret %5 } } -%f1 = func(%p_1:ptr<private, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> -> %b3 { # %p_1: 'p' - %b3 = block { +%f1 = func(%p_1:ptr<private, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> { # %p_1: 'p' + $B3: { %8:ptr<private, array<vec4<i32>, 5>, read_write> = access %p_1, 2u %9:vec4<i32> = call %f2, %8 ret %9 } } -%f0 = func(%p_2:ptr<private, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> -> %b4 { # %p_2: 'p' - %b4 = block { +%f0 = func(%p_2:ptr<private, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> { # %p_2: 'p' + $B4: { %12:ptr<private, array<array<vec4<i32>, 5>, 5>, read_write> = access %p_2, 1u %13:vec4<i32> = call %f1, %12 ret %13 } } -%main = func():void -> %b5 { - %b5 = block { +%main = func():void { + $B5: { %15:vec4<i32> = call %f0, %P ret } @@ -3769,12 +3769,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %P:ptr<private, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write> = var } -%f2 = func(%p_indices:array<u32, 2>):vec4<i32> -> %b2 { - %b2 = block { +%f2 = func(%p_indices:array<u32, 2>):vec4<i32> { + $B2: { %4:u32 = access %p_indices, 0u %5:u32 = access %p_indices, 1u %6:ptr<private, array<vec4<i32>, 5>, read_write> = access %P, %4, %5 @@ -3783,23 +3783,23 @@ ret %8 } } -%f1 = func(%p_indices_1:array<u32, 1>):vec4<i32> -> %b3 { # %p_indices_1: 'p_indices' - %b3 = block { +%f1 = func(%p_indices_1:array<u32, 1>):vec4<i32> { # %p_indices_1: 'p_indices' + $B3: { %11:u32 = access %p_indices_1, 0u %12:array<u32, 2> = construct %11, 2u %13:vec4<i32> = call %f2, %12 ret %13 } } -%f0 = func():vec4<i32> -> %b4 { - %b4 = block { +%f0 = func():vec4<i32> { + $B4: { %15:array<u32, 1> = construct 1u %16:vec4<i32> = call %f1, %15 ret %16 } } -%main = func():void -> %b5 { - %b5 = block { +%main = func():void { + $B5: { %18:vec4<i32> = call %f0 ret } @@ -3855,33 +3855,33 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %P:ptr<private, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write> = var } -%f2 = func(%p:ptr<private, array<vec4<i32>, 5>, read_write>):vec4<i32> -> %b2 { - %b2 = block { +%f2 = func(%p:ptr<private, array<vec4<i32>, 5>, read_write>):vec4<i32> { + $B2: { %4:ptr<private, vec4<i32>, read_write> = access %p, 3u %5:vec4<i32> = load %4 ret %5 } } -%f1 = func(%p_1:ptr<private, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> -> %b3 { # %p_1: 'p' - %b3 = block { +%f1 = func(%p_1:ptr<private, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> { # %p_1: 'p' + $B3: { %8:ptr<private, array<vec4<i32>, 5>, read_write> = access %p_1, 2u %9:vec4<i32> = call %f2, %8 ret %9 } } -%f0 = func(%p_2:ptr<private, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> -> %b4 { # %p_2: 'p' - %b4 = block { +%f0 = func(%p_2:ptr<private, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> { # %p_2: 'p' + $B4: { %12:ptr<private, array<array<vec4<i32>, 5>, 5>, read_write> = access %p_2, 1u %13:vec4<i32> = call %f1, %12 ret %13 } } -%main = func():void -> %b5 { - %b5 = block { +%main = func():void { + $B5: { %15:vec4<i32> = call %f0, %P ret } @@ -3916,8 +3916,8 @@ }); auto* src = R"( -%f = func():void -> %b1 { - %b1 = block { +%f = func():void { + $B1: { %v:ptr<function, i32, read_write> = var %p:ptr<function, i32, read_write> = let %v %4:i32 = load %p @@ -3954,14 +3954,14 @@ }); auto* src = R"( -%a = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 { + $B1: { %5:i32 = load %p ret %5 } } -%b = func():void -> %b2 { - %b2 = block { +%b = func():void { + $B2: { %F:ptr<function, i32, read_write> = var %8:i32 = call %a, 10i, %F, 20i ret @@ -3972,15 +3972,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%pre:i32, %p_root:ptr<function, i32, read_write>, %post:i32):i32 -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p_root:ptr<function, i32, read_write>, %post:i32):i32 { + $B1: { %5:ptr<function, i32, read_write> = access %p_root %6:i32 = load %5 ret %6 } } -%b = func():void -> %b2 { - %b2 = block { +%b = func():void { + $B2: { %F:ptr<function, i32, read_write> = var %9:i32 = call %a, 10i, %F, 20i ret @@ -4014,14 +4014,14 @@ }); auto* src = R"( -%a = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):void -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):void { + $B1: { store %p, 42i ret } } -%b = func():void -> %b2 { - %b2 = block { +%b = func():void { + $B2: { %F:ptr<function, i32, read_write> = var %7:void = call %a, 10i, %F, 20i ret @@ -4032,15 +4032,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%pre:i32, %p_root:ptr<function, i32, read_write>, %post:i32):void -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p_root:ptr<function, i32, read_write>, %post:i32):void { + $B1: { %5:ptr<function, i32, read_write> = access %p_root store %5, 42i ret } } -%b = func():void -> %b2 { - %b2 = block { +%b = func():void { + $B2: { %F:ptr<function, i32, read_write> = var %8:void = call %a, 10i, %F, 20i ret @@ -4080,14 +4080,14 @@ i:i32 @offset(0) } -%a = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 { + $B1: { %5:i32 = load %p ret %5 } } -%b = func():void -> %b2 { - %b2 = block { +%b = func():void { + $B2: { %F:ptr<function, str, read_write> = var %8:ptr<function, i32, read_write> = access %F, 0u %9:i32 = call %a, 10i, %8, 20i @@ -4103,15 +4103,15 @@ i:i32 @offset(0) } -%a = func(%pre:i32, %p_root:ptr<function, str, read_write>, %post:i32):i32 -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p_root:ptr<function, str, read_write>, %post:i32):i32 { + $B1: { %5:ptr<function, i32, read_write> = access %p_root, 0u %6:i32 = load %5 ret %6 } } -%b = func():void -> %b2 { - %b2 = block { +%b = func():void { + $B2: { %F:ptr<function, str, read_write> = var %9:i32 = call %a, 10i, %F, 20i ret @@ -4155,14 +4155,14 @@ arr:array<i32, 4> @offset(0) } -%a = func(%pre:i32, %p:ptr<function, array<i32, 4>, read_write>, %post:i32):void -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p:ptr<function, array<i32, 4>, read_write>, %post:i32):void { + $B1: { store %p, array<i32, 4>(0i) ret } } -%b = func():void -> %b2 { - %b2 = block { +%b = func():void { + $B2: { %F:ptr<function, str, read_write> = var %7:ptr<function, array<i32, 4>, read_write> = access %F, 0u %8:void = call %a, 10i, %7, 20i @@ -4178,15 +4178,15 @@ arr:array<i32, 4> @offset(0) } -%a = func(%pre:i32, %p_root:ptr<function, str, read_write>, %post:i32):void -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p_root:ptr<function, str, read_write>, %post:i32):void { + $B1: { %5:ptr<function, array<i32, 4>, read_write> = access %p_root, 0u store %5, array<i32, 4>(0i) ret } } -%b = func():void -> %b2 { - %b2 = block { +%b = func():void { + $B2: { %F:ptr<function, str, read_write> = var %8:void = call %a, 10i, %F, 20i ret @@ -4237,14 +4237,14 @@ i:i32 @offset(0) } -%a = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 { + $B1: { %5:i32 = load %p ret %5 } } -%b = func():void -> %b2 { - %b2 = block { +%b = func():void { + $B2: { %Fi:ptr<function, i32, read_write> = var %Fs:ptr<function, str, read_write> = var %Fa:ptr<function, array<i32, 4>, read_write> = var @@ -4265,30 +4265,30 @@ i:i32 @offset(0) } -%a = func(%pre:i32, %p_root:ptr<function, i32, read_write>, %post:i32):i32 -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p_root:ptr<function, i32, read_write>, %post:i32):i32 { + $B1: { %5:ptr<function, i32, read_write> = access %p_root %6:i32 = load %5 ret %6 } } -%a_1 = func(%pre_1:i32, %p_root_1:ptr<function, str, read_write>, %post_1:i32):i32 -> %b2 { # %a_1: 'a', %pre_1: 'pre', %p_root_1: 'p_root', %post_1: 'post' - %b2 = block { +%a_1 = func(%pre_1:i32, %p_root_1:ptr<function, str, read_write>, %post_1:i32):i32 { # %a_1: 'a', %pre_1: 'pre', %p_root_1: 'p_root', %post_1: 'post' + $B2: { %11:ptr<function, i32, read_write> = access %p_root_1, 0u %12:i32 = load %11 ret %12 } } -%a_2 = func(%pre_2:i32, %p_root_2:ptr<function, array<i32, 4>, read_write>, %p_indices:array<u32, 1>, %post_2:i32):i32 -> %b3 { # %a_2: 'a', %pre_2: 'pre', %p_root_2: 'p_root', %post_2: 'post' - %b3 = block { +%a_2 = func(%pre_2:i32, %p_root_2:ptr<function, array<i32, 4>, read_write>, %p_indices:array<u32, 1>, %post_2:i32):i32 { # %a_2: 'a', %pre_2: 'pre', %p_root_2: 'p_root', %post_2: 'post' + $B3: { %18:u32 = access %p_indices, 0u %19:ptr<function, i32, read_write> = access %p_root_2, %18 %20:i32 = load %19 ret %20 } } -%b = func():void -> %b4 { - %b4 = block { +%b = func():void { + $B4: { %Fi:ptr<function, i32, read_write> = var %Fs:ptr<function, str, read_write> = var %Fa:ptr<function, array<i32, 4>, read_write> = var @@ -4334,14 +4334,14 @@ i:i32 @offset(0) } -%a = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p:ptr<function, i32, read_write>, %post:i32):i32 { + $B1: { %5:i32 = load %p ret %5 } } -%b = func():void -> %b2 { - %b2 = block { +%b = func():void { + $B2: { %F:ptr<function, str, read_write> = var %8:ptr<function, i32, read_write> = access %F, 0u %9:i32 = call %a, 10i, %8, 20i @@ -4390,14 +4390,14 @@ arr:array<i32, 4> @offset(0) } -%a = func(%pre:i32, %p:ptr<function, array<i32, 4>, read_write>, %post:i32):void -> %b1 { - %b1 = block { +%a = func(%pre:i32, %p:ptr<function, array<i32, 4>, read_write>, %post:i32):void { + $B1: { store %p, array<i32, 4>(0i) ret } } -%b = func():void -> %b2 { - %b2 = block { +%b = func():void { + $B2: { %F:ptr<function, str, read_write> = var %7:ptr<function, array<i32, 4>, read_write> = access %F, 0u %8:void = call %a, 10i, %7, 20i @@ -4505,14 +4505,14 @@ mat:mat3x4<f32> @offset(192) } -%f0 = func(%p:ptr<function, vec4<f32>, read_write>):f32 -> %b1 { - %b1 = block { +%f0 = func(%p:ptr<function, vec4<f32>, read_write>):f32 { + $B1: { %3:f32 = load_vector_element %p, 0u ret %3 } } -%f1 = func(%p_1:ptr<function, mat3x4<f32>, read_write>):f32 -> %b2 { # %p_1: 'p' - %b2 = block { +%f1 = func(%p_1:ptr<function, mat3x4<f32>, read_write>):f32 { # %p_1: 'p' + $B2: { %res:ptr<function, f32, read_write> = var %7:ptr<function, vec4<f32>, read_write> = access %p_1, 1i %8:f32 = call %f0, %7 @@ -4528,29 +4528,29 @@ ret %15 } } -%f2 = func(%p_2:ptr<function, Inner, read_write>):f32 -> %b3 { # %p_2: 'p' - %b3 = block { +%f2 = func(%p_2:ptr<function, Inner, read_write>):f32 { # %p_2: 'p' + $B3: { %p_mat:ptr<function, mat3x4<f32>, read_write> = access %p_2, 0u %19:f32 = call %f1, %p_mat ret %19 } } -%f3 = func(%p_3:ptr<function, array<Inner, 4>, read_write>):f32 -> %b4 { # %p_3: 'p' - %b4 = block { +%f3 = func(%p_3:ptr<function, array<Inner, 4>, read_write>):f32 { # %p_3: 'p' + $B4: { %p_inner:ptr<function, Inner, read_write> = access %p_3, 3i %23:f32 = call %f2, %p_inner ret %23 } } -%f4 = func(%p_4:ptr<function, Outer, read_write>):f32 -> %b5 { # %p_4: 'p' - %b5 = block { +%f4 = func(%p_4:ptr<function, Outer, read_write>):f32 { # %p_4: 'p' + $B5: { %26:ptr<function, array<Inner, 4>, read_write> = access %p_4, 0u %27:f32 = call %f3, %26 ret %27 } } -%b = func():void -> %b6 { - %b6 = block { +%b = func():void { + $B6: { %F:ptr<function, Outer, read_write> = var %30:f32 = call %f4, %F ret @@ -4570,8 +4570,8 @@ mat:mat3x4<f32> @offset(192) } -%f0 = func(%p_root:ptr<function, Outer, read_write>, %p_indices:array<u32, 2>):f32 -> %b1 { - %b1 = block { +%f0 = func(%p_root:ptr<function, Outer, read_write>, %p_indices:array<u32, 2>):f32 { + $B1: { %4:u32 = access %p_indices, 0u %5:u32 = access %p_indices, 1u %6:ptr<function, vec4<f32>, read_write> = access %p_root, 0u, %4, 0u, %5 @@ -4579,8 +4579,8 @@ ret %7 } } -%f1 = func(%p_root_1:ptr<function, Outer, read_write>, %p_indices_1:array<u32, 1>):f32 -> %b2 { # %p_root_1: 'p_root', %p_indices_1: 'p_indices' - %b2 = block { +%f1 = func(%p_root_1:ptr<function, Outer, read_write>, %p_indices_1:array<u32, 1>):f32 { # %p_root_1: 'p_root', %p_indices_1: 'p_indices' + $B2: { %11:u32 = access %p_indices_1, 0u %res:ptr<function, f32, read_write> = var %13:u32 = convert 1i @@ -4599,30 +4599,30 @@ ret %23 } } -%f2 = func(%p_root_2:ptr<function, Outer, read_write>, %p_indices_2:array<u32, 1>):f32 -> %b3 { # %p_root_2: 'p_root', %p_indices_2: 'p_indices' - %b3 = block { +%f2 = func(%p_root_2:ptr<function, Outer, read_write>, %p_indices_2:array<u32, 1>):f32 { # %p_root_2: 'p_root', %p_indices_2: 'p_indices' + $B3: { %27:u32 = access %p_indices_2, 0u %28:array<u32, 1> = construct %27 %29:f32 = call %f1, %p_root_2, %28 ret %29 } } -%f3 = func(%p_root_3:ptr<function, Outer, read_write>):f32 -> %b4 { # %p_root_3: 'p_root' - %b4 = block { +%f3 = func(%p_root_3:ptr<function, Outer, read_write>):f32 { # %p_root_3: 'p_root' + $B4: { %32:u32 = convert 3i %33:array<u32, 1> = construct %32 %34:f32 = call %f2, %p_root_3, %33 ret %34 } } -%f4 = func(%p_root_4:ptr<function, Outer, read_write>):f32 -> %b5 { # %p_root_4: 'p_root' - %b5 = block { +%f4 = func(%p_root_4:ptr<function, Outer, read_write>):f32 { # %p_root_4: 'p_root' + $B5: { %37:f32 = call %f3, %p_root_4 ret %37 } } -%b = func():void -> %b6 { - %b6 = block { +%b = func():void { + $B6: { %F:ptr<function, Outer, read_write> = var %40:f32 = call %f4, %F ret @@ -4725,14 +4725,14 @@ mat:mat3x4<f32> @offset(192) } -%f0 = func(%p:ptr<function, vec4<f32>, read_write>):f32 -> %b1 { - %b1 = block { +%f0 = func(%p:ptr<function, vec4<f32>, read_write>):f32 { + $B1: { %3:f32 = load_vector_element %p, 0u ret %3 } } -%f1 = func(%p_1:ptr<function, mat3x4<f32>, read_write>):f32 -> %b2 { # %p_1: 'p' - %b2 = block { +%f1 = func(%p_1:ptr<function, mat3x4<f32>, read_write>):f32 { # %p_1: 'p' + $B2: { %res:ptr<function, f32, read_write> = var %7:ptr<function, vec4<f32>, read_write> = access %p_1, 1i %8:f32 = call %f0, %7 @@ -4748,29 +4748,29 @@ ret %15 } } -%f2 = func(%p_2:ptr<function, Inner, read_write>):f32 -> %b3 { # %p_2: 'p' - %b3 = block { +%f2 = func(%p_2:ptr<function, Inner, read_write>):f32 { # %p_2: 'p' + $B3: { %p_mat:ptr<function, mat3x4<f32>, read_write> = access %p_2, 0u %19:f32 = call %f1, %p_mat ret %19 } } -%f3 = func(%p_3:ptr<function, array<Inner, 4>, read_write>):f32 -> %b4 { # %p_3: 'p' - %b4 = block { +%f3 = func(%p_3:ptr<function, array<Inner, 4>, read_write>):f32 { # %p_3: 'p' + $B4: { %p_inner:ptr<function, Inner, read_write> = access %p_3, 3i %23:f32 = call %f2, %p_inner ret %23 } } -%f4 = func(%p_4:ptr<function, Outer, read_write>):f32 -> %b5 { # %p_4: 'p' - %b5 = block { +%f4 = func(%p_4:ptr<function, Outer, read_write>):f32 { # %p_4: 'p' + $B5: { %26:ptr<function, array<Inner, 4>, read_write> = access %p_4, 0u %27:f32 = call %f3, %26 ret %27 } } -%b = func():void -> %b6 { - %b6 = block { +%b = func():void { + $B6: { %F:ptr<function, Outer, read_write> = var %30:f32 = call %f4, %F ret @@ -4826,29 +4826,29 @@ }); auto* src = R"( -%f2 = func(%p:ptr<function, array<vec4<i32>, 5>, read_write>):vec4<i32> -> %b1 { - %b1 = block { +%f2 = func(%p:ptr<function, array<vec4<i32>, 5>, read_write>):vec4<i32> { + $B1: { %3:ptr<function, vec4<i32>, read_write> = access %p, 3u %4:vec4<i32> = load %3 ret %4 } } -%f1 = func(%p_1:ptr<function, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> -> %b2 { # %p_1: 'p' - %b2 = block { +%f1 = func(%p_1:ptr<function, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> { # %p_1: 'p' + $B2: { %7:ptr<function, array<vec4<i32>, 5>, read_write> = access %p_1, 2u %8:vec4<i32> = call %f2, %7 ret %8 } } -%f0 = func(%p_2:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> -> %b3 { # %p_2: 'p' - %b3 = block { +%f0 = func(%p_2:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> { # %p_2: 'p' + $B3: { %11:ptr<function, array<array<vec4<i32>, 5>, 5>, read_write> = access %p_2, 1u %12:vec4<i32> = call %f1, %11 ret %12 } } -%main = func():void -> %b4 { - %b4 = block { +%main = func():void { + $B4: { %F:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write> = var %15:vec4<i32> = call %f0, %F ret @@ -4859,8 +4859,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f2 = func(%p_root:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>, %p_indices:array<u32, 2>):vec4<i32> -> %b1 { - %b1 = block { +%f2 = func(%p_root:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>, %p_indices:array<u32, 2>):vec4<i32> { + $B1: { %4:u32 = access %p_indices, 0u %5:u32 = access %p_indices, 1u %6:ptr<function, array<vec4<i32>, 5>, read_write> = access %p_root, %4, %5 @@ -4869,23 +4869,23 @@ ret %8 } } -%f1 = func(%p_root_1:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>, %p_indices_1:array<u32, 1>):vec4<i32> -> %b2 { # %p_root_1: 'p_root', %p_indices_1: 'p_indices' - %b2 = block { +%f1 = func(%p_root_1:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>, %p_indices_1:array<u32, 1>):vec4<i32> { # %p_root_1: 'p_root', %p_indices_1: 'p_indices' + $B2: { %12:u32 = access %p_indices_1, 0u %13:array<u32, 2> = construct %12, 2u %14:vec4<i32> = call %f2, %p_root_1, %13 ret %14 } } -%f0 = func(%p_root_2:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> -> %b3 { # %p_root_2: 'p_root' - %b3 = block { +%f0 = func(%p_root_2:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> { # %p_root_2: 'p_root' + $B3: { %17:array<u32, 1> = construct 1u %18:vec4<i32> = call %f1, %p_root_2, %17 ret %18 } } -%main = func():void -> %b4 { - %b4 = block { +%main = func():void { + $B4: { %F:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write> = var %21:vec4<i32> = call %f0, %F ret @@ -4937,29 +4937,29 @@ }); auto* src = R"( -%f2 = func(%p:ptr<function, array<vec4<i32>, 5>, read_write>):vec4<i32> -> %b1 { - %b1 = block { +%f2 = func(%p:ptr<function, array<vec4<i32>, 5>, read_write>):vec4<i32> { + $B1: { %3:ptr<function, vec4<i32>, read_write> = access %p, 3u %4:vec4<i32> = load %3 ret %4 } } -%f1 = func(%p_1:ptr<function, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> -> %b2 { # %p_1: 'p' - %b2 = block { +%f1 = func(%p_1:ptr<function, array<array<vec4<i32>, 5>, 5>, read_write>):vec4<i32> { # %p_1: 'p' + $B2: { %7:ptr<function, array<vec4<i32>, 5>, read_write> = access %p_1, 2u %8:vec4<i32> = call %f2, %7 ret %8 } } -%f0 = func(%p_2:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> -> %b3 { # %p_2: 'p' - %b3 = block { +%f0 = func(%p_2:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write>):vec4<i32> { # %p_2: 'p' + $B3: { %11:ptr<function, array<array<vec4<i32>, 5>, 5>, read_write> = access %p_2, 1u %12:vec4<i32> = call %f1, %11 ret %12 } } -%main = func():void -> %b4 { - %b4 = block { +%main = func():void { + $B4: { %F:ptr<function, array<array<array<vec4<i32>, 5>, 5>, 5>, read_write> = var %15:vec4<i32> = call %f0, %F ret @@ -5008,18 +5008,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %S:ptr<storage, array<f32>, read_write> = var @binding_point(0, 0) } -%len = func(%p:ptr<storage, array<f32>, read_write>):u32 -> %b2 { - %b2 = block { +%len = func(%p:ptr<storage, array<f32>, read_write>):u32 { + $B2: { %4:u32 = arrayLength %p ret %4 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %6:u32 = call %len, %S ret } @@ -5029,19 +5029,19 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %S:ptr<storage, array<f32>, read_write> = var @binding_point(0, 0) } -%len = func():u32 -> %b2 { - %b2 = block { +%len = func():u32 { + $B2: { %3:ptr<storage, array<f32>, read_write> = access %S %4:u32 = arrayLength %3 ret %4 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %6:u32 = call %len ret } @@ -5075,18 +5075,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %W:ptr<workgroup, atomic<i32>, read_write> = var } -%load = func(%p:ptr<workgroup, atomic<i32>, read_write>):i32 -> %b2 { - %b2 = block { +%load = func(%p:ptr<workgroup, atomic<i32>, read_write>):i32 { + $B2: { %4:i32 = atomicLoad %p ret %4 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %6:i32 = call %load, %W ret } @@ -5096,19 +5096,19 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %W:ptr<workgroup, atomic<i32>, read_write> = var } -%load = func():i32 -> %b2 { - %b2 = block { +%load = func():i32 { + $B2: { %3:ptr<workgroup, atomic<i32>, read_write> = access %W %4:i32 = atomicLoad %3 ret %4 } } -%b = func():void -> %b3 { - %b3 = block { +%b = func():void { + $B3: { %6:i32 = call %load ret } @@ -5265,7 +5265,7 @@ i:vec4<i32> @offset(0) } -%b1 = block { # root +$B1: { # root %U:ptr<uniform, vec4<i32>, read> = var @binding_point(0, 0) %U_str:ptr<uniform, str, read> = var @binding_point(0, 1) %U_arr:ptr<uniform, array<vec4<i32>, 8>, read> = var @binding_point(0, 2) @@ -5280,26 +5280,26 @@ %W_arr_arr:ptr<workgroup, array<array<vec4<i32>, 8>, 4>, read_write> = var } -%fn_u = func(%p:ptr<uniform, vec4<i32>, read>):vec4<i32> -> %b2 { - %b2 = block { +%fn_u = func(%p:ptr<uniform, vec4<i32>, read>):vec4<i32> { + $B2: { %15:vec4<i32> = load %p ret %15 } } -%fn_s = func(%p_1:ptr<storage, vec4<i32>, read>):vec4<i32> -> %b3 { # %p_1: 'p' - %b3 = block { +%fn_s = func(%p_1:ptr<storage, vec4<i32>, read>):vec4<i32> { # %p_1: 'p' + $B3: { %18:vec4<i32> = load %p_1 ret %18 } } -%fn_w = func(%p_2:ptr<workgroup, vec4<i32>, read_write>):vec4<i32> -> %b4 { # %p_2: 'p' - %b4 = block { +%fn_w = func(%p_2:ptr<workgroup, vec4<i32>, read_write>):vec4<i32> { # %p_2: 'p' + $B4: { %21:vec4<i32> = load %p_2 ret %21 } } -%b = func():void -> %b5 { - %b5 = block { +%b = func():void { + $B5: { %I:i32 = let 3i %J:i32 = let 4i %u:vec4<i32> = call %fn_u, %U @@ -5365,7 +5365,7 @@ i:vec4<i32> @offset(0) } -%b1 = block { # root +$B1: { # root %U:ptr<uniform, vec4<i32>, read> = var @binding_point(0, 0) %U_str:ptr<uniform, str, read> = var @binding_point(0, 1) %U_arr:ptr<uniform, array<vec4<i32>, 8>, read> = var @binding_point(0, 2) @@ -5380,30 +5380,30 @@ %W_arr_arr:ptr<workgroup, array<array<vec4<i32>, 8>, 4>, read_write> = var } -%fn_u = func():vec4<i32> -> %b2 { - %b2 = block { +%fn_u = func():vec4<i32> { + $B2: { %14:ptr<uniform, vec4<i32>, read> = access %U %15:vec4<i32> = load %14 ret %15 } } -%fn_u_1 = func():vec4<i32> -> %b3 { # %fn_u_1: 'fn_u' - %b3 = block { +%fn_u_1 = func():vec4<i32> { # %fn_u_1: 'fn_u' + $B3: { %17:ptr<uniform, vec4<i32>, read> = access %U_str, 0u %18:vec4<i32> = load %17 ret %18 } } -%fn_u_2 = func(%p_indices:array<u32, 1>):vec4<i32> -> %b4 { # %fn_u_2: 'fn_u' - %b4 = block { +%fn_u_2 = func(%p_indices:array<u32, 1>):vec4<i32> { # %fn_u_2: 'fn_u' + $B4: { %21:u32 = access %p_indices, 0u %22:ptr<uniform, vec4<i32>, read> = access %U_arr, %21 %23:vec4<i32> = load %22 ret %23 } } -%fn_u_3 = func(%p_indices_1:array<u32, 2>):vec4<i32> -> %b5 { # %fn_u_3: 'fn_u', %p_indices_1: 'p_indices' - %b5 = block { +%fn_u_3 = func(%p_indices_1:array<u32, 2>):vec4<i32> { # %fn_u_3: 'fn_u', %p_indices_1: 'p_indices' + $B5: { %26:u32 = access %p_indices_1, 0u %27:u32 = access %p_indices_1, 1u %28:ptr<uniform, vec4<i32>, read> = access %U_arr_arr, %26, %27 @@ -5411,30 +5411,30 @@ ret %29 } } -%fn_s = func():vec4<i32> -> %b6 { - %b6 = block { +%fn_s = func():vec4<i32> { + $B6: { %31:ptr<storage, vec4<i32>, read> = access %S %32:vec4<i32> = load %31 ret %32 } } -%fn_s_1 = func():vec4<i32> -> %b7 { # %fn_s_1: 'fn_s' - %b7 = block { +%fn_s_1 = func():vec4<i32> { # %fn_s_1: 'fn_s' + $B7: { %34:ptr<storage, vec4<i32>, read> = access %S_str, 0u %35:vec4<i32> = load %34 ret %35 } } -%fn_s_2 = func(%p_indices_2:array<u32, 1>):vec4<i32> -> %b8 { # %fn_s_2: 'fn_s', %p_indices_2: 'p_indices' - %b8 = block { +%fn_s_2 = func(%p_indices_2:array<u32, 1>):vec4<i32> { # %fn_s_2: 'fn_s', %p_indices_2: 'p_indices' + $B8: { %38:u32 = access %p_indices_2, 0u %39:ptr<storage, vec4<i32>, read> = access %S_arr, %38 %40:vec4<i32> = load %39 ret %40 } } -%fn_s_3 = func(%p_indices_3:array<u32, 2>):vec4<i32> -> %b9 { # %fn_s_3: 'fn_s', %p_indices_3: 'p_indices' - %b9 = block { +%fn_s_3 = func(%p_indices_3:array<u32, 2>):vec4<i32> { # %fn_s_3: 'fn_s', %p_indices_3: 'p_indices' + $B9: { %43:u32 = access %p_indices_3, 0u %44:u32 = access %p_indices_3, 1u %45:ptr<storage, vec4<i32>, read> = access %S_arr_arr, %43, %44 @@ -5442,30 +5442,30 @@ ret %46 } } -%fn_w = func():vec4<i32> -> %b10 { - %b10 = block { +%fn_w = func():vec4<i32> { + $B10: { %48:ptr<workgroup, vec4<i32>, read_write> = access %W %49:vec4<i32> = load %48 ret %49 } } -%fn_w_1 = func():vec4<i32> -> %b11 { # %fn_w_1: 'fn_w' - %b11 = block { +%fn_w_1 = func():vec4<i32> { # %fn_w_1: 'fn_w' + $B11: { %51:ptr<workgroup, vec4<i32>, read_write> = access %W_str, 0u %52:vec4<i32> = load %51 ret %52 } } -%fn_w_2 = func(%p_indices_4:array<u32, 1>):vec4<i32> -> %b12 { # %fn_w_2: 'fn_w', %p_indices_4: 'p_indices' - %b12 = block { +%fn_w_2 = func(%p_indices_4:array<u32, 1>):vec4<i32> { # %fn_w_2: 'fn_w', %p_indices_4: 'p_indices' + $B12: { %55:u32 = access %p_indices_4, 0u %56:ptr<workgroup, vec4<i32>, read_write> = access %W_arr, %55 %57:vec4<i32> = load %56 ret %57 } } -%fn_w_3 = func(%p_indices_5:array<u32, 2>):vec4<i32> -> %b13 { # %fn_w_3: 'fn_w', %p_indices_5: 'p_indices' - %b13 = block { +%fn_w_3 = func(%p_indices_5:array<u32, 2>):vec4<i32> { # %fn_w_3: 'fn_w', %p_indices_5: 'p_indices' + $B13: { %60:u32 = access %p_indices_5, 0u %61:u32 = access %p_indices_5, 1u %62:ptr<workgroup, vec4<i32>, read_write> = access %W_arr_arr, %60, %61 @@ -5473,8 +5473,8 @@ ret %63 } } -%b = func():void -> %b14 { - %b14 = block { +%b = func():void { + $B14: { %I:i32 = let 3i %J:i32 = let 4i %u:vec4<i32> = call %fn_u @@ -5609,17 +5609,17 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %S:ptr<storage, array<array<array<array<i32, 9>, 9>, 9>, 50>, read> = var @binding_point(0, 0) } -%a = func(%i:i32):i32 -> %b2 { - %b2 = block { +%a = func(%i:i32):i32 { + $B2: { ret %i } } -%b = func(%p:ptr<storage, array<array<array<i32, 9>, 9>, 9>, read>):i32 -> %b3 { - %b3 = block { +%b = func(%p:ptr<storage, array<array<array<i32, 9>, 9>, 9>, read>):i32 { + $B3: { %6:ptr<storage, i32, read> = access %p, 0i, 1i, 2i %7:i32 = load %6 %8:i32 = call %a, %7 @@ -5636,8 +5636,8 @@ ret %18 } } -%c = func():void -> %b4 { - %b4 = block { +%c = func():void { + $B4: { %20:ptr<storage, array<array<array<i32, 9>, 9>, 9>, read> = access %S, 42i %v:i32 = call %b, %20 ret @@ -5648,17 +5648,17 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %S:ptr<storage, array<array<array<array<i32, 9>, 9>, 9>, 50>, read> = var @binding_point(0, 0) } -%a = func(%i:i32):i32 -> %b2 { - %b2 = block { +%a = func(%i:i32):i32 { + $B2: { ret %i } } -%b = func(%p_indices:array<u32, 1>):i32 -> %b3 { - %b3 = block { +%b = func(%p_indices:array<u32, 1>):i32 { + $B3: { %6:u32 = access %p_indices, 0u %7:ptr<storage, array<array<array<i32, 9>, 9>, 9>, read> = access %S, %6 %8:ptr<storage, i32, read> = access %7, 0i, 1i, 2i @@ -5677,8 +5677,8 @@ ret %20 } } -%c = func():void -> %b4 { - %b4 = block { +%c = func():void { + $B4: { %22:u32 = convert 42i %23:array<u32, 1> = construct %22 %v:i32 = call %b, %23 @@ -5738,18 +5738,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %S:ptr<storage, array<array<array<array<i32, 9>, 9>, 9>, 50>, read> = var @binding_point(0, 0) } -%a = func(%pre:i32, %i:ptr<storage, i32, read>, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %i:ptr<storage, i32, read>, %post:i32):i32 { + $B2: { %6:i32 = load %i ret %6 } } -%b = func(%p:ptr<storage, array<array<array<i32, 9>, 9>, 9>, read>):i32 -> %b3 { - %b3 = block { +%b = func(%p:ptr<storage, array<array<array<i32, 9>, 9>, 9>, read>):i32 { + $B3: { %9:ptr<storage, i32, read> = access %p, 0i, 1i, 2i %10:i32 = call %a, 20i, %9, 30i %11:ptr<storage, i32, read> = access %p, 3i, 4i, 5i @@ -5761,8 +5761,8 @@ ret %16 } } -%c = func():void -> %b4 { - %b4 = block { +%c = func():void { + $B4: { %18:ptr<storage, array<array<array<i32, 9>, 9>, 9>, read> = access %S, 42i %v:i32 = call %b, %18 ret @@ -5773,12 +5773,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %S:ptr<storage, array<array<array<array<i32, 9>, 9>, 9>, 50>, read> = var @binding_point(0, 0) } -%a = func(%pre:i32, %i_indices:array<u32, 4>, %post:i32):i32 -> %b2 { - %b2 = block { +%a = func(%pre:i32, %i_indices:array<u32, 4>, %post:i32):i32 { + $B2: { %6:u32 = access %i_indices, 0u %7:u32 = access %i_indices, 1u %8:u32 = access %i_indices, 2u @@ -5788,8 +5788,8 @@ ret %11 } } -%b = func(%p_indices:array<u32, 1>):i32 -> %b3 { - %b3 = block { +%b = func(%p_indices:array<u32, 1>):i32 { + $B3: { %14:u32 = access %p_indices, 0u %15:u32 = convert 0i %16:u32 = convert 1i @@ -5814,8 +5814,8 @@ ret %34 } } -%c = func():void -> %b4 { - %b4 = block { +%c = func():void { + $B4: { %36:u32 = convert 42i %37:array<u32, 1> = construct %36 %v:i32 = call %b, %37 @@ -5872,18 +5872,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %S:ptr<storage, array<array<array<i32, 9>, 9>, 50>, read> = var @binding_point(0, 0) %U:ptr<uniform, array<array<array<vec4<i32>, 9>, 9>, 50>, read> = var @binding_point(0, 0) } -%a = func(%i:i32):i32 -> %b2 { - %b2 = block { +%a = func(%i:i32):i32 { + $B2: { ret %i } } -%b = func(%s:ptr<storage, array<array<i32, 9>, 9>, read>, %u:ptr<uniform, array<array<vec4<i32>, 9>, 9>, read>):i32 -> %b3 { - %b3 = block { +%b = func(%s:ptr<storage, array<array<i32, 9>, 9>, read>, %u:ptr<uniform, array<array<vec4<i32>, 9>, 9>, read>):i32 { + $B3: { %8:ptr<uniform, vec4<i32>, read> = access %u, 0i, 1i %9:i32 = load_vector_element %8, 0u %10:i32 = call %a, %9 @@ -5896,8 +5896,8 @@ ret %16 } } -%c = func():void -> %b4 { - %b4 = block { +%c = func():void { + $B4: { %18:ptr<storage, array<array<i32, 9>, 9>, read> = access %S, 42i %19:ptr<uniform, array<array<vec4<i32>, 9>, 9>, read> = access %U, 24i %v:i32 = call %b, %18, %19 @@ -5909,18 +5909,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %S:ptr<storage, array<array<array<i32, 9>, 9>, 50>, read> = var @binding_point(0, 0) %U:ptr<uniform, array<array<array<vec4<i32>, 9>, 9>, 50>, read> = var @binding_point(0, 0) } -%a = func(%i:i32):i32 -> %b2 { - %b2 = block { +%a = func(%i:i32):i32 { + $B2: { ret %i } } -%b = func(%s_indices:array<u32, 1>, %u_indices:array<u32, 1>):i32 -> %b3 { - %b3 = block { +%b = func(%s_indices:array<u32, 1>, %u_indices:array<u32, 1>):i32 { + $B3: { %8:u32 = access %s_indices, 0u %9:ptr<storage, array<array<i32, 9>, 9>, read> = access %S, %8 %10:u32 = access %u_indices, 0u @@ -5937,8 +5937,8 @@ ret %20 } } -%c = func():void -> %b4 { - %b4 = block { +%c = func():void { + $B4: { %22:u32 = convert 42i %23:array<u32, 1> = construct %22 %24:u32 = convert 24i
diff --git a/src/tint/lang/core/ir/transform/multiplanar_external_texture_test.cc b/src/tint/lang/core/ir/transform/multiplanar_external_texture_test.cc index 8f4ea34..dadb543 100644 --- a/src/tint/lang/core/ir/transform/multiplanar_external_texture_test.cc +++ b/src/tint/lang/core/ir/transform/multiplanar_external_texture_test.cc
@@ -45,8 +45,8 @@ func->Block()->Append(b.Return(func)); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { ret } } @@ -68,12 +68,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_external, read> = var @binding_point(1, 2) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { ret } } @@ -100,14 +100,14 @@ coordTransformationMatrix:mat3x2<f32> @offset(176) } -%b1 = block { # root +$B1: { # root %texture_plane0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 2) %texture_plane1:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 3) %texture_params:ptr<uniform, tint_ExternalTextureParams, read> = var @binding_point(1, 4) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { ret } } @@ -133,12 +133,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_external, read> = var @binding_point(1, 2) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:texture_external = load %texture ret } @@ -166,14 +166,14 @@ coordTransformationMatrix:mat3x2<f32> @offset(176) } -%b1 = block { # root +$B1: { # root %texture_plane0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 2) %texture_plane1:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 3) %texture_params:ptr<uniform, tint_ExternalTextureParams, read> = var @binding_point(1, 4) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %5:texture_2d<f32> = load %texture_plane0 %6:texture_2d<f32> = load %texture_plane1 %7:tint_ExternalTextureParams = load %texture_params @@ -204,12 +204,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_external, read> = var @binding_point(1, 2) } -%foo = func():vec2<u32> -> %b2 { - %b2 = block { +%foo = func():vec2<u32> { + $B2: { %3:texture_external = load %texture %result:vec2<u32> = textureDimensions %3 ret %result @@ -238,14 +238,14 @@ coordTransformationMatrix:mat3x2<f32> @offset(176) } -%b1 = block { # root +$B1: { # root %texture_plane0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 2) %texture_plane1:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 3) %texture_params:ptr<uniform, tint_ExternalTextureParams, read> = var @binding_point(1, 4) } -%foo = func():vec2<u32> -> %b2 { - %b2 = block { +%foo = func():vec2<u32> { + $B2: { %5:texture_2d<f32> = load %texture_plane0 %6:texture_2d<f32> = load %texture_plane1 %7:tint_ExternalTextureParams = load %texture_params @@ -279,12 +279,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_external, read> = var @binding_point(1, 2) } -%foo = func(%coords:vec2<u32>):vec4<f32> -> %b2 { - %b2 = block { +%foo = func(%coords:vec2<u32>):vec4<f32> { + $B2: { %4:texture_external = load %texture %result:vec4<f32> = textureLoad %4, %coords ret %result @@ -313,14 +313,14 @@ coordTransformationMatrix:mat3x2<f32> @offset(176) } -%b1 = block { # root +$B1: { # root %texture_plane0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 2) %texture_plane1:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 3) %texture_params:ptr<uniform, tint_ExternalTextureParams, read> = var @binding_point(1, 4) } -%foo = func(%coords:vec2<u32>):vec4<f32> -> %b2 { - %b2 = block { +%foo = func(%coords:vec2<u32>):vec4<f32> { + $B2: { %6:texture_2d<f32> = load %texture_plane0 %7:texture_2d<f32> = load %texture_plane1 %8:tint_ExternalTextureParams = load %texture_params @@ -328,20 +328,20 @@ ret %9 } } -%tint_TextureLoadExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %coords_1:vec2<u32>):vec4<f32> -> %b3 { # %coords_1: 'coords' - %b3 = block { +%tint_TextureLoadExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %coords_1:vec2<u32>):vec4<f32> { # %coords_1: 'coords' + $B3: { %15:u32 = access %params, 1u %16:mat3x4<f32> = access %params, 2u %17:u32 = access %params, 0u %18:bool = eq %17, 1u - %19:vec3<f32>, %20:f32 = if %18 [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + %19:vec3<f32>, %20:f32 = if %18 [t: $B4, f: $B5] { # if_1 + $B4: { # true %21:vec4<f32> = textureLoad %plane_0, %coords_1, 0u %22:vec3<f32> = swizzle %21, xyz %23:f32 = access %21, 3u exit_if %22, %23 # if_1 } - %b5 = block { # false + $B5: { # false %24:vec4<f32> = textureLoad %plane_0, %coords_1, 0u %25:f32 = access %24, 0u %26:vec2<u32> = shr %coords_1, vec2<u32>(1u) @@ -353,8 +353,8 @@ } } %31:bool = eq %15, 0u - %32:vec3<f32> = if %31 [t: %b6, f: %b7] { # if_2 - %b6 = block { # true + %32:vec3<f32> = if %31 [t: $B6, f: $B7] { # if_2 + $B6: { # true %33:tint_GammaTransferParams = access %params, 3u %34:tint_GammaTransferParams = access %params, 4u %35:mat3x3<f32> = access %params, 5u @@ -363,7 +363,7 @@ %39:vec3<f32> = call %tint_GammaCorrection, %38, %34 exit_if %39 # if_2 } - %b7 = block { # false + $B7: { # false exit_if %19 # if_2 } } @@ -371,8 +371,8 @@ ret %40 } } -%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> -> %b8 { # %params_1: 'params' - %b8 = block { +%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> { # %params_1: 'params' + $B8: { %43:f32 = access %params_1, 0u %44:f32 = access %params_1, 1u %45:f32 = access %params_1, 2u @@ -423,12 +423,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_external, read> = var @binding_point(1, 2) } -%foo = func(%coords:vec2<i32>):vec4<f32> -> %b2 { - %b2 = block { +%foo = func(%coords:vec2<i32>):vec4<f32> { + $B2: { %4:texture_external = load %texture %result:vec4<f32> = textureLoad %4, %coords ret %result @@ -457,14 +457,14 @@ coordTransformationMatrix:mat3x2<f32> @offset(176) } -%b1 = block { # root +$B1: { # root %texture_plane0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 2) %texture_plane1:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 3) %texture_params:ptr<uniform, tint_ExternalTextureParams, read> = var @binding_point(1, 4) } -%foo = func(%coords:vec2<i32>):vec4<f32> -> %b2 { - %b2 = block { +%foo = func(%coords:vec2<i32>):vec4<f32> { + $B2: { %6:texture_2d<f32> = load %texture_plane0 %7:texture_2d<f32> = load %texture_plane1 %8:tint_ExternalTextureParams = load %texture_params @@ -473,20 +473,20 @@ ret %10 } } -%tint_TextureLoadExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %coords_1:vec2<u32>):vec4<f32> -> %b3 { # %coords_1: 'coords' - %b3 = block { +%tint_TextureLoadExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %coords_1:vec2<u32>):vec4<f32> { # %coords_1: 'coords' + $B3: { %16:u32 = access %params, 1u %17:mat3x4<f32> = access %params, 2u %18:u32 = access %params, 0u %19:bool = eq %18, 1u - %20:vec3<f32>, %21:f32 = if %19 [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + %20:vec3<f32>, %21:f32 = if %19 [t: $B4, f: $B5] { # if_1 + $B4: { # true %22:vec4<f32> = textureLoad %plane_0, %coords_1, 0u %23:vec3<f32> = swizzle %22, xyz %24:f32 = access %22, 3u exit_if %23, %24 # if_1 } - %b5 = block { # false + $B5: { # false %25:vec4<f32> = textureLoad %plane_0, %coords_1, 0u %26:f32 = access %25, 0u %27:vec2<u32> = shr %coords_1, vec2<u32>(1u) @@ -498,8 +498,8 @@ } } %32:bool = eq %16, 0u - %33:vec3<f32> = if %32 [t: %b6, f: %b7] { # if_2 - %b6 = block { # true + %33:vec3<f32> = if %32 [t: $B6, f: $B7] { # if_2 + $B6: { # true %34:tint_GammaTransferParams = access %params, 3u %35:tint_GammaTransferParams = access %params, 4u %36:mat3x3<f32> = access %params, 5u @@ -508,7 +508,7 @@ %40:vec3<f32> = call %tint_GammaCorrection, %39, %35 exit_if %40 # if_2 } - %b7 = block { # false + $B7: { # false exit_if %20 # if_2 } } @@ -516,8 +516,8 @@ ret %41 } } -%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> -> %b8 { # %params_1: 'params' - %b8 = block { +%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> { # %params_1: 'params' + $B8: { %44:f32 = access %params_1, 0u %45:f32 = access %params_1, 1u %46:f32 = access %params_1, 2u @@ -570,12 +570,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_external, read> = var @binding_point(1, 2) } -%foo = func(%sampler:sampler, %coords:vec2<f32>):vec4<f32> -> %b2 { - %b2 = block { +%foo = func(%sampler:sampler, %coords:vec2<f32>):vec4<f32> { + $B2: { %5:texture_external = load %texture %result:vec4<f32> = textureSampleBaseClampToEdge %5, %sampler, %coords ret %result @@ -604,14 +604,14 @@ coordTransformationMatrix:mat3x2<f32> @offset(176) } -%b1 = block { # root +$B1: { # root %texture_plane0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 2) %texture_plane1:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 3) %texture_params:ptr<uniform, tint_ExternalTextureParams, read> = var @binding_point(1, 4) } -%foo = func(%sampler:sampler, %coords:vec2<f32>):vec4<f32> -> %b2 { - %b2 = block { +%foo = func(%sampler:sampler, %coords:vec2<f32>):vec4<f32> { + $B2: { %7:texture_2d<f32> = load %texture_plane0 %8:texture_2d<f32> = load %texture_plane1 %9:tint_ExternalTextureParams = load %texture_params @@ -619,8 +619,8 @@ ret %10 } } -%tint_TextureSampleExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %sampler_1:sampler, %coords_1:vec2<f32>):vec4<f32> -> %b3 { # %sampler_1: 'sampler', %coords_1: 'coords' - %b3 = block { +%tint_TextureSampleExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %sampler_1:sampler, %coords_1:vec2<f32>):vec4<f32> { # %sampler_1: 'sampler', %coords_1: 'coords' + $B3: { %17:u32 = access %params, 1u %18:mat3x4<f32> = access %params, 2u %19:mat3x2<f32> = access %params, 6u @@ -638,14 +638,14 @@ %31:vec2<f32> = clamp %21, %29, %30 %32:u32 = access %params, 0u %33:bool = eq %32, 1u - %34:vec3<f32>, %35:f32 = if %33 [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + %34:vec3<f32>, %35:f32 = if %33 [t: $B4, f: $B5] { # if_1 + $B4: { # true %36:vec4<f32> = textureSampleLevel %plane_0, %sampler_1, %26, 0.0f %37:vec3<f32> = swizzle %36, xyz %38:f32 = access %36, 3u exit_if %37, %38 # if_1 } - %b5 = block { # false + $B5: { # false %39:vec4<f32> = textureSampleLevel %plane_0, %sampler_1, %26, 0.0f %40:f32 = access %39, 0u %41:vec4<f32> = textureSampleLevel %plane_1, %sampler_1, %31, 0.0f @@ -656,8 +656,8 @@ } } %45:bool = eq %17, 0u - %46:vec3<f32> = if %45 [t: %b6, f: %b7] { # if_2 - %b6 = block { # true + %46:vec3<f32> = if %45 [t: $B6, f: $B7] { # if_2 + $B6: { # true %47:tint_GammaTransferParams = access %params, 3u %48:tint_GammaTransferParams = access %params, 4u %49:mat3x3<f32> = access %params, 5u @@ -666,7 +666,7 @@ %53:vec3<f32> = call %tint_GammaCorrection, %52, %48 exit_if %53 # if_2 } - %b7 = block { # false + $B7: { # false exit_if %34 # if_2 } } @@ -674,8 +674,8 @@ ret %54 } } -%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> -> %b8 { # %params_1: 'params' - %b8 = block { +%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> { # %params_1: 'params' + $B8: { %57:f32 = access %params_1, 0u %58:f32 = access %params_1, 1u %59:f32 = access %params_1, 2u @@ -743,18 +743,18 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_external, read> = var @binding_point(1, 2) } -%foo = func(%texture_1:texture_external, %sampler:sampler, %coords:vec2<f32>):vec4<f32> -> %b2 { # %texture_1: 'texture' - %b2 = block { +%foo = func(%texture_1:texture_external, %sampler:sampler, %coords:vec2<f32>):vec4<f32> { # %texture_1: 'texture' + $B2: { %result:vec4<f32> = textureSampleBaseClampToEdge %texture_1, %sampler, %coords ret %result } } -%bar = func(%sampler_1:sampler, %coords_1:vec2<f32>):vec4<f32> -> %b3 { # %sampler_1: 'sampler', %coords_1: 'coords' - %b3 = block { +%bar = func(%sampler_1:sampler, %coords_1:vec2<f32>):vec4<f32> { # %sampler_1: 'sampler', %coords_1: 'coords' + $B3: { %10:texture_external = load %texture %result_1:vec4<f32> = call %foo, %10, %sampler_1, %coords_1 # %result_1: 'result' ret %result_1 @@ -783,20 +783,20 @@ coordTransformationMatrix:mat3x2<f32> @offset(176) } -%b1 = block { # root +$B1: { # root %texture_plane0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 2) %texture_plane1:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 3) %texture_params:ptr<uniform, tint_ExternalTextureParams, read> = var @binding_point(1, 4) } -%foo = func(%texture_plane0_1:texture_2d<f32>, %texture_plane1_1:texture_2d<f32>, %texture_params_1:tint_ExternalTextureParams, %sampler:sampler, %coords:vec2<f32>):vec4<f32> -> %b2 { # %texture_plane0_1: 'texture_plane0', %texture_plane1_1: 'texture_plane1', %texture_params_1: 'texture_params' - %b2 = block { +%foo = func(%texture_plane0_1:texture_2d<f32>, %texture_plane1_1:texture_2d<f32>, %texture_params_1:tint_ExternalTextureParams, %sampler:sampler, %coords:vec2<f32>):vec4<f32> { # %texture_plane0_1: 'texture_plane0', %texture_plane1_1: 'texture_plane1', %texture_params_1: 'texture_params' + $B2: { %10:vec4<f32> = call %tint_TextureSampleExternal, %texture_plane0_1, %texture_plane1_1, %texture_params_1, %sampler, %coords ret %10 } } -%bar = func(%sampler_1:sampler, %coords_1:vec2<f32>):vec4<f32> -> %b3 { # %sampler_1: 'sampler', %coords_1: 'coords' - %b3 = block { +%bar = func(%sampler_1:sampler, %coords_1:vec2<f32>):vec4<f32> { # %sampler_1: 'sampler', %coords_1: 'coords' + $B3: { %15:texture_2d<f32> = load %texture_plane0 %16:texture_2d<f32> = load %texture_plane1 %17:tint_ExternalTextureParams = load %texture_params @@ -804,8 +804,8 @@ ret %result } } -%tint_TextureSampleExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %sampler_2:sampler, %coords_2:vec2<f32>):vec4<f32> -> %b4 { # %sampler_2: 'sampler', %coords_2: 'coords' - %b4 = block { +%tint_TextureSampleExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %sampler_2:sampler, %coords_2:vec2<f32>):vec4<f32> { # %sampler_2: 'sampler', %coords_2: 'coords' + $B4: { %24:u32 = access %params, 1u %25:mat3x4<f32> = access %params, 2u %26:mat3x2<f32> = access %params, 6u @@ -823,14 +823,14 @@ %38:vec2<f32> = clamp %28, %36, %37 %39:u32 = access %params, 0u %40:bool = eq %39, 1u - %41:vec3<f32>, %42:f32 = if %40 [t: %b5, f: %b6] { # if_1 - %b5 = block { # true + %41:vec3<f32>, %42:f32 = if %40 [t: $B5, f: $B6] { # if_1 + $B5: { # true %43:vec4<f32> = textureSampleLevel %plane_0, %sampler_2, %33, 0.0f %44:vec3<f32> = swizzle %43, xyz %45:f32 = access %43, 3u exit_if %44, %45 # if_1 } - %b6 = block { # false + $B6: { # false %46:vec4<f32> = textureSampleLevel %plane_0, %sampler_2, %33, 0.0f %47:f32 = access %46, 0u %48:vec4<f32> = textureSampleLevel %plane_1, %sampler_2, %38, 0.0f @@ -841,8 +841,8 @@ } } %52:bool = eq %24, 0u - %53:vec3<f32> = if %52 [t: %b7, f: %b8] { # if_2 - %b7 = block { # true + %53:vec3<f32> = if %52 [t: $B7, f: $B8] { # if_2 + $B7: { # true %54:tint_GammaTransferParams = access %params, 3u %55:tint_GammaTransferParams = access %params, 4u %56:mat3x3<f32> = access %params, 5u @@ -851,7 +851,7 @@ %60:vec3<f32> = call %tint_GammaCorrection, %59, %55 exit_if %60 # if_2 } - %b8 = block { # false + $B8: { # false exit_if %41 # if_2 } } @@ -859,8 +859,8 @@ ret %61 } } -%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> -> %b9 { # %params_1: 'params' - %b9 = block { +%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> { # %params_1: 'params' + $B9: { %64:f32 = access %params_1, 0u %65:f32 = access %params_1, 1u %66:f32 = access %params_1, 2u @@ -938,18 +938,18 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_external, read> = var @binding_point(1, 2) } -%foo = func(%texture_1:texture_external, %sampler:sampler, %coords:vec2<f32>):vec4<f32> -> %b2 { # %texture_1: 'texture' - %b2 = block { +%foo = func(%texture_1:texture_external, %sampler:sampler, %coords:vec2<f32>):vec4<f32> { # %texture_1: 'texture' + $B2: { %result:vec4<f32> = textureSampleBaseClampToEdge %texture_1, %sampler, %coords ret %result } } -%bar = func(%sampler_1:sampler, %coords_1:vec2<f32>):vec4<f32> -> %b3 { # %sampler_1: 'sampler', %coords_1: 'coords' - %b3 = block { +%bar = func(%sampler_1:sampler, %coords_1:vec2<f32>):vec4<f32> { # %sampler_1: 'sampler', %coords_1: 'coords' + $B3: { %10:texture_external = load %texture %11:vec2<u32> = textureDimensions %10 %12:texture_external = load %texture @@ -986,20 +986,20 @@ coordTransformationMatrix:mat3x2<f32> @offset(176) } -%b1 = block { # root +$B1: { # root %texture_plane0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 2) %texture_plane1:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 3) %texture_params:ptr<uniform, tint_ExternalTextureParams, read> = var @binding_point(1, 4) } -%foo = func(%texture_plane0_1:texture_2d<f32>, %texture_plane1_1:texture_2d<f32>, %texture_params_1:tint_ExternalTextureParams, %sampler:sampler, %coords:vec2<f32>):vec4<f32> -> %b2 { # %texture_plane0_1: 'texture_plane0', %texture_plane1_1: 'texture_plane1', %texture_params_1: 'texture_params' - %b2 = block { +%foo = func(%texture_plane0_1:texture_2d<f32>, %texture_plane1_1:texture_2d<f32>, %texture_params_1:tint_ExternalTextureParams, %sampler:sampler, %coords:vec2<f32>):vec4<f32> { # %texture_plane0_1: 'texture_plane0', %texture_plane1_1: 'texture_plane1', %texture_params_1: 'texture_params' + $B2: { %10:vec4<f32> = call %tint_TextureSampleExternal, %texture_plane0_1, %texture_plane1_1, %texture_params_1, %sampler, %coords ret %10 } } -%bar = func(%sampler_1:sampler, %coords_1:vec2<f32>):vec4<f32> -> %b3 { # %sampler_1: 'sampler', %coords_1: 'coords' - %b3 = block { +%bar = func(%sampler_1:sampler, %coords_1:vec2<f32>):vec4<f32> { # %sampler_1: 'sampler', %coords_1: 'coords' + $B3: { %15:texture_2d<f32> = load %texture_plane0 %16:texture_2d<f32> = load %texture_plane1 %17:tint_ExternalTextureParams = load %texture_params @@ -1021,8 +1021,8 @@ ret %32 } } -%tint_TextureSampleExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %sampler_2:sampler, %coords_2:vec2<f32>):vec4<f32> -> %b4 { # %sampler_2: 'sampler', %coords_2: 'coords' - %b4 = block { +%tint_TextureSampleExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %sampler_2:sampler, %coords_2:vec2<f32>):vec4<f32> { # %sampler_2: 'sampler', %coords_2: 'coords' + $B4: { %38:u32 = access %params, 1u %39:mat3x4<f32> = access %params, 2u %40:mat3x2<f32> = access %params, 6u @@ -1040,14 +1040,14 @@ %52:vec2<f32> = clamp %42, %50, %51 %53:u32 = access %params, 0u %54:bool = eq %53, 1u - %55:vec3<f32>, %56:f32 = if %54 [t: %b5, f: %b6] { # if_1 - %b5 = block { # true + %55:vec3<f32>, %56:f32 = if %54 [t: $B5, f: $B6] { # if_1 + $B5: { # true %57:vec4<f32> = textureSampleLevel %plane_0, %sampler_2, %47, 0.0f %58:vec3<f32> = swizzle %57, xyz %59:f32 = access %57, 3u exit_if %58, %59 # if_1 } - %b6 = block { # false + $B6: { # false %60:vec4<f32> = textureSampleLevel %plane_0, %sampler_2, %47, 0.0f %61:f32 = access %60, 0u %62:vec4<f32> = textureSampleLevel %plane_1, %sampler_2, %52, 0.0f @@ -1058,8 +1058,8 @@ } } %66:bool = eq %38, 0u - %67:vec3<f32> = if %66 [t: %b7, f: %b8] { # if_2 - %b7 = block { # true + %67:vec3<f32> = if %66 [t: $B7, f: $B8] { # if_2 + $B7: { # true %68:tint_GammaTransferParams = access %params, 3u %69:tint_GammaTransferParams = access %params, 4u %70:mat3x3<f32> = access %params, 5u @@ -1068,7 +1068,7 @@ %74:vec3<f32> = call %tint_GammaCorrection, %73, %69 exit_if %74 # if_2 } - %b8 = block { # false + $B8: { # false exit_if %55 # if_2 } } @@ -1076,8 +1076,8 @@ ret %75 } } -%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> -> %b9 { # %params_1: 'params' - %b9 = block { +%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> { # %params_1: 'params' + $B9: { %78:f32 = access %params_1, 0u %79:f32 = access %params_1, 1u %80:f32 = access %params_1, 2u @@ -1139,14 +1139,14 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture_a:ptr<handle, texture_external, read> = var @binding_point(1, 2) %texture_b:ptr<handle, texture_external, read> = var @binding_point(2, 2) %texture_c:ptr<handle, texture_external, read> = var @binding_point(3, 2) } -%foo = func(%coords:vec2<u32>):void -> %b2 { - %b2 = block { +%foo = func(%coords:vec2<u32>):void { + $B2: { %6:texture_external = load %texture_a %7:vec4<f32> = textureLoad %6, %coords %8:texture_external = load %texture_b @@ -1179,7 +1179,7 @@ coordTransformationMatrix:mat3x2<f32> @offset(176) } -%b1 = block { # root +$B1: { # root %texture_a_plane0:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 2) %texture_a_plane1:ptr<handle, texture_2d<f32>, read> = var @binding_point(1, 3) %texture_a_params:ptr<uniform, tint_ExternalTextureParams, read> = var @binding_point(1, 4) @@ -1191,8 +1191,8 @@ %texture_c_params:ptr<uniform, tint_ExternalTextureParams, read> = var @binding_point(3, 4) } -%foo = func(%coords:vec2<u32>):void -> %b2 { - %b2 = block { +%foo = func(%coords:vec2<u32>):void { + $B2: { %12:texture_2d<f32> = load %texture_a_plane0 %13:texture_2d<f32> = load %texture_a_plane1 %14:tint_ExternalTextureParams = load %texture_a_params @@ -1208,20 +1208,20 @@ ret } } -%tint_TextureLoadExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %coords_1:vec2<u32>):vec4<f32> -> %b3 { # %coords_1: 'coords' - %b3 = block { +%tint_TextureLoadExternal = func(%plane_0:texture_2d<f32>, %plane_1:texture_2d<f32>, %params:tint_ExternalTextureParams, %coords_1:vec2<u32>):vec4<f32> { # %coords_1: 'coords' + $B3: { %29:u32 = access %params, 1u %30:mat3x4<f32> = access %params, 2u %31:u32 = access %params, 0u %32:bool = eq %31, 1u - %33:vec3<f32>, %34:f32 = if %32 [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + %33:vec3<f32>, %34:f32 = if %32 [t: $B4, f: $B5] { # if_1 + $B4: { # true %35:vec4<f32> = textureLoad %plane_0, %coords_1, 0u %36:vec3<f32> = swizzle %35, xyz %37:f32 = access %35, 3u exit_if %36, %37 # if_1 } - %b5 = block { # false + $B5: { # false %38:vec4<f32> = textureLoad %plane_0, %coords_1, 0u %39:f32 = access %38, 0u %40:vec2<u32> = shr %coords_1, vec2<u32>(1u) @@ -1233,8 +1233,8 @@ } } %45:bool = eq %29, 0u - %46:vec3<f32> = if %45 [t: %b6, f: %b7] { # if_2 - %b6 = block { # true + %46:vec3<f32> = if %45 [t: $B6, f: $B7] { # if_2 + $B6: { # true %47:tint_GammaTransferParams = access %params, 3u %48:tint_GammaTransferParams = access %params, 4u %49:mat3x3<f32> = access %params, 5u @@ -1243,7 +1243,7 @@ %53:vec3<f32> = call %tint_GammaCorrection, %52, %48 exit_if %53 # if_2 } - %b7 = block { # false + $B7: { # false exit_if %33 # if_2 } } @@ -1251,8 +1251,8 @@ ret %54 } } -%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> -> %b8 { # %params_1: 'params' - %b8 = block { +%tint_GammaCorrection = func(%v:vec3<f32>, %params_1:tint_GammaTransferParams):vec3<f32> { # %params_1: 'params' + $B8: { %57:f32 = access %params_1, 0u %58:f32 = access %params_1, 1u %59:f32 = access %params_1, 2u
diff --git a/src/tint/lang/core/ir/transform/preserve_padding_test.cc b/src/tint/lang/core/ir/transform/preserve_padding_test.cc index 82a4ade..83f5942 100644 --- a/src/tint/lang/core/ir/transform/preserve_padding_test.cc +++ b/src/tint/lang/core/ir/transform/preserve_padding_test.cc
@@ -92,12 +92,12 @@ b:u32 @offset(16) } -%b1 = block { # root +$B1: { # root %buffer:ptr<workgroup, MyStruct, read_write> = var } -%foo = func(%value:MyStruct):void -> %b2 { - %b2 = block { +%foo = func(%value:MyStruct):void { + $B2: { store %buffer, %value ret } @@ -131,12 +131,12 @@ b:u32 @offset(16) } -%b1 = block { # root +$B1: { # root %buffer:ptr<private, MyStruct, read_write> = var } -%foo = func(%value:MyStruct):void -> %b2 { - %b2 = block { +%foo = func(%value:MyStruct):void { + $B2: { store %buffer, %value ret } @@ -169,8 +169,8 @@ b:u32 @offset(16) } -%foo = func(%value:MyStruct):void -> %b1 { - %b1 = block { +%foo = func(%value:MyStruct):void { + $B1: { %buffer:ptr<function, MyStruct, read_write> = var store %buffer, %value ret @@ -207,12 +207,12 @@ c:vec4<u32> @offset(32) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, MyStruct, read_write> = var @binding_point(0, 0) } -%foo = func(%value:MyStruct):void -> %b2 { - %b2 = block { +%foo = func(%value:MyStruct):void { + $B2: { store %buffer, %value ret } @@ -242,12 +242,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, mat4x4<f32>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:mat4x4<f32>):void -> %b2 { - %b2 = block { +%foo = func(%value:mat4x4<f32>):void { + $B2: { store %buffer, %value ret } @@ -277,12 +277,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, array<vec4<f32>>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:array<vec4<f32>>):void -> %b2 { - %b2 = block { +%foo = func(%value:array<vec4<f32>>):void { + $B2: { store %buffer, %value ret } @@ -311,12 +311,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, vec3<f32>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:vec3<f32>):void -> %b2 { - %b2 = block { +%foo = func(%value:vec3<f32>):void { + $B2: { store %buffer, %value ret } @@ -350,12 +350,12 @@ b:u32 @offset(16) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, MyStruct, read_write> = var @binding_point(0, 0) } -%foo = func():MyStruct -> %b2 { - %b2 = block { +%foo = func():MyStruct { + $B2: { %3:MyStruct = load %buffer ret %3 } @@ -391,12 +391,12 @@ b:u32 @offset(16) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, MyStruct, read_write> = var @binding_point(0, 0) } -%foo = func(%value:MyStruct):void -> %b2 { - %b2 = block { +%foo = func(%value:MyStruct):void { + $B2: { store %buffer, %value ret } @@ -410,18 +410,18 @@ b:u32 @offset(16) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, MyStruct, read_write> = var @binding_point(0, 0) } -%foo = func(%value:MyStruct):void -> %b2 { - %b2 = block { +%foo = func(%value:MyStruct):void { + $B2: { %4:void = call %tint_store_and_preserve_padding, %buffer, %value ret } } -%tint_store_and_preserve_padding = func(%target:ptr<storage, MyStruct, read_write>, %value_param:MyStruct):void -> %b3 { - %b3 = block { +%tint_store_and_preserve_padding = func(%target:ptr<storage, MyStruct, read_write>, %value_param:MyStruct):void { + $B3: { %8:ptr<storage, vec4<u32>, read_write> = access %target, 0u %9:vec4<u32> = access %value_param, 0u store %8, %9 @@ -460,12 +460,12 @@ c:vec4<u32> @offset(32) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, MyStruct, read_write> = var @binding_point(0, 0) } -%foo = func(%value:MyStruct):void -> %b2 { - %b2 = block { +%foo = func(%value:MyStruct):void { + $B2: { store %buffer, %value ret } @@ -480,18 +480,18 @@ c:vec4<u32> @offset(32) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, MyStruct, read_write> = var @binding_point(0, 0) } -%foo = func(%value:MyStruct):void -> %b2 { - %b2 = block { +%foo = func(%value:MyStruct):void { + $B2: { %4:void = call %tint_store_and_preserve_padding, %buffer, %value ret } } -%tint_store_and_preserve_padding = func(%target:ptr<storage, MyStruct, read_write>, %value_param:MyStruct):void -> %b3 { - %b3 = block { +%tint_store_and_preserve_padding = func(%target:ptr<storage, MyStruct, read_write>, %value_param:MyStruct):void { + $B3: { %8:ptr<storage, vec4<u32>, read_write> = access %target, 0u %9:vec4<u32> = access %value_param, 0u store %8, %9 @@ -540,12 +540,12 @@ inner:MyStruct @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, Outer, read_write> = var @binding_point(0, 0) } -%foo = func(%value:Outer):void -> %b2 { - %b2 = block { +%foo = func(%value:Outer):void { + $B2: { store %buffer, %value ret } @@ -564,26 +564,26 @@ inner:MyStruct @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, Outer, read_write> = var @binding_point(0, 0) } -%foo = func(%value:Outer):void -> %b2 { - %b2 = block { +%foo = func(%value:Outer):void { + $B2: { %4:void = call %tint_store_and_preserve_padding, %buffer, %value ret } } -%tint_store_and_preserve_padding = func(%target:ptr<storage, Outer, read_write>, %value_param:Outer):void -> %b3 { - %b3 = block { +%tint_store_and_preserve_padding = func(%target:ptr<storage, Outer, read_write>, %value_param:Outer):void { + $B3: { %8:ptr<storage, MyStruct, read_write> = access %target, 0u %9:MyStruct = access %value_param, 0u %10:void = call %tint_store_and_preserve_padding_1, %8, %9 ret } } -%tint_store_and_preserve_padding_1 = func(%target_1:ptr<storage, MyStruct, read_write>, %value_param_1:MyStruct):void -> %b4 { # %tint_store_and_preserve_padding_1: 'tint_store_and_preserve_padding', %target_1: 'target', %value_param_1: 'value_param' - %b4 = block { +%tint_store_and_preserve_padding_1 = func(%target_1:ptr<storage, MyStruct, read_write>, %value_param_1:MyStruct):void { # %tint_store_and_preserve_padding_1: 'tint_store_and_preserve_padding', %target_1: 'target', %value_param_1: 'value_param' + $B4: { %14:ptr<storage, vec4<u32>, read_write> = access %target_1, 0u %15:vec4<u32> = access %value_param_1, 0u store %14, %15 @@ -625,12 +625,12 @@ b:u32 @offset(16) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, array<MyStruct, 4>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:array<MyStruct, 4>):void -> %b2 { - %b2 = block { +%foo = func(%value:array<MyStruct, 4>):void { + $B2: { store %buffer, %value ret } @@ -644,44 +644,44 @@ b:u32 @offset(16) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, array<MyStruct, 4>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:array<MyStruct, 4>):void -> %b2 { - %b2 = block { +%foo = func(%value:array<MyStruct, 4>):void { + $B2: { %4:void = call %tint_store_and_preserve_padding, %buffer, %value ret } } -%tint_store_and_preserve_padding = func(%target:ptr<storage, array<MyStruct, 4>, read_write>, %value_param:array<MyStruct, 4>):void -> %b3 { - %b3 = block { - loop [i: %b4, b: %b5, c: %b6] { # loop_1 - %b4 = block { # initializer - next_iteration %b5 0u +%tint_store_and_preserve_padding = func(%target:ptr<storage, array<MyStruct, 4>, read_write>, %value_param:array<MyStruct, 4>):void { + $B3: { + loop [i: $B4, b: $B5, c: $B6] { # loop_1 + $B4: { # initializer + next_iteration 0u # -> $B5 } - %b5 = block (%idx:u32) { # body + $B5 (%idx:u32): { # body %9:bool = gte %idx:u32, 4u - if %9 [t: %b7] { # if_1 - %b7 = block { # true + if %9 [t: $B7] { # if_1 + $B7: { # true exit_loop # loop_1 } } %10:ptr<storage, MyStruct, read_write> = access %target, %idx:u32 %11:MyStruct = access %value_param, %idx:u32 %12:void = call %tint_store_and_preserve_padding_1, %10, %11 - continue %b6 + continue # -> $B6 } - %b6 = block { # continuing + $B6: { # continuing %14:u32 = add %idx:u32, 1u - next_iteration %b5 %14 + next_iteration %14 # -> $B5 } } ret } } -%tint_store_and_preserve_padding_1 = func(%target_1:ptr<storage, MyStruct, read_write>, %value_param_1:MyStruct):void -> %b8 { # %tint_store_and_preserve_padding_1: 'tint_store_and_preserve_padding', %target_1: 'target', %value_param_1: 'value_param' - %b8 = block { +%tint_store_and_preserve_padding_1 = func(%target_1:ptr<storage, MyStruct, read_write>, %value_param_1:MyStruct):void { # %tint_store_and_preserve_padding_1: 'tint_store_and_preserve_padding', %target_1: 'target', %value_param_1: 'value_param' + $B8: { %17:ptr<storage, vec4<u32>, read_write> = access %target_1, 0u %18:vec4<u32> = access %value_param_1, 0u store %17, %18 @@ -714,12 +714,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, mat3x3<f32>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:mat3x3<f32>):void -> %b2 { - %b2 = block { +%foo = func(%value:mat3x3<f32>):void { + $B2: { store %buffer, %value ret } @@ -728,18 +728,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, mat3x3<f32>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:mat3x3<f32>):void -> %b2 { - %b2 = block { +%foo = func(%value:mat3x3<f32>):void { + $B2: { %4:void = call %tint_store_and_preserve_padding, %buffer, %value ret } } -%tint_store_and_preserve_padding = func(%target:ptr<storage, mat3x3<f32>, read_write>, %value_param:mat3x3<f32>):void -> %b3 { - %b3 = block { +%tint_store_and_preserve_padding = func(%target:ptr<storage, mat3x3<f32>, read_write>, %value_param:mat3x3<f32>):void { + $B3: { %8:ptr<storage, vec3<f32>, read_write> = access %target, 0u %9:vec3<f32> = access %value_param, 0u store %8, %9 @@ -784,12 +784,12 @@ b:mat3x3<f32> @offset(48) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, MyStruct, read_write> = var @binding_point(0, 0) } -%foo = func(%value:MyStruct):void -> %b2 { - %b2 = block { +%foo = func(%value:MyStruct):void { + $B2: { store %buffer, %value ret } @@ -803,18 +803,18 @@ b:mat3x3<f32> @offset(48) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, MyStruct, read_write> = var @binding_point(0, 0) } -%foo = func(%value:MyStruct):void -> %b2 { - %b2 = block { +%foo = func(%value:MyStruct):void { + $B2: { %4:void = call %tint_store_and_preserve_padding, %buffer, %value ret } } -%tint_store_and_preserve_padding = func(%target:ptr<storage, MyStruct, read_write>, %value_param:MyStruct):void -> %b3 { - %b3 = block { +%tint_store_and_preserve_padding = func(%target:ptr<storage, MyStruct, read_write>, %value_param:MyStruct):void { + $B3: { %8:ptr<storage, mat3x3<f32>, read_write> = access %target, 0u %9:mat3x3<f32> = access %value_param, 0u %10:void = call %tint_store_and_preserve_padding_1, %8, %9 @@ -824,8 +824,8 @@ ret } } -%tint_store_and_preserve_padding_1 = func(%target_1:ptr<storage, mat3x3<f32>, read_write>, %value_param_1:mat3x3<f32>):void -> %b4 { # %tint_store_and_preserve_padding_1: 'tint_store_and_preserve_padding', %target_1: 'target', %value_param_1: 'value_param' - %b4 = block { +%tint_store_and_preserve_padding_1 = func(%target_1:ptr<storage, mat3x3<f32>, read_write>, %value_param_1:mat3x3<f32>):void { # %tint_store_and_preserve_padding_1: 'tint_store_and_preserve_padding', %target_1: 'target', %value_param_1: 'value_param' + $B4: { %17:ptr<storage, vec3<f32>, read_write> = access %target_1, 0u %18:vec3<f32> = access %value_param_1, 0u store %17, %18 @@ -862,12 +862,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, array<mat3x3<f32>, 4>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:array<mat3x3<f32>, 4>):void -> %b2 { - %b2 = block { +%foo = func(%value:array<mat3x3<f32>, 4>):void { + $B2: { store %buffer, %value ret } @@ -876,44 +876,44 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, array<mat3x3<f32>, 4>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:array<mat3x3<f32>, 4>):void -> %b2 { - %b2 = block { +%foo = func(%value:array<mat3x3<f32>, 4>):void { + $B2: { %4:void = call %tint_store_and_preserve_padding, %buffer, %value ret } } -%tint_store_and_preserve_padding = func(%target:ptr<storage, array<mat3x3<f32>, 4>, read_write>, %value_param:array<mat3x3<f32>, 4>):void -> %b3 { - %b3 = block { - loop [i: %b4, b: %b5, c: %b6] { # loop_1 - %b4 = block { # initializer - next_iteration %b5 0u +%tint_store_and_preserve_padding = func(%target:ptr<storage, array<mat3x3<f32>, 4>, read_write>, %value_param:array<mat3x3<f32>, 4>):void { + $B3: { + loop [i: $B4, b: $B5, c: $B6] { # loop_1 + $B4: { # initializer + next_iteration 0u # -> $B5 } - %b5 = block (%idx:u32) { # body + $B5 (%idx:u32): { # body %9:bool = gte %idx:u32, 4u - if %9 [t: %b7] { # if_1 - %b7 = block { # true + if %9 [t: $B7] { # if_1 + $B7: { # true exit_loop # loop_1 } } %10:ptr<storage, mat3x3<f32>, read_write> = access %target, %idx:u32 %11:mat3x3<f32> = access %value_param, %idx:u32 %12:void = call %tint_store_and_preserve_padding_1, %10, %11 - continue %b6 + continue # -> $B6 } - %b6 = block { # continuing + $B6: { # continuing %14:u32 = add %idx:u32, 1u - next_iteration %b5 %14 + next_iteration %14 # -> $B5 } } ret } } -%tint_store_and_preserve_padding_1 = func(%target_1:ptr<storage, mat3x3<f32>, read_write>, %value_param_1:mat3x3<f32>):void -> %b8 { # %tint_store_and_preserve_padding_1: 'tint_store_and_preserve_padding', %target_1: 'target', %value_param_1: 'value_param' - %b8 = block { +%tint_store_and_preserve_padding_1 = func(%target_1:ptr<storage, mat3x3<f32>, read_write>, %value_param_1:mat3x3<f32>):void { # %tint_store_and_preserve_padding_1: 'tint_store_and_preserve_padding', %target_1: 'target', %value_param_1: 'value_param' + $B8: { %17:ptr<storage, vec3<f32>, read_write> = access %target_1, 0u %18:vec3<f32> = access %value_param_1, 0u store %17, %18 @@ -949,12 +949,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, array<vec3<f32>, 4>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:array<vec3<f32>, 4>):void -> %b2 { - %b2 = block { +%foo = func(%value:array<vec3<f32>, 4>):void { + $B2: { store %buffer, %value ret } @@ -963,37 +963,37 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, array<vec3<f32>, 4>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:array<vec3<f32>, 4>):void -> %b2 { - %b2 = block { +%foo = func(%value:array<vec3<f32>, 4>):void { + $B2: { %4:void = call %tint_store_and_preserve_padding, %buffer, %value ret } } -%tint_store_and_preserve_padding = func(%target:ptr<storage, array<vec3<f32>, 4>, read_write>, %value_param:array<vec3<f32>, 4>):void -> %b3 { - %b3 = block { - loop [i: %b4, b: %b5, c: %b6] { # loop_1 - %b4 = block { # initializer - next_iteration %b5 0u +%tint_store_and_preserve_padding = func(%target:ptr<storage, array<vec3<f32>, 4>, read_write>, %value_param:array<vec3<f32>, 4>):void { + $B3: { + loop [i: $B4, b: $B5, c: $B6] { # loop_1 + $B4: { # initializer + next_iteration 0u # -> $B5 } - %b5 = block (%idx:u32) { # body + $B5 (%idx:u32): { # body %9:bool = gte %idx:u32, 4u - if %9 [t: %b7] { # if_1 - %b7 = block { # true + if %9 [t: $B7] { # if_1 + $B7: { # true exit_loop # loop_1 } } %10:ptr<storage, vec3<f32>, read_write> = access %target, %idx:u32 %11:vec3<f32> = access %value_param, %idx:u32 store %10, %11 - continue %b6 + continue # -> $B6 } - %b6 = block { # continuing + $B6: { # continuing %12:u32 = add %idx:u32, 1u - next_iteration %b5 %12 + next_iteration %12 # -> $B5 } } ret @@ -1050,12 +1050,12 @@ b_1:u32 @offset(736) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, array<Outer, 3>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:array<Outer, 3>):void -> %b2 { - %b2 = block { +%foo = func(%value:array<Outer, 3>):void { + $B2: { store %buffer, %value ret } @@ -1078,44 +1078,44 @@ b_1:u32 @offset(736) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, array<Outer, 3>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:array<Outer, 3>):void -> %b2 { - %b2 = block { +%foo = func(%value:array<Outer, 3>):void { + $B2: { %4:void = call %tint_store_and_preserve_padding, %buffer, %value ret } } -%tint_store_and_preserve_padding = func(%target:ptr<storage, array<Outer, 3>, read_write>, %value_param:array<Outer, 3>):void -> %b3 { - %b3 = block { - loop [i: %b4, b: %b5, c: %b6] { # loop_1 - %b4 = block { # initializer - next_iteration %b5 0u +%tint_store_and_preserve_padding = func(%target:ptr<storage, array<Outer, 3>, read_write>, %value_param:array<Outer, 3>):void { + $B3: { + loop [i: $B4, b: $B5, c: $B6] { # loop_1 + $B4: { # initializer + next_iteration 0u # -> $B5 } - %b5 = block (%idx:u32) { # body + $B5 (%idx:u32): { # body %9:bool = gte %idx:u32, 3u - if %9 [t: %b7] { # if_1 - %b7 = block { # true + if %9 [t: $B7] { # if_1 + $B7: { # true exit_loop # loop_1 } } %10:ptr<storage, Outer, read_write> = access %target, %idx:u32 %11:Outer = access %value_param, %idx:u32 %12:void = call %tint_store_and_preserve_padding_1, %10, %11 - continue %b6 + continue # -> $B6 } - %b6 = block { # continuing + $B6: { # continuing %14:u32 = add %idx:u32, 1u - next_iteration %b5 %14 + next_iteration %14 # -> $B5 } } ret } } -%tint_store_and_preserve_padding_1 = func(%target_1:ptr<storage, Outer, read_write>, %value_param_1:Outer):void -> %b8 { # %tint_store_and_preserve_padding_1: 'tint_store_and_preserve_padding', %target_1: 'target', %value_param_1: 'value_param' - %b8 = block { +%tint_store_and_preserve_padding_1 = func(%target_1:ptr<storage, Outer, read_write>, %value_param_1:Outer):void { # %tint_store_and_preserve_padding_1: 'tint_store_and_preserve_padding', %target_1: 'target', %value_param_1: 'value_param' + $B8: { %17:ptr<storage, u32, read_write> = access %target_1, 0u %18:u32 = access %value_param_1, 0u store %17, %18 @@ -1131,8 +1131,8 @@ ret } } -%tint_store_and_preserve_padding_2 = func(%target_2:ptr<storage, Inner, read_write>, %value_param_2:Inner):void -> %b9 { # %tint_store_and_preserve_padding_2: 'tint_store_and_preserve_padding', %target_2: 'target', %value_param_2: 'value_param' - %b9 = block { +%tint_store_and_preserve_padding_2 = func(%target_2:ptr<storage, Inner, read_write>, %value_param_2:Inner):void { # %tint_store_and_preserve_padding_2: 'tint_store_and_preserve_padding', %target_2: 'target', %value_param_2: 'value_param' + $B9: { %31:ptr<storage, u32, read_write> = access %target_2, 0u %32:u32 = access %value_param_2, 0u store %31, %32 @@ -1148,34 +1148,34 @@ ret } } -%tint_store_and_preserve_padding_4 = func(%target_3:ptr<storage, array<vec3<f32>, 4>, read_write>, %value_param_3:array<vec3<f32>, 4>):void -> %b10 { # %tint_store_and_preserve_padding_4: 'tint_store_and_preserve_padding', %target_3: 'target', %value_param_3: 'value_param' - %b10 = block { - loop [i: %b11, b: %b12, c: %b13] { # loop_2 - %b11 = block { # initializer - next_iteration %b12 0u +%tint_store_and_preserve_padding_4 = func(%target_3:ptr<storage, array<vec3<f32>, 4>, read_write>, %value_param_3:array<vec3<f32>, 4>):void { # %tint_store_and_preserve_padding_4: 'tint_store_and_preserve_padding', %target_3: 'target', %value_param_3: 'value_param' + $B10: { + loop [i: $B11, b: $B12, c: $B13] { # loop_2 + $B11: { # initializer + next_iteration 0u # -> $B12 } - %b12 = block (%idx_1:u32) { # body + $B12 (%idx_1:u32): { # body %46:bool = gte %idx_1:u32, 4u - if %46 [t: %b14] { # if_2 - %b14 = block { # true + if %46 [t: $B14] { # if_2 + $B14: { # true exit_loop # loop_2 } } %47:ptr<storage, vec3<f32>, read_write> = access %target_3, %idx_1:u32 %48:vec3<f32> = access %value_param_3, %idx_1:u32 store %47, %48 - continue %b13 + continue # -> $B13 } - %b13 = block { # continuing + $B13: { # continuing %49:u32 = add %idx_1:u32, 1u - next_iteration %b12 %49 + next_iteration %49 # -> $B12 } } ret } } -%tint_store_and_preserve_padding_5 = func(%target_4:ptr<storage, mat3x3<f32>, read_write>, %value_param_4:mat3x3<f32>):void -> %b15 { # %tint_store_and_preserve_padding_5: 'tint_store_and_preserve_padding', %target_4: 'target', %value_param_4: 'value_param' - %b15 = block { +%tint_store_and_preserve_padding_5 = func(%target_4:ptr<storage, mat3x3<f32>, read_write>, %value_param_4:mat3x3<f32>):void { # %tint_store_and_preserve_padding_5: 'tint_store_and_preserve_padding', %target_4: 'target', %value_param_4: 'value_param' + $B15: { %52:ptr<storage, vec3<f32>, read_write> = access %target_4, 0u %53:vec3<f32> = access %value_param_4, 0u store %52, %53 @@ -1188,27 +1188,27 @@ ret } } -%tint_store_and_preserve_padding_3 = func(%target_5:ptr<storage, array<Inner, 4>, read_write>, %value_param_5:array<Inner, 4>):void -> %b16 { # %tint_store_and_preserve_padding_3: 'tint_store_and_preserve_padding', %target_5: 'target', %value_param_5: 'value_param' - %b16 = block { - loop [i: %b17, b: %b18, c: %b19] { # loop_3 - %b17 = block { # initializer - next_iteration %b18 0u +%tint_store_and_preserve_padding_3 = func(%target_5:ptr<storage, array<Inner, 4>, read_write>, %value_param_5:array<Inner, 4>):void { # %tint_store_and_preserve_padding_3: 'tint_store_and_preserve_padding', %target_5: 'target', %value_param_5: 'value_param' + $B16: { + loop [i: $B17, b: $B18, c: $B19] { # loop_3 + $B17: { # initializer + next_iteration 0u # -> $B18 } - %b18 = block (%idx_2:u32) { # body + $B18 (%idx_2:u32): { # body %61:bool = gte %idx_2:u32, 4u - if %61 [t: %b20] { # if_3 - %b20 = block { # true + if %61 [t: $B20] { # if_3 + $B20: { # true exit_loop # loop_3 } } %62:ptr<storage, Inner, read_write> = access %target_5, %idx_2:u32 %63:Inner = access %value_param_5, %idx_2:u32 %64:void = call %tint_store_and_preserve_padding_2, %62, %63 - continue %b19 + continue # -> $B19 } - %b19 = block { # continuing + $B19: { # continuing %65:u32 = add %idx_2:u32, 1u - next_iteration %b18 %65 + next_iteration %65 # -> $B18 } } ret @@ -1241,12 +1241,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, array<mat3x3<f32>, 4>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:mat3x3<f32>):void -> %b2 { - %b2 = block { +%foo = func(%value:mat3x3<f32>):void { + $B2: { %4:ptr<storage, mat3x3<f32>, read_write> = access %buffer, 0u store %4, %value %5:ptr<storage, mat3x3<f32>, read_write> = access %buffer, 1u @@ -1262,12 +1262,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, array<mat3x3<f32>, 4>, read_write> = var @binding_point(0, 0) } -%foo = func(%value:mat3x3<f32>):void -> %b2 { - %b2 = block { +%foo = func(%value:mat3x3<f32>):void { + $B2: { %4:ptr<storage, mat3x3<f32>, read_write> = access %buffer, 0u %5:void = call %tint_store_and_preserve_padding, %4, %value %7:ptr<storage, mat3x3<f32>, read_write> = access %buffer, 1u @@ -1279,8 +1279,8 @@ ret } } -%tint_store_and_preserve_padding = func(%target:ptr<storage, mat3x3<f32>, read_write>, %value_param:mat3x3<f32>):void -> %b3 { - %b3 = block { +%tint_store_and_preserve_padding = func(%target:ptr<storage, mat3x3<f32>, read_write>, %value_param:mat3x3<f32>):void { + $B3: { %15:ptr<storage, vec3<f32>, read_write> = access %target, 0u %16:vec3<f32> = access %value_param, 0u store %15, %16
diff --git a/src/tint/lang/core/ir/transform/robustness_test.cc b/src/tint/lang/core/ir/transform/robustness_test.cc index 5865509..1829c79 100644 --- a/src/tint/lang/core/ir/transform/robustness_test.cc +++ b/src/tint/lang/core/ir/transform/robustness_test.cc
@@ -66,8 +66,8 @@ }); auto* src = R"( -%foo = func():u32 -> %b1 { - %b1 = block { +%foo = func():u32 { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %3:u32 = load_vector_element %vec, 5u ret %3 @@ -77,8 +77,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():u32 -> %b1 { - %b1 = block { +%foo = func():u32 { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %3:u32 = load_vector_element %vec, 3u ret %3 @@ -103,8 +103,8 @@ }); auto* src = R"( -%foo = func():u32 -> %b1 { - %b1 = block { +%foo = func():u32 { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %idx:u32 = let 5u %4:u32 = load_vector_element %vec, %idx @@ -115,8 +115,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():u32 -> %b1 { - %b1 = block { +%foo = func():u32 { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %idx:u32 = let 5u %4:u32 = min %idx, 3u @@ -144,8 +144,8 @@ }); auto* src = R"( -%foo = func(%idx:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:u32):u32 { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %4:u32 = load_vector_element %vec, %idx ret %4 @@ -155,8 +155,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%idx:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:u32):u32 { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %4:u32 = min %idx, 3u %5:u32 = load_vector_element %vec, %4 @@ -183,8 +183,8 @@ }); auto* src = R"( -%foo = func(%idx:i32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:i32):u32 { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %4:u32 = load_vector_element %vec, %idx ret %4 @@ -194,8 +194,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%idx:i32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:i32):u32 { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %4:u32 = convert %idx %5:u32 = min %4, 3u @@ -221,8 +221,8 @@ }); auto* src = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var store_vector_element %vec, 5u, 0u ret @@ -232,8 +232,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var store_vector_element %vec, 3u, 0u ret @@ -258,8 +258,8 @@ }); auto* src = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %idx:u32 = let 5u store_vector_element %vec, %idx, 0u @@ -270,8 +270,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %idx:u32 = let 5u %4:u32 = min %idx, 3u @@ -299,8 +299,8 @@ }); auto* src = R"( -%foo = func(%idx:u32):void -> %b1 { - %b1 = block { +%foo = func(%idx:u32):void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var store_vector_element %vec, %idx, 0u ret @@ -310,8 +310,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%idx:u32):void -> %b1 { - %b1 = block { +%foo = func(%idx:u32):void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %4:u32 = min %idx, 3u store_vector_element %vec, %4, 0u @@ -338,8 +338,8 @@ }); auto* src = R"( -%foo = func(%idx:i32):void -> %b1 { - %b1 = block { +%foo = func(%idx:i32):void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var store_vector_element %vec, %idx, 0u ret @@ -349,8 +349,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%idx:i32):void -> %b1 { - %b1 = block { +%foo = func(%idx:i32):void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %4:u32 = convert %idx %5:u32 = min %4, 3u @@ -377,8 +377,8 @@ }); auto* src = R"( -%foo = func():vec4<f32> -> %b1 { - %b1 = block { +%foo = func():vec4<f32> { + $B1: { %mat:ptr<function, mat4x4<f32>, read_write> = var %3:ptr<function, vec4<f32>, read_write> = access %mat, 2u %4:vec4<f32> = load %3 @@ -408,8 +408,8 @@ }); auto* src = R"( -%foo = func():vec4<f32> -> %b1 { - %b1 = block { +%foo = func():vec4<f32> { + $B1: { %mat:ptr<function, mat4x4<f32>, read_write> = var %idx:u32 = let 2u %4:ptr<function, vec4<f32>, read_write> = access %mat, %idx @@ -421,8 +421,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():vec4<f32> -> %b1 { - %b1 = block { +%foo = func():vec4<f32> { + $B1: { %mat:ptr<function, mat4x4<f32>, read_write> = var %idx:u32 = let 2u %4:u32 = min %idx, 3u @@ -452,8 +452,8 @@ }); auto* src = R"( -%foo = func(%idx:u32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%idx:u32):vec4<f32> { + $B1: { %mat:ptr<function, mat4x4<f32>, read_write> = var %4:ptr<function, vec4<f32>, read_write> = access %mat, %idx %5:vec4<f32> = load %4 @@ -464,8 +464,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%idx:u32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%idx:u32):vec4<f32> { + $B1: { %mat:ptr<function, mat4x4<f32>, read_write> = var %4:u32 = min %idx, 3u %5:ptr<function, vec4<f32>, read_write> = access %mat, %4 @@ -494,8 +494,8 @@ }); auto* src = R"( -%foo = func(%idx:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%idx:i32):vec4<f32> { + $B1: { %mat:ptr<function, mat4x4<f32>, read_write> = var %4:ptr<function, vec4<f32>, read_write> = access %mat, %idx %5:vec4<f32> = load %4 @@ -506,8 +506,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%idx:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%idx:i32):vec4<f32> { + $B1: { %mat:ptr<function, mat4x4<f32>, read_write> = var %4:u32 = convert %idx %5:u32 = min %4, 3u @@ -535,8 +535,8 @@ }); auto* src = R"( -%foo = func():u32 -> %b1 { - %b1 = block { +%foo = func():u32 { + $B1: { %arr:ptr<function, array<u32, 4>, read_write> = var %3:ptr<function, u32, read_write> = access %arr, 2u %4:u32 = load %3 @@ -566,8 +566,8 @@ }); auto* src = R"( -%foo = func():u32 -> %b1 { - %b1 = block { +%foo = func():u32 { + $B1: { %arr:ptr<function, array<u32, 4>, read_write> = var %idx:u32 = let 2u %4:ptr<function, u32, read_write> = access %arr, %idx @@ -579,8 +579,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():u32 -> %b1 { - %b1 = block { +%foo = func():u32 { + $B1: { %arr:ptr<function, array<u32, 4>, read_write> = var %idx:u32 = let 2u %4:u32 = min %idx, 3u @@ -610,8 +610,8 @@ }); auto* src = R"( -%foo = func(%idx:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:u32):u32 { + $B1: { %arr:ptr<function, array<u32, 4>, read_write> = var %4:ptr<function, u32, read_write> = access %arr, %idx %5:u32 = load %4 @@ -622,8 +622,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%idx:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:u32):u32 { + $B1: { %arr:ptr<function, array<u32, 4>, read_write> = var %4:u32 = min %idx, 3u %5:ptr<function, u32, read_write> = access %arr, %4 @@ -652,8 +652,8 @@ }); auto* src = R"( -%foo = func(%idx:i32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:i32):u32 { + $B1: { %arr:ptr<function, array<u32, 4>, read_write> = var %4:ptr<function, u32, read_write> = access %arr, %idx %5:u32 = load %4 @@ -664,8 +664,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%idx:i32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:i32):u32 { + $B1: { %arr:ptr<function, array<u32, 4>, read_write> = var %4:u32 = convert %idx %5:u32 = min %4, 3u @@ -699,8 +699,8 @@ }); auto* src = R"( -%foo = func(%idx1:u32, %idx2:u32, %idx3:u32, %idx4:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx1:u32, %idx2:u32, %idx3:u32, %idx4:u32):u32 { + $B1: { %arr:ptr<function, array<array<array<array<u32, 4>, 5>, 6>, 7>, read_write> = var %7:ptr<function, u32, read_write> = access %arr, %idx1, %idx2, %idx3, %idx4 %8:u32 = load %7 @@ -711,8 +711,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%idx1:u32, %idx2:u32, %idx3:u32, %idx4:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx1:u32, %idx2:u32, %idx3:u32, %idx4:u32):u32 { + $B1: { %arr:ptr<function, array<array<array<array<u32, 4>, 5>, 6>, 7>, read_write> = var %7:u32 = min %idx1, 6u %8:u32 = min %idx2, 5u @@ -755,8 +755,8 @@ arr:array<mat3x4<f32>, 4> @offset(0) } -%foo = func(%idx1:u32, %idx2:u32, %idx3:u32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%idx1:u32, %idx2:u32, %idx3:u32):vec4<f32> { + $B1: { %arr:ptr<function, array<structure, 8>, read_write> = var %6:ptr<function, vec4<f32>, read_write> = access %arr, %idx1, 0u, %idx2, %idx3 %7:vec4<f32> = load %6 @@ -771,8 +771,8 @@ arr:array<mat3x4<f32>, 4> @offset(0) } -%foo = func(%idx1:u32, %idx2:u32, %idx3:u32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%idx1:u32, %idx2:u32, %idx3:u32):vec4<f32> { + $B1: { %arr:ptr<function, array<structure, 8>, read_write> = var %6:u32 = min %idx1, 7u %7:u32 = min %idx2, 3u @@ -808,12 +808,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<private, vec4<u32>, read_write> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = load_vector_element %vec, %idx ret %4 } @@ -822,12 +822,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<private, vec4<u32>, read_write> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = min %idx, 3u %5:u32 = load_vector_element %vec, %4 ret %5 @@ -855,12 +855,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<private, vec4<u32>, read_write> = var } -%foo = func(%idx:u32):void -> %b2 { - %b2 = block { +%foo = func(%idx:u32):void { + $B2: { store_vector_element %vec, %idx, 0u ret } @@ -869,12 +869,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<private, vec4<u32>, read_write> = var } -%foo = func(%idx:u32):void -> %b2 { - %b2 = block { +%foo = func(%idx:u32):void { + $B2: { %4:u32 = min %idx, 3u store_vector_element %vec, %4, 0u ret @@ -903,12 +903,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<private, array<u32, 4>, read_write> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:ptr<private, u32, read_write> = access %arr, %idx %5:u32 = load %4 ret %5 @@ -918,12 +918,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<private, array<u32, 4>, read_write> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = min %idx, 3u %5:ptr<private, u32, read_write> = access %arr, %4 %6:u32 = load %5 @@ -952,12 +952,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<push_constant, vec4<u32>, read> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = load_vector_element %vec, %idx ret %4 } @@ -966,12 +966,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<push_constant, vec4<u32>, read> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = min %idx, 3u %5:u32 = load_vector_element %vec, %4 ret %5 @@ -999,12 +999,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<push_constant, vec4<u32>, read> = var } -%foo = func(%idx:u32):void -> %b2 { - %b2 = block { +%foo = func(%idx:u32):void { + $B2: { store_vector_element %vec, %idx, 0u ret } @@ -1013,12 +1013,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<push_constant, vec4<u32>, read> = var } -%foo = func(%idx:u32):void -> %b2 { - %b2 = block { +%foo = func(%idx:u32):void { + $B2: { %4:u32 = min %idx, 3u store_vector_element %vec, %4, 0u ret @@ -1047,12 +1047,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<push_constant, array<u32, 4>, read> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:ptr<push_constant, u32, read> = access %arr, %idx %5:u32 = load %4 ret %5 @@ -1062,12 +1062,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<push_constant, array<u32, 4>, read> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = min %idx, 3u %5:ptr<push_constant, u32, read> = access %arr, %4 %6:u32 = load %5 @@ -1097,12 +1097,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<storage, vec4<u32>, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = load_vector_element %vec, %idx ret %4 } @@ -1111,12 +1111,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<storage, vec4<u32>, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = min %idx, 3u %5:u32 = load_vector_element %vec, %4 ret %5 @@ -1145,12 +1145,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<storage, vec4<u32>, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):void -> %b2 { - %b2 = block { +%foo = func(%idx:u32):void { + $B2: { store_vector_element %vec, %idx, 0u ret } @@ -1159,12 +1159,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<storage, vec4<u32>, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):void -> %b2 { - %b2 = block { +%foo = func(%idx:u32):void { + $B2: { %4:u32 = min %idx, 3u store_vector_element %vec, %4, 0u ret @@ -1194,12 +1194,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<storage, array<u32, 4>, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:ptr<storage, u32, read_write> = access %arr, %idx %5:u32 = load %4 ret %5 @@ -1209,12 +1209,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<storage, array<u32, 4>, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = min %idx, 3u %5:ptr<storage, u32, read_write> = access %arr, %4 %6:u32 = load %5 @@ -1244,12 +1244,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<uniform, vec4<u32>, read> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = load_vector_element %vec, %idx ret %4 } @@ -1258,12 +1258,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<uniform, vec4<u32>, read> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = min %idx, 3u %5:u32 = load_vector_element %vec, %4 ret %5 @@ -1292,12 +1292,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<uniform, vec4<u32>, read> = var @binding_point(0, 0) } -%foo = func(%idx:u32):void -> %b2 { - %b2 = block { +%foo = func(%idx:u32):void { + $B2: { store_vector_element %vec, %idx, 0u ret } @@ -1306,12 +1306,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<uniform, vec4<u32>, read> = var @binding_point(0, 0) } -%foo = func(%idx:u32):void -> %b2 { - %b2 = block { +%foo = func(%idx:u32):void { + $B2: { %4:u32 = min %idx, 3u store_vector_element %vec, %4, 0u ret @@ -1341,12 +1341,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<uniform, array<u32, 4>, read> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:ptr<uniform, u32, read> = access %arr, %idx %5:u32 = load %4 ret %5 @@ -1356,12 +1356,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<uniform, array<u32, 4>, read> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = min %idx, 3u %5:ptr<uniform, u32, read> = access %arr, %4 %6:u32 = load %5 @@ -1390,12 +1390,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<workgroup, vec4<u32>, read_write> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = load_vector_element %vec, %idx ret %4 } @@ -1404,12 +1404,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<workgroup, vec4<u32>, read_write> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = min %idx, 3u %5:u32 = load_vector_element %vec, %4 ret %5 @@ -1437,12 +1437,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<workgroup, vec4<u32>, read_write> = var } -%foo = func(%idx:u32):void -> %b2 { - %b2 = block { +%foo = func(%idx:u32):void { + $B2: { store_vector_element %vec, %idx, 0u ret } @@ -1451,12 +1451,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %vec:ptr<workgroup, vec4<u32>, read_write> = var } -%foo = func(%idx:u32):void -> %b2 { - %b2 = block { +%foo = func(%idx:u32):void { + $B2: { %4:u32 = min %idx, 3u store_vector_element %vec, %4, 0u ret @@ -1485,12 +1485,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<workgroup, array<u32, 4>, read_write> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:ptr<workgroup, u32, read_write> = access %arr, %idx %5:u32 = load %4 ret %5 @@ -1500,12 +1500,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<workgroup, array<u32, 4>, read_write> = var } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = min %idx, 3u %5:ptr<workgroup, u32, read_write> = access %arr, %4 %6:u32 = load %5 @@ -1541,8 +1541,8 @@ }); auto* src = R"( -%foo = func(%idx:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:u32):u32 { + $B1: { %3:u32 = access vec4<u32>(1u, 2u, 3u, 4u), %idx ret %3 } @@ -1551,8 +1551,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%idx:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:u32):u32 { + $B1: { %3:u32 = min %idx, 3u %4:u32 = access vec4<u32>(1u, 2u, 3u, 4u), %3 ret %4 @@ -1584,8 +1584,8 @@ }); auto* src = R"( -%foo = func(%idx:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:u32):u32 { + $B1: { %3:u32 = access array<u32, 4>(1u, 2u, 3u, 4u), %idx ret %3 } @@ -1594,8 +1594,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%idx:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%idx:u32):u32 { + $B1: { %3:u32 = min %idx, 3u %4:u32 = access array<u32, 4>(1u, 2u, 3u, 4u), %3 ret %4 @@ -1621,8 +1621,8 @@ }); auto* src = R"( -%foo = func(%arr:array<u32, 4>, %idx:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arr:array<u32, 4>, %idx:u32):u32 { + $B1: { %4:u32 = access %arr, %idx ret %4 } @@ -1631,8 +1631,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arr:array<u32, 4>, %idx:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arr:array<u32, 4>, %idx:u32):u32 { + $B1: { %4:u32 = min %idx, 3u %5:u32 = access %arr, %4 ret %5 @@ -1666,12 +1666,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<storage, array<u32>, read_write> = var @binding_point(0, 0) } -%foo = func():u32 -> %b2 { - %b2 = block { +%foo = func():u32 { + $B2: { %3:ptr<storage, u32, read_write> = access %arr, 42u %4:u32 = load %3 ret %4 @@ -1681,12 +1681,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<storage, array<u32>, read_write> = var @binding_point(0, 0) } -%foo = func():u32 -> %b2 { - %b2 = block { +%foo = func():u32 { + $B2: { %3:u32 = arrayLength %arr %4:u32 = sub %3, 1u %5:u32 = min 42u, %4 @@ -1719,12 +1719,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<storage, array<u32>, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:ptr<storage, u32, read_write> = access %arr, %idx %5:u32 = load %4 ret %5 @@ -1734,12 +1734,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<storage, array<u32>, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = arrayLength %arr %5:u32 = sub %4, 1u %6:u32 = min %idx, %5 @@ -1779,12 +1779,12 @@ arr:array<u32> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, structure, read_write> = var @binding_point(0, 0) } -%foo = func():u32 -> %b2 { - %b2 = block { +%foo = func():u32 { + $B2: { %3:ptr<storage, u32, read_write> = access %buffer, 0u, 42u %4:u32 = load %3 ret %4 @@ -1798,12 +1798,12 @@ arr:array<u32> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, structure, read_write> = var @binding_point(0, 0) } -%foo = func():u32 -> %b2 { - %b2 = block { +%foo = func():u32 { + $B2: { %3:ptr<storage, array<u32>, read_write> = access %buffer, 0u %4:u32 = arrayLength %3 %5:u32 = sub %4, 1u @@ -1846,12 +1846,12 @@ arr:array<u32> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, structure, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:ptr<storage, u32, read_write> = access %buffer, 0u, %idx %5:u32 = load %4 ret %5 @@ -1865,12 +1865,12 @@ arr:array<u32> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, structure, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:ptr<storage, array<u32>, read_write> = access %buffer, 0u %5:u32 = arrayLength %4 %6:u32 = sub %5, 1u @@ -1904,12 +1904,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<storage, array<u32>, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:ptr<storage, u32, read_write> = access %arr, %idx %5:u32 = load %4 ret %5 @@ -1919,12 +1919,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %arr:ptr<storage, array<u32>, read_write> = var @binding_point(0, 0) } -%foo = func(%idx:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%idx:u32):u32 { + $B2: { %4:u32 = arrayLength %arr %5:u32 = sub %4, 1u %6:u32 = min %idx, %5 @@ -1962,12 +1962,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 0) } -%foo = func():vec2<u32> -> %b2 { - %b2 = block { +%foo = func():vec2<u32> { + $B2: { %3:texture_2d<f32> = load %texture %4:vec2<u32> = textureDimensions %3 ret %4 @@ -2002,12 +2002,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 0) } -%foo = func(%level:u32):vec2<u32> -> %b2 { - %b2 = block { +%foo = func(%level:u32):vec2<u32> { + $B2: { %4:texture_2d<f32> = load %texture %5:vec2<u32> = textureDimensions %4, %level ret %5 @@ -2017,12 +2017,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 0) } -%foo = func(%level:u32):vec2<u32> -> %b2 { - %b2 = block { +%foo = func(%level:u32):vec2<u32> { + $B2: { %4:texture_2d<f32> = load %texture %5:u32 = textureNumLevels %4 %6:u32 = sub %5, 1u @@ -2074,19 +2074,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_1d<f32>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:i32, %level:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:i32, %level:i32):vec4<f32> { + $B2: { %5:texture_1d<f32> = load %texture %6:vec4<f32> = textureLoad %5, %coords, %level ret %6 } } -%load_unsigned = func(%coords_1:u32, %level_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:u32, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %level_1: 'level' + $B3: { %10:texture_1d<f32> = load %texture %11:vec4<f32> = textureLoad %10, %coords_1, %level_1 ret %11 @@ -2096,12 +2096,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_1d<f32>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:i32, %level:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:i32, %level:i32):vec4<f32> { + $B2: { %5:texture_1d<f32> = load %texture %6:u32 = textureDimensions %5 %7:u32 = sub %6, 1u @@ -2115,8 +2115,8 @@ ret %14 } } -%load_unsigned = func(%coords_1:u32, %level_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:u32, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %level_1: 'level' + $B3: { %18:texture_1d<f32> = load %texture %19:u32 = textureDimensions %18 %20:u32 = sub %19, 1u @@ -2171,19 +2171,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %level:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %level:i32):vec4<f32> { + $B2: { %5:texture_2d<f32> = load %texture %6:vec4<f32> = textureLoad %5, %coords, %level ret %6 } } -%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %level_1: 'level' + $B3: { %10:texture_2d<f32> = load %texture %11:vec4<f32> = textureLoad %10, %coords_1, %level_1 ret %11 @@ -2193,12 +2193,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_2d<f32>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %level:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %level:i32):vec4<f32> { + $B2: { %5:texture_2d<f32> = load %texture %6:vec2<u32> = textureDimensions %5 %7:vec2<u32> = sub %6, vec2<u32>(1u) @@ -2212,8 +2212,8 @@ ret %14 } } -%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %level_1: 'level' + $B3: { %18:texture_2d<f32> = load %texture %19:vec2<u32> = textureDimensions %18 %20:vec2<u32> = sub %19, vec2<u32>(1u) @@ -2271,19 +2271,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %layer:i32, %level:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %layer:i32, %level:i32):vec4<f32> { + $B2: { %6:texture_2d_array<f32> = load %texture %7:vec4<f32> = textureLoad %6, %coords, %layer, %level ret %7 } } -%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %level_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %layer_1: 'layer', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %layer_1: 'layer', %level_1: 'level' + $B3: { %12:texture_2d_array<f32> = load %texture %13:vec4<f32> = textureLoad %12, %coords_1, %layer_1, %level_1 ret %13 @@ -2293,12 +2293,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_2d_array<f32>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %layer:i32, %level:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %layer:i32, %level:i32):vec4<f32> { + $B2: { %6:texture_2d_array<f32> = load %texture %7:vec2<u32> = textureDimensions %6 %8:vec2<u32> = sub %7, vec2<u32>(1u) @@ -2316,8 +2316,8 @@ ret %19 } } -%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %level_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %layer_1: 'layer', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %layer_1: 'layer', %level_1: 'level' + $B3: { %24:texture_2d_array<f32> = load %texture %25:vec2<u32> = textureDimensions %24 %26:vec2<u32> = sub %25, vec2<u32>(1u) @@ -2375,19 +2375,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_3d<f32>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec3<i32>, %level:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec3<i32>, %level:i32):vec4<f32> { + $B2: { %5:texture_3d<f32> = load %texture %6:vec4<f32> = textureLoad %5, %coords, %level ret %6 } } -%load_unsigned = func(%coords_1:vec3<u32>, %level_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec3<u32>, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %level_1: 'level' + $B3: { %10:texture_3d<f32> = load %texture %11:vec4<f32> = textureLoad %10, %coords_1, %level_1 ret %11 @@ -2397,12 +2397,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_3d<f32>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec3<i32>, %level:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec3<i32>, %level:i32):vec4<f32> { + $B2: { %5:texture_3d<f32> = load %texture %6:vec3<u32> = textureDimensions %5 %7:vec3<u32> = sub %6, vec3<u32>(1u) @@ -2416,8 +2416,8 @@ ret %14 } } -%load_unsigned = func(%coords_1:vec3<u32>, %level_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec3<u32>, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %level_1: 'level' + $B3: { %18:texture_3d<f32> = load %texture %19:vec3<u32> = textureDimensions %18 %20:vec3<u32> = sub %19, vec3<u32>(1u) @@ -2473,19 +2473,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_multisampled_2d<f32>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %level:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %level:i32):vec4<f32> { + $B2: { %5:texture_multisampled_2d<f32> = load %texture %6:vec4<f32> = textureLoad %5, %coords, %level ret %6 } } -%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %level_1: 'level' + $B3: { %10:texture_multisampled_2d<f32> = load %texture %11:vec4<f32> = textureLoad %10, %coords_1, %level_1 ret %11 @@ -2495,12 +2495,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_multisampled_2d<f32>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %level:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %level:i32):vec4<f32> { + $B2: { %5:texture_multisampled_2d<f32> = load %texture %6:vec2<u32> = textureDimensions %5 %7:vec2<u32> = sub %6, vec2<u32>(1u) @@ -2510,8 +2510,8 @@ ret %10 } } -%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %level_1: 'level' + $B3: { %14:texture_multisampled_2d<f32> = load %texture %15:vec2<u32> = textureDimensions %14 %16:vec2<u32> = sub %15, vec2<u32>(1u) @@ -2560,19 +2560,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_depth_2d, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %level:i32):f32 -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %level:i32):f32 { + $B2: { %5:texture_depth_2d = load %texture %6:f32 = textureLoad %5, %coords, %level ret %6 } } -%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):f32 -> %b3 { # %coords_1: 'coords', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):f32 { # %coords_1: 'coords', %level_1: 'level' + $B3: { %10:texture_depth_2d = load %texture %11:f32 = textureLoad %10, %coords_1, %level_1 ret %11 @@ -2582,12 +2582,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_depth_2d, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %level:i32):f32 -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %level:i32):f32 { + $B2: { %5:texture_depth_2d = load %texture %6:vec2<u32> = textureDimensions %5 %7:vec2<u32> = sub %6, vec2<u32>(1u) @@ -2601,8 +2601,8 @@ ret %14 } } -%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):f32 -> %b3 { # %coords_1: 'coords', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):f32 { # %coords_1: 'coords', %level_1: 'level' + $B3: { %18:texture_depth_2d = load %texture %19:vec2<u32> = textureDimensions %18 %20:vec2<u32> = sub %19, vec2<u32>(1u) @@ -2659,19 +2659,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_depth_2d_array, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %layer:i32, %level:i32):f32 -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %layer:i32, %level:i32):f32 { + $B2: { %6:texture_depth_2d_array = load %texture %7:f32 = textureLoad %6, %coords, %layer, %level ret %7 } } -%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %level_1:u32):f32 -> %b3 { # %coords_1: 'coords', %layer_1: 'layer', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %level_1:u32):f32 { # %coords_1: 'coords', %layer_1: 'layer', %level_1: 'level' + $B3: { %12:texture_depth_2d_array = load %texture %13:f32 = textureLoad %12, %coords_1, %layer_1, %level_1 ret %13 @@ -2681,12 +2681,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_depth_2d_array, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %layer:i32, %level:i32):f32 -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %layer:i32, %level:i32):f32 { + $B2: { %6:texture_depth_2d_array = load %texture %7:vec2<u32> = textureDimensions %6 %8:vec2<u32> = sub %7, vec2<u32>(1u) @@ -2704,8 +2704,8 @@ ret %19 } } -%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %level_1:u32):f32 -> %b3 { # %coords_1: 'coords', %layer_1: 'layer', %level_1: 'level' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %level_1:u32):f32 { # %coords_1: 'coords', %layer_1: 'layer', %level_1: 'level' + $B3: { %24:texture_depth_2d_array = load %texture %25:vec2<u32> = textureDimensions %24 %26:vec2<u32> = sub %25, vec2<u32>(1u) @@ -2761,19 +2761,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_depth_multisampled_2d, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %index:i32):f32 -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %index:i32):f32 { + $B2: { %5:texture_depth_multisampled_2d = load %texture %6:f32 = textureLoad %5, %coords, %index ret %6 } } -%load_unsigned = func(%coords_1:vec2<u32>, %index_1:u32):f32 -> %b3 { # %coords_1: 'coords', %index_1: 'index' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %index_1:u32):f32 { # %coords_1: 'coords', %index_1: 'index' + $B3: { %10:texture_depth_multisampled_2d = load %texture %11:f32 = textureLoad %10, %coords_1, %index_1 ret %11 @@ -2783,12 +2783,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_depth_multisampled_2d, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %index:i32):f32 -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %index:i32):f32 { + $B2: { %5:texture_depth_multisampled_2d = load %texture %6:vec2<u32> = textureDimensions %5 %7:vec2<u32> = sub %6, vec2<u32>(1u) @@ -2798,8 +2798,8 @@ ret %10 } } -%load_unsigned = func(%coords_1:vec2<u32>, %index_1:u32):f32 -> %b3 { # %coords_1: 'coords', %index_1: 'index' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %index_1:u32):f32 { # %coords_1: 'coords', %index_1: 'index' + $B3: { %14:texture_depth_multisampled_2d = load %texture %15:vec2<u32> = textureDimensions %14 %16:vec2<u32> = sub %15, vec2<u32>(1u) @@ -2845,19 +2845,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_external, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>):vec4<f32> { + $B2: { %4:texture_external = load %texture %5:vec4<f32> = textureLoad %4, %coords ret %5 } } -%load_unsigned = func(%coords_1:vec2<u32>):vec4<f32> -> %b3 { # %coords_1: 'coords' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>):vec4<f32> { # %coords_1: 'coords' + $B3: { %8:texture_external = load %texture %9:vec4<f32> = textureLoad %8, %coords_1 ret %9 @@ -2867,12 +2867,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_external, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>):vec4<f32> { + $B2: { %4:texture_external = load %texture %5:vec2<u32> = textureDimensions %4 %6:vec2<u32> = sub %5, vec2<u32>(1u) @@ -2882,8 +2882,8 @@ ret %9 } } -%load_unsigned = func(%coords_1:vec2<u32>):vec4<f32> -> %b3 { # %coords_1: 'coords' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>):vec4<f32> { # %coords_1: 'coords' + $B3: { %12:texture_external = load %texture %13:vec2<u32> = textureDimensions %12 %14:vec2<u32> = sub %13, vec2<u32>(1u) @@ -2935,19 +2935,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_1d<rgba8unorm, read_write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:i32):vec4<f32> { + $B2: { %4:texture_storage_1d<rgba8unorm, read_write> = load %texture %5:vec4<f32> = textureLoad %4, %coords ret %5 } } -%load_unsigned = func(%coords_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords' - %b3 = block { +%load_unsigned = func(%coords_1:u32):vec4<f32> { # %coords_1: 'coords' + $B3: { %8:texture_storage_1d<rgba8unorm, read_write> = load %texture %9:vec4<f32> = textureLoad %8, %coords_1 ret %9 @@ -2957,12 +2957,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_1d<rgba8unorm, read_write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:i32):vec4<f32> { + $B2: { %4:texture_storage_1d<rgba8unorm, read_write> = load %texture %5:u32 = textureDimensions %4 %6:u32 = sub %5, 1u @@ -2972,8 +2972,8 @@ ret %9 } } -%load_unsigned = func(%coords_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords' - %b3 = block { +%load_unsigned = func(%coords_1:u32):vec4<f32> { # %coords_1: 'coords' + $B3: { %12:texture_storage_1d<rgba8unorm, read_write> = load %texture %13:u32 = textureDimensions %12 %14:u32 = sub %13, 1u @@ -3025,19 +3025,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<rgba8unorm, read_write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>):vec4<f32> { + $B2: { %4:texture_storage_2d<rgba8unorm, read_write> = load %texture %5:vec4<f32> = textureLoad %4, %coords ret %5 } } -%load_unsigned = func(%coords_1:vec2<u32>):vec4<f32> -> %b3 { # %coords_1: 'coords' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>):vec4<f32> { # %coords_1: 'coords' + $B3: { %8:texture_storage_2d<rgba8unorm, read_write> = load %texture %9:vec4<f32> = textureLoad %8, %coords_1 ret %9 @@ -3047,12 +3047,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<rgba8unorm, read_write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>):vec4<f32> { + $B2: { %4:texture_storage_2d<rgba8unorm, read_write> = load %texture %5:vec2<u32> = textureDimensions %4 %6:vec2<u32> = sub %5, vec2<u32>(1u) @@ -3062,8 +3062,8 @@ ret %9 } } -%load_unsigned = func(%coords_1:vec2<u32>):vec4<f32> -> %b3 { # %coords_1: 'coords' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>):vec4<f32> { # %coords_1: 'coords' + $B3: { %12:texture_storage_2d<rgba8unorm, read_write> = load %texture %13:vec2<u32> = textureDimensions %12 %14:vec2<u32> = sub %13, vec2<u32>(1u) @@ -3119,19 +3119,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d_array<rgba8unorm, read_write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %layer:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %layer:i32):vec4<f32> { + $B2: { %5:texture_storage_2d_array<rgba8unorm, read_write> = load %texture %6:vec4<f32> = textureLoad %5, %coords, %layer ret %6 } } -%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %layer_1: 'layer' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32):vec4<f32> { # %coords_1: 'coords', %layer_1: 'layer' + $B3: { %10:texture_storage_2d_array<rgba8unorm, read_write> = load %texture %11:vec4<f32> = textureLoad %10, %coords_1, %layer_1 ret %11 @@ -3141,12 +3141,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d_array<rgba8unorm, read_write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %layer:i32):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %layer:i32):vec4<f32> { + $B2: { %5:texture_storage_2d_array<rgba8unorm, read_write> = load %texture %6:vec2<u32> = textureDimensions %5 %7:vec2<u32> = sub %6, vec2<u32>(1u) @@ -3160,8 +3160,8 @@ ret %14 } } -%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32):vec4<f32> -> %b3 { # %coords_1: 'coords', %layer_1: 'layer' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32):vec4<f32> { # %coords_1: 'coords', %layer_1: 'layer' + $B3: { %18:texture_storage_2d_array<rgba8unorm, read_write> = load %texture %19:vec2<u32> = textureDimensions %18 %20:vec2<u32> = sub %19, vec2<u32>(1u) @@ -3216,19 +3216,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_3d<rgba8unorm, read_write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec3<i32>):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec3<i32>):vec4<f32> { + $B2: { %4:texture_storage_3d<rgba8unorm, read_write> = load %texture %5:vec4<f32> = textureLoad %4, %coords ret %5 } } -%load_unsigned = func(%coords_1:vec3<u32>):vec4<f32> -> %b3 { # %coords_1: 'coords' - %b3 = block { +%load_unsigned = func(%coords_1:vec3<u32>):vec4<f32> { # %coords_1: 'coords' + $B3: { %8:texture_storage_3d<rgba8unorm, read_write> = load %texture %9:vec4<f32> = textureLoad %8, %coords_1 ret %9 @@ -3238,12 +3238,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_3d<rgba8unorm, read_write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec3<i32>):vec4<f32> -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec3<i32>):vec4<f32> { + $B2: { %4:texture_storage_3d<rgba8unorm, read_write> = load %texture %5:vec3<u32> = textureDimensions %4 %6:vec3<u32> = sub %5, vec3<u32>(1u) @@ -3253,8 +3253,8 @@ ret %9 } } -%load_unsigned = func(%coords_1:vec3<u32>):vec4<f32> -> %b3 { # %coords_1: 'coords' - %b3 = block { +%load_unsigned = func(%coords_1:vec3<u32>):vec4<f32> { # %coords_1: 'coords' + $B3: { %12:texture_storage_3d<rgba8unorm, read_write> = load %texture %13:vec3<u32> = textureDimensions %12 %14:vec3<u32> = sub %13, vec3<u32>(1u) @@ -3308,19 +3308,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_1d<rgba8unorm, write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:i32, %value:vec4<f32>):void -> %b2 { - %b2 = block { +%load_signed = func(%coords:i32, %value:vec4<f32>):void { + $B2: { %5:texture_storage_1d<rgba8unorm, write> = load %texture %6:void = textureStore %5, %coords, %value ret } } -%load_unsigned = func(%coords_1:u32, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%load_unsigned = func(%coords_1:u32, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %10:texture_storage_1d<rgba8unorm, write> = load %texture %11:void = textureStore %10, %coords_1, %value_1 ret @@ -3330,12 +3330,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_1d<rgba8unorm, write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:i32, %value:vec4<f32>):void -> %b2 { - %b2 = block { +%load_signed = func(%coords:i32, %value:vec4<f32>):void { + $B2: { %5:texture_storage_1d<rgba8unorm, write> = load %texture %6:u32 = textureDimensions %5 %7:u32 = sub %6, 1u @@ -3345,8 +3345,8 @@ ret } } -%load_unsigned = func(%coords_1:u32, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%load_unsigned = func(%coords_1:u32, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %14:texture_storage_1d<rgba8unorm, write> = load %texture %15:u32 = textureDimensions %14 %16:u32 = sub %15, 1u @@ -3400,19 +3400,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<rgba8unorm, write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %value:vec4<f32>):void -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %value:vec4<f32>):void { + $B2: { %5:texture_storage_2d<rgba8unorm, write> = load %texture %6:void = textureStore %5, %coords, %value ret } } -%load_unsigned = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %10:texture_storage_2d<rgba8unorm, write> = load %texture %11:void = textureStore %10, %coords_1, %value_1 ret @@ -3422,12 +3422,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d<rgba8unorm, write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %value:vec4<f32>):void -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %value:vec4<f32>):void { + $B2: { %5:texture_storage_2d<rgba8unorm, write> = load %texture %6:vec2<u32> = textureDimensions %5 %7:vec2<u32> = sub %6, vec2<u32>(1u) @@ -3437,8 +3437,8 @@ ret } } -%load_unsigned = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %14:texture_storage_2d<rgba8unorm, write> = load %texture %15:vec2<u32> = textureDimensions %14 %16:vec2<u32> = sub %15, vec2<u32>(1u) @@ -3494,19 +3494,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d_array<rgba8unorm, write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %layer:i32, %value:vec4<f32>):void -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %layer:i32, %value:vec4<f32>):void { + $B2: { %6:texture_storage_2d_array<rgba8unorm, write> = load %texture %7:void = textureStore %6, %coords, %layer, %value ret } } -%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %layer_1: 'layer', %value_1: 'value' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %value_1:vec4<f32>):void { # %coords_1: 'coords', %layer_1: 'layer', %value_1: 'value' + $B3: { %12:texture_storage_2d_array<rgba8unorm, write> = load %texture %13:void = textureStore %12, %coords_1, %layer_1, %value_1 ret @@ -3516,12 +3516,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_2d_array<rgba8unorm, write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec2<i32>, %layer:i32, %value:vec4<f32>):void -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec2<i32>, %layer:i32, %value:vec4<f32>):void { + $B2: { %6:texture_storage_2d_array<rgba8unorm, write> = load %texture %7:vec2<u32> = textureDimensions %6 %8:vec2<u32> = sub %7, vec2<u32>(1u) @@ -3535,8 +3535,8 @@ ret } } -%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %layer_1: 'layer', %value_1: 'value' - %b3 = block { +%load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %value_1:vec4<f32>):void { # %coords_1: 'coords', %layer_1: 'layer', %value_1: 'value' + $B3: { %20:texture_storage_2d_array<rgba8unorm, write> = load %texture %21:vec2<u32> = textureDimensions %20 %22:vec2<u32> = sub %21, vec2<u32>(1u) @@ -3593,19 +3593,19 @@ } auto* src = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_3d<rgba8unorm, write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec3<i32>, %value:vec4<f32>):void -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec3<i32>, %value:vec4<f32>):void { + $B2: { %5:texture_storage_3d<rgba8unorm, write> = load %texture %6:void = textureStore %5, %coords, %value ret } } -%load_unsigned = func(%coords_1:vec3<u32>, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%load_unsigned = func(%coords_1:vec3<u32>, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %10:texture_storage_3d<rgba8unorm, write> = load %texture %11:void = textureStore %10, %coords_1, %value_1 ret @@ -3615,12 +3615,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %texture:ptr<handle, texture_storage_3d<rgba8unorm, write>, read> = var @binding_point(0, 0) } -%load_signed = func(%coords:vec3<i32>, %value:vec4<f32>):void -> %b2 { - %b2 = block { +%load_signed = func(%coords:vec3<i32>, %value:vec4<f32>):void { + $B2: { %5:texture_storage_3d<rgba8unorm, write> = load %texture %6:vec3<u32> = textureDimensions %5 %7:vec3<u32> = sub %6, vec3<u32>(1u) @@ -3630,8 +3630,8 @@ ret } } -%load_unsigned = func(%coords_1:vec3<u32>, %value_1:vec4<f32>):void -> %b3 { # %coords_1: 'coords', %value_1: 'value' - %b3 = block { +%load_unsigned = func(%coords_1:vec3<u32>, %value_1:vec4<f32>):void { # %coords_1: 'coords', %value_1: 'value' + $B3: { %14:texture_storage_3d<rgba8unorm, write> = load %texture %15:vec3<u32> = textureDimensions %14 %16:vec3<u32> = sub %15, vec3<u32>(1u)
diff --git a/src/tint/lang/core/ir/transform/std140_test.cc b/src/tint/lang/core/ir/transform/std140_test.cc index b12a51d..4b819bb 100644 --- a/src/tint/lang/core/ir/transform/std140_test.cc +++ b/src/tint/lang/core/ir/transform/std140_test.cc
@@ -48,8 +48,8 @@ func->Block()->Append(b.Return(func)); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { ret } } @@ -83,12 +83,12 @@ a:mat2x4<f32> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():mat2x4<f32> -> %b2 { - %b2 = block { +%foo = func():mat2x4<f32> { + $B2: { %3:ptr<uniform, mat2x4<f32>, read> = access %buffer, 0u %4:mat2x4<f32> = load %3 ret %4 @@ -127,12 +127,12 @@ a:mat2x4<f32> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<storage, MyStruct, read_write> = var @binding_point(0, 0) } -%foo = func():mat2x4<f32> -> %b2 { - %b2 = block { +%foo = func():mat2x4<f32> { + $B2: { %3:ptr<storage, mat2x4<f32>, read_write> = access %buffer, 0u %4:mat2x4<f32> = load %3 ret %4 @@ -172,12 +172,12 @@ arr:array<mat2x2<f32>, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():mat2x2<f32> -> %b2 { - %b2 = block { +%foo = func():mat2x2<f32> { + $B2: { %3:ptr<uniform, mat2x2<f32>, read> = access %buffer, 0u, 2u %4:mat2x2<f32> = load %3 ret %4 @@ -216,12 +216,12 @@ a:mat3x2<f32> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():mat3x2<f32> -> %b2 { - %b2 = block { +%foo = func():mat3x2<f32> { + $B2: { %3:ptr<uniform, mat3x2<f32>, read> = access %buffer, 0u %4:mat3x2<f32> = load %3 ret %4 @@ -241,12 +241,12 @@ a_col2:vec2<f32> @offset(16) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct_std140, read> = var @binding_point(0, 0) } -%foo = func():mat3x2<f32> -> %b2 { - %b2 = block { +%foo = func():mat3x2<f32> { + $B2: { %3:ptr<uniform, vec2<f32>, read> = access %buffer, 0u %4:vec2<f32> = load %3 %5:ptr<uniform, vec2<f32>, read> = access %buffer, 1u @@ -287,12 +287,12 @@ a:mat3x2<f32> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():vec2<f32> -> %b2 { - %b2 = block { +%foo = func():vec2<f32> { + $B2: { %3:ptr<uniform, vec2<f32>, read> = access %buffer, 0u, 1u %4:vec2<f32> = load %3 ret %4 @@ -312,12 +312,12 @@ a_col2:vec2<f32> @offset(16) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct_std140, read> = var @binding_point(0, 0) } -%foo = func():vec2<f32> -> %b2 { - %b2 = block { +%foo = func():vec2<f32> { + $B2: { %3:ptr<uniform, vec2<f32>, read> = access %buffer, 0u %4:vec2<f32> = load %3 %5:ptr<uniform, vec2<f32>, read> = access %buffer, 1u @@ -359,12 +359,12 @@ a:mat3x2<f32> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():f32 -> %b2 { - %b2 = block { +%foo = func():f32 { + $B2: { %3:ptr<uniform, vec2<f32>, read> = access %buffer, 0u, 1u %4:f32 = load_vector_element %3, 1u ret %4 @@ -384,12 +384,12 @@ a_col2:vec2<f32> @offset(16) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct_std140, read> = var @binding_point(0, 0) } -%foo = func():f32 -> %b2 { - %b2 = block { +%foo = func():f32 { + $B2: { %3:ptr<uniform, vec2<f32>, read> = access %buffer, 0u %4:vec2<f32> = load %3 %5:ptr<uniform, vec2<f32>, read> = access %buffer, 1u @@ -431,12 +431,12 @@ a:mat3x2<f32> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():MyStruct -> %b2 { - %b2 = block { +%foo = func():MyStruct { + $B2: { %3:MyStruct = load %buffer ret %3 } @@ -455,19 +455,19 @@ a_col2:vec2<f32> @offset(16) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct_std140, read> = var @binding_point(0, 0) } -%foo = func():MyStruct -> %b2 { - %b2 = block { +%foo = func():MyStruct { + $B2: { %3:MyStruct_std140 = load %buffer %4:MyStruct = call %convert_MyStruct, %3 ret %4 } } -%convert_MyStruct = func(%input:MyStruct_std140):MyStruct -> %b3 { - %b3 = block { +%convert_MyStruct = func(%input:MyStruct_std140):MyStruct { + $B3: { %7:vec2<f32> = access %input, 0u %8:vec2<f32> = access %input, 1u %9:vec2<f32> = access %input, 2u @@ -513,12 +513,12 @@ arr:array<Inner, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer, read> = var @binding_point(0, 0) } -%foo = func():Outer -> %b2 { - %b2 = block { +%foo = func():Outer { + $B2: { %3:Outer = load %buffer ret %3 } @@ -545,29 +545,29 @@ arr:array<Inner_std140, 4> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer_std140, read> = var @binding_point(0, 0) } -%foo = func():Outer -> %b2 { - %b2 = block { +%foo = func():Outer { + $B2: { %3:Outer_std140 = load %buffer %4:Outer = call %convert_Outer, %3 ret %4 } } -%convert_Outer = func(%input:Outer_std140):Outer -> %b3 { - %b3 = block { +%convert_Outer = func(%input:Outer_std140):Outer { + $B3: { %7:array<Inner_std140, 4> = access %input, 0u %8:ptr<function, array<Inner, 4>, read_write> = var - loop [i: %b4, b: %b5, c: %b6] { # loop_1 - %b4 = block { # initializer - next_iteration %b5 0u + loop [i: $B4, b: $B5, c: $B6] { # loop_1 + $B4: { # initializer + next_iteration 0u # -> $B5 } - %b5 = block (%idx:u32) { # body + $B5 (%idx:u32): { # body %10:bool = gte %idx:u32, 4u - if %10 [t: %b7] { # if_1 - %b7 = block { # true + if %10 [t: $B7] { # if_1 + $B7: { # true exit_loop # loop_1 } } @@ -575,11 +575,11 @@ %12:Inner_std140 = access %7, %idx:u32 %13:Inner = call %convert_Inner, %12 store %11, %13 - continue %b6 + continue # -> $B6 } - %b6 = block { # continuing + $B6: { # continuing %15:u32 = add %idx:u32, 1u - next_iteration %b5 %15 + next_iteration %15 # -> $B5 } } %16:array<Inner, 4> = load %8 @@ -587,8 +587,8 @@ ret %17 } } -%convert_Inner = func(%input_1:Inner_std140):Inner -> %b8 { # %input_1: 'input' - %b8 = block { +%convert_Inner = func(%input_1:Inner_std140):Inner { # %input_1: 'input' + $B8: { %19:vec2<f32> = access %input_1, 0u %20:vec2<f32> = access %input_1, 1u %21:vec2<f32> = access %input_1, 2u @@ -633,12 +633,12 @@ inner:Inner @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer, read> = var @binding_point(0, 0) } -%foo = func():Inner -> %b2 { - %b2 = block { +%foo = func():Inner { + $B2: { %3:ptr<uniform, Inner, read> = access %buffer, 0u %4:Inner = load %3 ret %4 @@ -666,20 +666,20 @@ inner:Inner_std140 @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer_std140, read> = var @binding_point(0, 0) } -%foo = func():Inner -> %b2 { - %b2 = block { +%foo = func():Inner { + $B2: { %3:ptr<uniform, Inner_std140, read> = access %buffer, 0u %4:Inner_std140 = load %3 %5:Inner = call %convert_Inner, %4 ret %5 } } -%convert_Inner = func(%input:Inner_std140):Inner -> %b3 { - %b3 = block { +%convert_Inner = func(%input:Inner_std140):Inner { + $B3: { %8:vec2<f32> = access %input, 0u %9:vec2<f32> = access %input, 1u %10:vec2<f32> = access %input, 2u @@ -725,12 +725,12 @@ inner:Inner @offset(32) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer, read> = var @binding_point(0, 0) } -%foo = func():Outer -> %b2 { - %b2 = block { +%foo = func():Outer { + $B2: { %3:Outer = load %buffer ret %3 } @@ -755,19 +755,19 @@ inner:Inner @offset(32) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer_std140, read> = var @binding_point(0, 0) } -%foo = func():Outer -> %b2 { - %b2 = block { +%foo = func():Outer { + $B2: { %3:Outer_std140 = load %buffer %4:Outer = call %convert_Outer, %3 ret %4 } } -%convert_Outer = func(%input:Outer_std140):Outer -> %b3 { - %b3 = block { +%convert_Outer = func(%input:Outer_std140):Outer { + $B3: { %7:vec2<f32> = access %input, 0u %8:vec2<f32> = access %input, 1u %9:vec2<f32> = access %input, 2u @@ -830,12 +830,12 @@ d:i32 @offset(168) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<Inner, 4>, read> = access %buffer, 1u %4:ptr<uniform, Inner, read> = access %3, 2u %5:ptr<uniform, mat3x2<f32>, read> = access %4, 1u @@ -883,12 +883,12 @@ d:i32 @offset(168) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer_std140, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<Inner_std140, 4>, read> = access %buffer, 1u %4:ptr<uniform, Inner_std140, read> = access %3, 2u %5:ptr<uniform, vec2<f32>, read> = access %4, 1u @@ -901,14 +901,14 @@ %12:vec2<f32> = access %11, 2u %13:array<Inner_std140, 4> = load %3 %14:ptr<function, array<Inner, 4>, read_write> = var - loop [i: %b3, b: %b4, c: %b5] { # loop_1 - %b3 = block { # initializer - next_iteration %b4 0u + loop [i: $B3, b: $B4, c: $B5] { # loop_1 + $B3: { # initializer + next_iteration 0u # -> $B4 } - %b4 = block (%idx:u32) { # body + $B4 (%idx:u32): { # body %16:bool = gte %idx:u32, 4u - if %16 [t: %b6] { # if_1 - %b6 = block { # true + if %16 [t: $B6] { # if_1 + $B6: { # true exit_loop # loop_1 } } @@ -916,11 +916,11 @@ %18:Inner_std140 = access %13, %idx:u32 %19:Inner = call %convert_Inner, %18 store %17, %19 - continue %b5 + continue # -> $B5 } - %b5 = block { # continuing + $B5: { # continuing %21:u32 = add %idx:u32, 1u - next_iteration %b4 %21 + next_iteration %21 # -> $B4 } } %22:array<Inner, 4> = load %14 @@ -935,8 +935,8 @@ ret } } -%convert_Inner = func(%input:Inner_std140):Inner -> %b7 { - %b7 = block { +%convert_Inner = func(%input:Inner_std140):Inner { + $B7: { %32:i32 = access %input, 0u %33:vec2<f32> = access %input, 1u %34:vec2<f32> = access %input, 2u @@ -1001,12 +1001,12 @@ d:i32 @offset(168) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<Inner, 4>, read> = access %buffer, 1u %arr_ptr:ptr<uniform, array<Inner, 4>, read> = let %3 %5:ptr<uniform, Inner, read> = access %arr_ptr, 2u @@ -1058,12 +1058,12 @@ d:i32 @offset(168) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer_std140, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, array<Inner_std140, 4>, read> = access %buffer, 1u %4:ptr<uniform, Inner_std140, read> = access %3, 2u %5:ptr<uniform, vec2<f32>, read> = access %4, 1u @@ -1076,14 +1076,14 @@ %12:vec2<f32> = access %11, 2u %13:array<Inner_std140, 4> = load %3 %14:ptr<function, array<Inner, 4>, read_write> = var - loop [i: %b3, b: %b4, c: %b5] { # loop_1 - %b3 = block { # initializer - next_iteration %b4 0u + loop [i: $B3, b: $B4, c: $B5] { # loop_1 + $B3: { # initializer + next_iteration 0u # -> $B4 } - %b4 = block (%idx:u32) { # body + $B4 (%idx:u32): { # body %16:bool = gte %idx:u32, 4u - if %16 [t: %b6] { # if_1 - %b6 = block { # true + if %16 [t: $B6] { # if_1 + $B6: { # true exit_loop # loop_1 } } @@ -1091,11 +1091,11 @@ %18:Inner_std140 = access %13, %idx:u32 %19:Inner = call %convert_Inner, %18 store %17, %19 - continue %b5 + continue # -> $B5 } - %b5 = block { # continuing + $B5: { # continuing %21:u32 = add %idx:u32, 1u - next_iteration %b4 %21 + next_iteration %21 # -> $B4 } } %22:array<Inner, 4> = load %14 @@ -1110,8 +1110,8 @@ ret } } -%convert_Inner = func(%input:Inner_std140):Inner -> %b7 { - %b7 = block { +%convert_Inner = func(%input:Inner_std140):Inner { + $B7: { %32:i32 = access %input, 0u %33:vec2<f32> = access %input, 1u %34:vec2<f32> = access %input, 2u @@ -1179,12 +1179,12 @@ d:i32 @offset(168) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer, read> = var @binding_point(0, 0) } -%foo = func(%arr_idx:i32, %col_idx:i32, %el_idx:i32):void -> %b2 { - %b2 = block { +%foo = func(%arr_idx:i32, %col_idx:i32, %el_idx:i32):void { + $B2: { %6:ptr<uniform, array<Inner, 4>, read> = access %buffer, 1u %7:ptr<uniform, Inner, read> = access %6, %arr_idx %8:ptr<uniform, mat3x2<f32>, read> = access %7, 1u @@ -1232,12 +1232,12 @@ d:i32 @offset(168) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, Outer_std140, read> = var @binding_point(0, 0) } -%foo = func(%arr_idx:i32, %col_idx:i32, %el_idx:i32):void -> %b2 { - %b2 = block { +%foo = func(%arr_idx:i32, %col_idx:i32, %el_idx:i32):void { + $B2: { %6:ptr<uniform, array<Inner_std140, 4>, read> = access %buffer, 1u %7:ptr<uniform, Inner_std140, read> = access %6, %arr_idx %8:ptr<uniform, vec2<f32>, read> = access %7, 1u @@ -1250,14 +1250,14 @@ %15:vec2<f32> = access %14, %col_idx %16:array<Inner_std140, 4> = load %6 %17:ptr<function, array<Inner, 4>, read_write> = var - loop [i: %b3, b: %b4, c: %b5] { # loop_1 - %b3 = block { # initializer - next_iteration %b4 0u + loop [i: $B3, b: $B4, c: $B5] { # loop_1 + $B3: { # initializer + next_iteration 0u # -> $B4 } - %b4 = block (%idx:u32) { # body + $B4 (%idx:u32): { # body %19:bool = gte %idx:u32, 4u - if %19 [t: %b6] { # if_1 - %b6 = block { # true + if %19 [t: $B6] { # if_1 + $B6: { # true exit_loop # loop_1 } } @@ -1265,11 +1265,11 @@ %21:Inner_std140 = access %16, %idx:u32 %22:Inner = call %convert_Inner, %21 store %20, %22 - continue %b5 + continue # -> $B5 } - %b5 = block { # continuing + $B5: { # continuing %24:u32 = add %idx:u32, 1u - next_iteration %b4 %24 + next_iteration %24 # -> $B4 } } %25:array<Inner, 4> = load %17 @@ -1284,8 +1284,8 @@ ret } } -%convert_Inner = func(%input:Inner_std140):Inner -> %b7 { - %b7 = block { +%convert_Inner = func(%input:Inner_std140):Inner { + $B7: { %35:i32 = access %input, 0u %36:vec2<f32> = access %input, 1u %37:vec2<f32> = access %input, 2u @@ -1340,12 +1340,12 @@ b:i32 @offset(128) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, i32, read> = access %buffer, 0u %4:i32 = load %3 %a:i32 = let %4 @@ -1377,12 +1377,12 @@ b:i32 @offset(128) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct_std140, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:ptr<uniform, i32, read> = access %buffer, 0u %4:i32 = load %3 %a:i32 = let %4 @@ -1432,12 +1432,12 @@ a:mat4x3<f32> @offset(0) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():mat4x3<f32> -> %b2 { - %b2 = block { +%foo = func():mat4x3<f32> { + $B2: { %3:ptr<uniform, mat4x3<f32>, read> = access %buffer, 0u %4:mat4x3<f32> = load %3 ret %4 @@ -1458,12 +1458,12 @@ a_col3:vec3<f32> @offset(48) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct_std140, read> = var @binding_point(0, 0) } -%foo = func():mat4x3<f32> -> %b2 { - %b2 = block { +%foo = func():mat4x3<f32> { + $B2: { %3:ptr<uniform, vec3<f32>, read> = access %buffer, 0u %4:vec3<f32> = load %3 %5:ptr<uniform, vec3<f32>, read> = access %buffer, 1u @@ -1578,65 +1578,65 @@ b:mat3x2<f32> @offset(64) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%load_struct_a = func():mat4x4<f32> -> %b2 { - %b2 = block { +%load_struct_a = func():mat4x4<f32> { + $B2: { %3:MyStruct = load %buffer %4:mat4x4<f32> = access %3, 0u ret %4 } } -%load_struct_b = func():mat3x2<f32> -> %b3 { - %b3 = block { +%load_struct_b = func():mat3x2<f32> { + $B3: { %6:MyStruct = load %buffer %7:mat3x2<f32> = access %6, 1u ret %7 } } -%load_mat_a = func():vec4<f32> -> %b4 { - %b4 = block { +%load_mat_a = func():vec4<f32> { + $B4: { %9:ptr<uniform, mat4x4<f32>, read> = access %buffer, 0u %10:mat4x4<f32> = load %9 %11:vec4<f32> = access %10, 0u ret %11 } } -%load_mat_b = func():vec2<f32> -> %b5 { - %b5 = block { +%load_mat_b = func():vec2<f32> { + $B5: { %13:ptr<uniform, mat3x2<f32>, read> = access %buffer, 1u %14:mat3x2<f32> = load %13 %15:vec2<f32> = access %14, 0u ret %15 } } -%load_vec_a = func():f32 -> %b6 { - %b6 = block { +%load_vec_a = func():f32 { + $B6: { %17:ptr<uniform, vec4<f32>, read> = access %buffer, 0u, 1u %18:vec4<f32> = load %17 %19:f32 = access %18, 1u ret %19 } } -%load_vec_b = func():f32 -> %b7 { - %b7 = block { +%load_vec_b = func():f32 { + $B7: { %21:ptr<uniform, vec2<f32>, read> = access %buffer, 1u, 1u %22:vec2<f32> = load %21 %23:f32 = access %22, 1u ret %23 } } -%lve_a = func():f32 -> %b8 { - %b8 = block { +%lve_a = func():f32 { + $B8: { %25:ptr<uniform, vec4<f32>, read> = access %buffer, 0u, 1u %26:f32 = load_vector_element %25, 1u ret %26 } } -%lve_b = func():f32 -> %b9 { - %b9 = block { +%lve_b = func():f32 { + $B9: { %28:ptr<uniform, vec2<f32>, read> = access %buffer, 1u, 1u %29:f32 = load_vector_element %28, 1u ret %29 @@ -1658,36 +1658,36 @@ b_col2:vec2<f32> @offset(80) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct_std140, read> = var @binding_point(0, 0) } -%load_struct_a = func():mat4x4<f32> -> %b2 { - %b2 = block { +%load_struct_a = func():mat4x4<f32> { + $B2: { %3:MyStruct_std140 = load %buffer %4:MyStruct = call %convert_MyStruct, %3 %6:mat4x4<f32> = access %4, 0u ret %6 } } -%load_struct_b = func():mat3x2<f32> -> %b3 { - %b3 = block { +%load_struct_b = func():mat3x2<f32> { + $B3: { %8:MyStruct_std140 = load %buffer %9:MyStruct = call %convert_MyStruct, %8 %10:mat3x2<f32> = access %9, 1u ret %10 } } -%load_mat_a = func():vec4<f32> -> %b4 { - %b4 = block { +%load_mat_a = func():vec4<f32> { + $B4: { %12:ptr<uniform, mat4x4<f32>, read> = access %buffer, 0u %13:mat4x4<f32> = load %12 %14:vec4<f32> = access %13, 0u ret %14 } } -%load_mat_b = func():vec2<f32> -> %b5 { - %b5 = block { +%load_mat_b = func():vec2<f32> { + $B5: { %16:ptr<uniform, vec2<f32>, read> = access %buffer, 1u %17:vec2<f32> = load %16 %18:ptr<uniform, vec2<f32>, read> = access %buffer, 2u @@ -1699,16 +1699,16 @@ ret %23 } } -%load_vec_a = func():f32 -> %b6 { - %b6 = block { +%load_vec_a = func():f32 { + $B6: { %25:ptr<uniform, vec4<f32>, read> = access %buffer, 0u, 1u %26:vec4<f32> = load %25 %27:f32 = access %26, 1u ret %27 } } -%load_vec_b = func():f32 -> %b7 { - %b7 = block { +%load_vec_b = func():f32 { + $B7: { %29:ptr<uniform, vec2<f32>, read> = access %buffer, 1u %30:vec2<f32> = load %29 %31:ptr<uniform, vec2<f32>, read> = access %buffer, 2u @@ -1721,15 +1721,15 @@ ret %37 } } -%lve_a = func():f32 -> %b8 { - %b8 = block { +%lve_a = func():f32 { + $B8: { %39:ptr<uniform, vec4<f32>, read> = access %buffer, 0u, 1u %40:f32 = load_vector_element %39, 1u ret %40 } } -%lve_b = func():f32 -> %b9 { - %b9 = block { +%lve_b = func():f32 { + $B9: { %42:ptr<uniform, vec2<f32>, read> = access %buffer, 1u %43:vec2<f32> = load %42 %44:ptr<uniform, vec2<f32>, read> = access %buffer, 2u @@ -1742,8 +1742,8 @@ ret %50 } } -%convert_MyStruct = func(%input:MyStruct_std140):MyStruct -> %b10 { - %b10 = block { +%convert_MyStruct = func(%input:MyStruct_std140):MyStruct { + $B10: { %52:mat4x4<f32> = access %input, 0u %53:vec2<f32> = access %input, 1u %54:vec2<f32> = access %input, 2u @@ -1792,12 +1792,12 @@ d:mat4x4<f16> @offset(56) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:MyStruct = load %buffer %struct:MyStruct = let %3 %5:ptr<uniform, mat4x4<f16>, read> = access %buffer, 3u @@ -1838,12 +1838,12 @@ d_col3:vec4<f16> @offset(80) } -%b1 = block { # root +$B1: { # root %buffer:ptr<uniform, MyStruct_std140, read> = var @binding_point(0, 0) } -%foo = func():void -> %b2 { - %b2 = block { +%foo = func():void { + $B2: { %3:MyStruct_std140 = load %buffer %4:MyStruct = call %convert_MyStruct, %3 %struct:MyStruct = let %4 @@ -1879,8 +1879,8 @@ ret } } -%convert_MyStruct = func(%input:MyStruct_std140):MyStruct -> %b3 { - %b3 = block { +%convert_MyStruct = func(%input:MyStruct_std140):MyStruct { + $B3: { %37:vec2<f16> = access %input, 0u %38:vec2<f16> = access %input, 1u %39:mat2x2<f16> = construct %37, %38
diff --git a/src/tint/lang/core/ir/transform/value_to_let_test.cc b/src/tint/lang/core/ir/transform/value_to_let_test.cc index 91e04d9..46e1c12 100644 --- a/src/tint/lang/core/ir/transform/value_to_let_test.cc +++ b/src/tint/lang/core/ir/transform/value_to_let_test.cc
@@ -53,8 +53,8 @@ b.Append(func->Block(), [&] { b.Return(func); }); auto* src = R"( -%F = func():void -> %b1 { - %b1 = block { +%F = func():void { + $B1: { ret } } @@ -78,8 +78,8 @@ }); auto* src = R"( -%F = func():i32 -> %b1 { - %b1 = block { +%F = func():i32 { + $B1: { %x:i32 = let 1i %y:i32 = let 2i %4:i32 = add %x, %y @@ -118,12 +118,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %i:ptr<private, i32, read_write> = var } -%rmw = func(%p:i32):i32 -> %b2 { - %b2 = block { +%rmw = func(%p:i32):i32 { + $B2: { %4:i32 = load %i %5:i32 = add %4, %p %v:i32 = let %5 @@ -131,8 +131,8 @@ ret %v } } -%F = func():i32 -> %b3 { - %b3 = block { +%F = func():i32 { + $B3: { %x:i32 = call %rmw, 1i %y:i32 = select 2i, %x, false ret %y @@ -170,12 +170,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %i:ptr<private, i32, read_write> = var } -%rmw = func(%p:i32):i32 -> %b2 { - %b2 = block { +%rmw = func(%p:i32):i32 { + $B2: { %4:i32 = load %i %5:i32 = add %4, %p %v:i32 = let %5 @@ -183,8 +183,8 @@ ret %v } } -%F = func():i32 -> %b3 { - %b3 = block { +%F = func():i32 { + $B3: { %x:i32 = call %rmw, 1i %y:i32 = call %rmw, %x %z:i32 = call %rmw, %y @@ -223,12 +223,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %i:ptr<private, i32, read_write> = var } -%rmw = func(%p:i32):i32 -> %b2 { - %b2 = block { +%rmw = func(%p:i32):i32 { + $B2: { %4:i32 = load %i %5:i32 = add %4, %p %v:i32 = let %5 @@ -236,8 +236,8 @@ ret %v } } -%F = func():i32 -> %b3 { - %b3 = block { +%F = func():i32 { + $B3: { %8:i32 = call %rmw, 1i %x:i32 = let %8 %y:i32 = add %x, %x @@ -269,14 +269,14 @@ }); auto* src = R"( -%g = func(%p:ptr<function, i32, read_write>):i32 -> %b1 { - %b1 = block { +%g = func(%p:ptr<function, i32, read_write>):i32 { + $B1: { %3:i32 = load %p ret %3 } } -%F = func():i32 -> %b2 { - %b2 = block { +%F = func():i32 { + $B2: { %v:ptr<function, i32, read_write> = var %6:i32 = call %g, %v %x:i32 = let %6 @@ -305,8 +305,8 @@ }); auto* src = R"( -%F = func():i32 -> %b1 { - %b1 = block { +%F = func():i32 { + $B1: { %v:ptr<function, i32, read_write> = var %l:i32 = load %v %4:i32 = add %l, %l @@ -317,8 +317,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%F = func():i32 -> %b1 { - %b1 = block { +%F = func():i32 { + $B1: { %v:ptr<function, i32, read_write> = var %3:i32 = load %v %l:i32 = let %3 @@ -343,8 +343,8 @@ }); auto* src = R"( -%F = func():i32 -> %b1 { - %b1 = block { +%F = func():i32 { + $B1: { %v:ptr<function, i32, read_write> = var %l:i32 = load %v store %v, 1i @@ -355,8 +355,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%F = func():i32 -> %b1 { - %b1 = block { +%F = func():i32 { + $B1: { %v:ptr<function, i32, read_write> = var %3:i32 = load %v %l:i32 = let %3 @@ -393,12 +393,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %i:ptr<private, i32, read_write> = var } -%rmw = func(%p:i32):i32 -> %b2 { - %b2 = block { +%rmw = func(%p:i32):i32 { + $B2: { %4:i32 = load %i %5:i32 = add %4, %p %v:i32 = let %5 @@ -406,8 +406,8 @@ ret %v } } -%F = func():i32 -> %b3 { - %b3 = block { +%F = func():i32 { + $B3: { %x:i32 = call %rmw, 1i %y:i32 = call %rmw, 2i %z:i32 = add %x, %y @@ -418,12 +418,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %i:ptr<private, i32, read_write> = var } -%rmw = func(%p:i32):i32 -> %b2 { - %b2 = block { +%rmw = func(%p:i32):i32 { + $B2: { %4:i32 = load %i %5:i32 = add %4, %p %v:i32 = let %5 @@ -431,8 +431,8 @@ ret %v } } -%F = func():i32 -> %b3 { - %b3 = block { +%F = func():i32 { + $B3: { %8:i32 = call %rmw, 1i %x:i32 = let %8 %y:i32 = call %rmw, 2i @@ -475,12 +475,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %i:ptr<private, i32, read_write> = var } -%rmw = func(%p:i32):i32 -> %b2 { - %b2 = block { +%rmw = func(%p:i32):i32 { + $B2: { %4:i32 = load %i %5:i32 = add %4, %p %v:i32 = let %5 @@ -488,11 +488,11 @@ ret %v } } -%F = func():i32 -> %b3 { - %b3 = block { +%F = func():i32 { + $B3: { %x:i32 = call %rmw, 1i - if true [t: %b4] { # if_1 - %b4 = block { # true + if true [t: $B4] { # if_1 + $B4: { # true ret %x } } @@ -503,12 +503,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %i:ptr<private, i32, read_write> = var } -%rmw = func(%p:i32):i32 -> %b2 { - %b2 = block { +%rmw = func(%p:i32):i32 { + $B2: { %4:i32 = load %i %5:i32 = add %4, %p %v:i32 = let %5 @@ -516,12 +516,12 @@ ret %v } } -%F = func():i32 -> %b3 { - %b3 = block { +%F = func():i32 { + $B3: { %8:i32 = call %rmw, 1i %x:i32 = let %8 - if true [t: %b4] { # if_1 - %b4 = block { # true + if true [t: $B4] { # if_1 + $B4: { # true ret %x } } @@ -550,8 +550,8 @@ }); auto* src = R"( -%F = func():i32 -> %b1 { - %b1 = block { +%F = func():i32 { + $B1: { %v:ptr<function, i32, read_write> = var %3:i32 = load %v %4:i32 = add %3, 1i @@ -563,8 +563,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%F = func():i32 -> %b1 { - %b1 = block { +%F = func():i32 { + $B1: { %v:ptr<function, i32, read_write> = var %3:i32 = load %v %4:i32 = add %3, 1i @@ -597,8 +597,8 @@ }); auto* src = R"( -%F = func():void -> %b1 { - %b1 = block { +%F = func():void { + $B1: { %i:i32 = max 1i, 2i %v:ptr<function, i32, read_write> = var, %i %x:i32 = max 3i, 4i @@ -612,8 +612,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%F = func():void -> %b1 { - %b1 = block { +%F = func():void { + $B1: { %i:i32 = max 1i, 2i %v:ptr<function, i32, read_write> = var, %i %x:i32 = max 3i, 4i
diff --git a/src/tint/lang/core/ir/transform/vectorize_scalar_matrix_constructors_test.cc b/src/tint/lang/core/ir/transform/vectorize_scalar_matrix_constructors_test.cc index 826ba54..7bca08f 100644 --- a/src/tint/lang/core/ir/transform/vectorize_scalar_matrix_constructors_test.cc +++ b/src/tint/lang/core/ir/transform/vectorize_scalar_matrix_constructors_test.cc
@@ -49,8 +49,8 @@ }); auto* src = R"( -%foo = func():mat3x3<f32> -> %b1 { - %b1 = block { +%foo = func():mat3x3<f32> { + $B1: { %2:mat3x3<f32> = construct ret %2 } @@ -76,8 +76,8 @@ }); auto* src = R"( -%foo = func(%value:mat3x3<f32>):mat3x3<f32> -> %b1 { - %b1 = block { +%foo = func(%value:mat3x3<f32>):mat3x3<f32> { + $B1: { %3:mat3x3<f32> = construct %value ret %3 } @@ -105,8 +105,8 @@ }); auto* src = R"( -%foo = func(%v1:vec3<f32>, %v2:vec3<f32>, %v3:vec3<f32>):mat3x3<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:vec3<f32>, %v2:vec3<f32>, %v3:vec3<f32>):mat3x3<f32> { + $B1: { %5:mat3x3<f32> = construct %v1, %v2, %v3 ret %5 } @@ -135,8 +135,8 @@ }); auto* src = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32):mat2x2<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32):mat2x2<f32> { + $B1: { %6:mat2x2<f32> = construct %v1, %v2, %v3, %v4 ret %6 } @@ -145,8 +145,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32):mat2x2<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32):mat2x2<f32> { + $B1: { %6:vec2<f32> = construct %v1, %v2 %7:vec2<f32> = construct %v3, %v4 %8:mat2x2<f32> = construct %6, %7 @@ -176,8 +176,8 @@ }); auto* src = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32):mat2x3<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32):mat2x3<f32> { + $B1: { %8:mat2x3<f32> = construct %v1, %v2, %v3, %v4, %v5, %v6 ret %8 } @@ -186,8 +186,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32):mat2x3<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32):mat2x3<f32> { + $B1: { %8:vec3<f32> = construct %v1, %v2, %v3 %9:vec3<f32> = construct %v4, %v5, %v6 %10:mat2x3<f32> = construct %8, %9 @@ -219,8 +219,8 @@ }); auto* src = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32):mat2x4<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32):mat2x4<f32> { + $B1: { %10:mat2x4<f32> = construct %v1, %v2, %v3, %v4, %v5, %v6, %v7, %v8 ret %10 } @@ -229,8 +229,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32):mat2x4<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32):mat2x4<f32> { + $B1: { %10:vec4<f32> = construct %v1, %v2, %v3, %v4 %11:vec4<f32> = construct %v5, %v6, %v7, %v8 %12:mat2x4<f32> = construct %10, %11 @@ -260,8 +260,8 @@ }); auto* src = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32):mat3x2<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32):mat3x2<f32> { + $B1: { %8:mat3x2<f32> = construct %v1, %v2, %v3, %v4, %v5, %v6 ret %8 } @@ -270,8 +270,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32):mat3x2<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32):mat3x2<f32> { + $B1: { %8:vec2<f32> = construct %v1, %v2 %9:vec2<f32> = construct %v3, %v4 %10:vec2<f32> = construct %v5, %v6 @@ -305,8 +305,8 @@ }); auto* src = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32):mat3x3<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32):mat3x3<f32> { + $B1: { %11:mat3x3<f32> = construct %v1, %v2, %v3, %v4, %v5, %v6, %v7, %v8, %v9 ret %11 } @@ -315,8 +315,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32):mat3x3<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32):mat3x3<f32> { + $B1: { %11:vec3<f32> = construct %v1, %v2, %v3 %12:vec3<f32> = construct %v4, %v5, %v6 %13:vec3<f32> = construct %v7, %v8, %v9 @@ -353,8 +353,8 @@ }); auto* src = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32):mat3x4<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32):mat3x4<f32> { + $B1: { %14:mat3x4<f32> = construct %v1, %v2, %v3, %v4, %v5, %v6, %v7, %v8, %v9, %v10, %v11, %v12 ret %14 } @@ -363,8 +363,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32):mat3x4<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32):mat3x4<f32> { + $B1: { %14:vec4<f32> = construct %v1, %v2, %v3, %v4 %15:vec4<f32> = construct %v5, %v6, %v7, %v8 %16:vec4<f32> = construct %v9, %v10, %v11, %v12 @@ -397,8 +397,8 @@ }); auto* src = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32):mat4x2<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32):mat4x2<f32> { + $B1: { %10:mat4x2<f32> = construct %v1, %v2, %v3, %v4, %v5, %v6, %v7, %v8 ret %10 } @@ -407,8 +407,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32):mat4x2<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32):mat4x2<f32> { + $B1: { %10:vec2<f32> = construct %v1, %v2 %11:vec2<f32> = construct %v3, %v4 %12:vec2<f32> = construct %v5, %v6 @@ -446,8 +446,8 @@ }); auto* src = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32):mat4x3<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32):mat4x3<f32> { + $B1: { %14:mat4x3<f32> = construct %v1, %v2, %v3, %v4, %v5, %v6, %v7, %v8, %v9, %v10, %v11, %v12 ret %14 } @@ -456,8 +456,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32):mat4x3<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32):mat4x3<f32> { + $B1: { %14:vec3<f32> = construct %v1, %v2, %v3 %15:vec3<f32> = construct %v4, %v5, %v6 %16:vec3<f32> = construct %v7, %v8, %v9 @@ -500,8 +500,8 @@ }); auto* src = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32, %v13:f32, %v14:f32, %v15:f32, %v16:f32):mat4x4<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32, %v13:f32, %v14:f32, %v15:f32, %v16:f32):mat4x4<f32> { + $B1: { %18:mat4x4<f32> = construct %v1, %v2, %v3, %v4, %v5, %v6, %v7, %v8, %v9, %v10, %v11, %v12, %v13, %v14, %v15, %v16 ret %18 } @@ -510,8 +510,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32, %v13:f32, %v14:f32, %v15:f32, %v16:f32):mat4x4<f32> -> %b1 { - %b1 = block { +%foo = func(%v1:f32, %v2:f32, %v3:f32, %v4:f32, %v5:f32, %v6:f32, %v7:f32, %v8:f32, %v9:f32, %v10:f32, %v11:f32, %v12:f32, %v13:f32, %v14:f32, %v15:f32, %v16:f32):mat4x4<f32> { + $B1: { %18:vec4<f32> = construct %v1, %v2, %v3, %v4 %19:vec4<f32> = construct %v5, %v6, %v7, %v8 %20:vec4<f32> = construct %v9, %v10, %v11, %v12 @@ -546,8 +546,8 @@ }); auto* src = R"( -%foo = func(%v1:f16, %v2:f16, %v3:f16, %v4:f16, %v5:f16, %v6:f16, %v7:f16, %v8:f16, %v9:f16):mat3x3<f16> -> %b1 { - %b1 = block { +%foo = func(%v1:f16, %v2:f16, %v3:f16, %v4:f16, %v5:f16, %v6:f16, %v7:f16, %v8:f16, %v9:f16):mat3x3<f16> { + $B1: { %11:mat3x3<f16> = construct %v1, %v2, %v3, %v4, %v5, %v6, %v7, %v8, %v9 ret %11 } @@ -556,8 +556,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%v1:f16, %v2:f16, %v3:f16, %v4:f16, %v5:f16, %v6:f16, %v7:f16, %v8:f16, %v9:f16):mat3x3<f16> -> %b1 { - %b1 = block { +%foo = func(%v1:f16, %v2:f16, %v3:f16, %v4:f16, %v5:f16, %v6:f16, %v7:f16, %v8:f16, %v9:f16):mat3x3<f16> { + $B1: { %11:vec3<f16> = construct %v1, %v2, %v3 %12:vec3<f16> = construct %v4, %v5, %v6 %13:vec3<f16> = construct %v7, %v8, %v9
diff --git a/src/tint/lang/core/ir/transform/zero_init_workgroup_memory_test.cc b/src/tint/lang/core/ir/transform/zero_init_workgroup_memory_test.cc index 37ba499..0e9c0b1 100644 --- a/src/tint/lang/core/ir/transform/zero_init_workgroup_memory_test.cc +++ b/src/tint/lang/core/ir/transform/zero_init_workgroup_memory_test.cc
@@ -62,8 +62,8 @@ }); auto* expect = R"( -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { ret } } @@ -83,12 +83,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, i32, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { ret } } @@ -112,12 +112,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:bool = load %wgvar ret } @@ -126,15 +126,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true store %wgvar, false exit_if # if_1 } @@ -161,12 +161,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, i32, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:i32 = load %wgvar ret } @@ -175,15 +175,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, i32, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true store %wgvar, 0i exit_if # if_1 } @@ -210,12 +210,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, u32, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = load %wgvar ret } @@ -224,15 +224,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, u32, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true store %wgvar, 0u exit_if # if_1 } @@ -259,12 +259,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, f32, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:f32 = load %wgvar ret } @@ -273,15 +273,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, f32, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true store %wgvar, 0.0f exit_if # if_1 } @@ -308,12 +308,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, f16, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:f16 = load %wgvar ret } @@ -322,15 +322,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, f16, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true store %wgvar, 0.0h exit_if # if_1 } @@ -357,12 +357,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, atomic<i32>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:i32 = atomicLoad %wgvar ret } @@ -371,15 +371,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, atomic<i32>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true %5:void = atomicStore %wgvar, 0i exit_if # if_1 } @@ -406,12 +406,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, atomic<u32>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = atomicLoad %wgvar ret } @@ -420,15 +420,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, atomic<u32>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true %5:void = atomicStore %wgvar, 0u exit_if # if_1 } @@ -455,12 +455,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<i32, 4>, read_write> = var } -%main = @compute @workgroup_size(11, 2, 3) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(11, 2, 3) func():void { + $B2: { %3:array<i32, 4> = load %wgvar ret } @@ -469,30 +469,30 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<i32, 4>, read_write> = var } -%main = @compute @workgroup_size(11, 2, 3) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { - loop [i: %b3, b: %b4, c: %b5] { # loop_1 - %b3 = block { # initializer - next_iteration %b4 %tint_local_index +%main = @compute @workgroup_size(11, 2, 3) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { + loop [i: $B3, b: $B4, c: $B5] { # loop_1 + $B3: { # initializer + next_iteration %tint_local_index # -> $B4 } - %b4 = block (%idx:u32) { # body + $B4 (%idx:u32): { # body %5:bool = gte %idx:u32, 4u - if %5 [t: %b6] { # if_1 - %b6 = block { # true + if %5 [t: $B6] { # if_1 + $B6: { # true exit_loop # loop_1 } } %6:ptr<workgroup, i32, read_write> = access %wgvar, %idx:u32 store %6, 0i - continue %b5 + continue # -> $B5 } - %b5 = block { # continuing + $B5: { # continuing %7:u32 = add %idx:u32, 66u - next_iteration %b4 %7 + next_iteration %7 # -> $B4 } } %8:void = workgroupBarrier @@ -517,12 +517,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<u32, 5>, 7>, read_write> = var } -%main = @compute @workgroup_size(11, 2, 3) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(11, 2, 3) func():void { + $B2: { %3:array<array<u32, 5>, 7> = load %wgvar ret } @@ -531,20 +531,20 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<u32, 5>, 7>, read_write> = var } -%main = @compute @workgroup_size(11, 2, 3) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { - loop [i: %b3, b: %b4, c: %b5] { # loop_1 - %b3 = block { # initializer - next_iteration %b4 %tint_local_index +%main = @compute @workgroup_size(11, 2, 3) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { + loop [i: $B3, b: $B4, c: $B5] { # loop_1 + $B3: { # initializer + next_iteration %tint_local_index # -> $B4 } - %b4 = block (%idx:u32) { # body + $B4 (%idx:u32): { # body %5:bool = gte %idx:u32, 35u - if %5 [t: %b6] { # if_1 - %b6 = block { # true + if %5 [t: $B6] { # if_1 + $B6: { # true exit_loop # loop_1 } } @@ -552,11 +552,11 @@ %7:u32 = div %idx:u32, 5u %8:ptr<workgroup, u32, read_write> = access %wgvar, %7, %6 store %8, 0u - continue %b5 + continue # -> $B5 } - %b5 = block { # continuing + $B5: { # continuing %9:u32 = add %idx:u32, 66u - next_iteration %b4 %9 + next_iteration %9 # -> $B4 } } %10:void = workgroupBarrier @@ -581,12 +581,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<array<i32, 7>, 5>, 3>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:array<array<array<i32, 7>, 5>, 3> = load %wgvar ret } @@ -595,20 +595,20 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<array<i32, 7>, 5>, 3>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { - loop [i: %b3, b: %b4, c: %b5] { # loop_1 - %b3 = block { # initializer - next_iteration %b4 %tint_local_index +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { + loop [i: $B3, b: $B4, c: $B5] { # loop_1 + $B3: { # initializer + next_iteration %tint_local_index # -> $B4 } - %b4 = block (%idx:u32) { # body + $B4 (%idx:u32): { # body %5:bool = gte %idx:u32, 105u - if %5 [t: %b6] { # if_1 - %b6 = block { # true + if %5 [t: $B6] { # if_1 + $B6: { # true exit_loop # loop_1 } } @@ -618,11 +618,11 @@ %9:u32 = div %idx:u32, 35u %10:ptr<workgroup, i32, read_write> = access %wgvar, %9, %8, %6 store %10, 0i - continue %b5 + continue # -> $B5 } - %b5 = block { # continuing + $B5: { # continuing %11:u32 = add %idx:u32, 1u - next_iteration %b4 %11 + next_iteration %11 # -> $B4 } } %12:void = workgroupBarrier @@ -647,12 +647,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<array<i32, 1>, 5>, 3>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:array<array<array<i32, 1>, 5>, 3> = load %wgvar ret } @@ -661,20 +661,20 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<array<i32, 1>, 5>, 3>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { - loop [i: %b3, b: %b4, c: %b5] { # loop_1 - %b3 = block { # initializer - next_iteration %b4 %tint_local_index +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { + loop [i: $B3, b: $B4, c: $B5] { # loop_1 + $B3: { # initializer + next_iteration %tint_local_index # -> $B4 } - %b4 = block (%idx:u32) { # body + $B4 (%idx:u32): { # body %5:bool = gte %idx:u32, 15u - if %5 [t: %b6] { # if_1 - %b6 = block { # true + if %5 [t: $B6] { # if_1 + $B6: { # true exit_loop # loop_1 } } @@ -682,11 +682,11 @@ %7:u32 = div %idx:u32, 5u %8:ptr<workgroup, i32, read_write> = access %wgvar, %7, %6, 0u store %8, 0i - continue %b5 + continue # -> $B5 } - %b5 = block { # continuing + $B5: { # continuing %9:u32 = add %idx:u32, 1u - next_iteration %b4 %9 + next_iteration %9 # -> $B4 } } %10:void = workgroupBarrier @@ -711,12 +711,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<array<i32, 3>, 1>, 5>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:array<array<array<i32, 3>, 1>, 5> = load %wgvar ret } @@ -725,20 +725,20 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<array<i32, 3>, 1>, 5>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { - loop [i: %b3, b: %b4, c: %b5] { # loop_1 - %b3 = block { # initializer - next_iteration %b4 %tint_local_index +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { + loop [i: $B3, b: $B4, c: $B5] { # loop_1 + $B3: { # initializer + next_iteration %tint_local_index # -> $B4 } - %b4 = block (%idx:u32) { # body + $B4 (%idx:u32): { # body %5:bool = gte %idx:u32, 15u - if %5 [t: %b6] { # if_1 - %b6 = block { # true + if %5 [t: $B6] { # if_1 + $B6: { # true exit_loop # loop_1 } } @@ -746,11 +746,11 @@ %7:u32 = div %idx:u32, 3u %8:ptr<workgroup, i32, read_write> = access %wgvar, %7, 0u, %6 store %8, 0i - continue %b5 + continue # -> $B5 } - %b5 = block { # continuing + $B5: { # continuing %9:u32 = add %idx:u32, 1u - next_iteration %b4 %9 + next_iteration %9 # -> $B4 } } %10:void = workgroupBarrier @@ -775,12 +775,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<array<i32, 3>, 5>, 1>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:array<array<array<i32, 3>, 5>, 1> = load %wgvar ret } @@ -789,20 +789,20 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<array<i32, 3>, 5>, 1>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { - loop [i: %b3, b: %b4, c: %b5] { # loop_1 - %b3 = block { # initializer - next_iteration %b4 %tint_local_index +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { + loop [i: $B3, b: $B4, c: $B5] { # loop_1 + $B3: { # initializer + next_iteration %tint_local_index # -> $B4 } - %b4 = block (%idx:u32) { # body + $B4 (%idx:u32): { # body %5:bool = gte %idx:u32, 15u - if %5 [t: %b6] { # if_1 - %b6 = block { # true + if %5 [t: $B6] { # if_1 + $B6: { # true exit_loop # loop_1 } } @@ -810,11 +810,11 @@ %7:u32 = div %idx:u32, 3u %8:ptr<workgroup, i32, read_write> = access %wgvar, 0u, %7, %6 store %8, 0i - continue %b5 + continue # -> $B5 } - %b5 = block { # continuing + $B5: { # continuing %9:u32 = add %idx:u32, 1u - next_iteration %b4 %9 + next_iteration %9 # -> $B4 } } %10:void = workgroupBarrier @@ -839,12 +839,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<i32, 1>, 1>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:array<array<i32, 1>, 1> = load %wgvar ret } @@ -853,15 +853,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<array<i32, 1>, 1>, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true %5:ptr<workgroup, i32, read_write> = access %wgvar, 0u, 0u store %5, 0i exit_if # if_1 @@ -900,12 +900,12 @@ c:f32 @offset(8) } -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, MyStruct, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:MyStruct = load %wgvar ret } @@ -920,15 +920,15 @@ c:f32 @offset(8) } -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, MyStruct, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true store %wgvar, MyStruct(0i, 0u, 0.0f) exit_if # if_1 } @@ -975,12 +975,12 @@ d:bool @offset(12) } -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, Outer, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:Outer = load %wgvar ret } @@ -1000,15 +1000,15 @@ d:bool @offset(12) } -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, Outer, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true store %wgvar, Outer(0.0f, Inner(0i, 0u), false) exit_if # if_1 } @@ -1055,12 +1055,12 @@ d:bool @offset(12) } -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, Outer, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:Outer = load %wgvar ret } @@ -1080,15 +1080,15 @@ d:bool @offset(12) } -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, Outer, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true %5:ptr<workgroup, f32, read_write> = access %wgvar, 0u store %5, 0.0f %6:ptr<workgroup, i32, read_write> = access %wgvar, 1u, 0u @@ -1143,12 +1143,12 @@ d:bool @offset(108) } -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<Outer, 7>, read_write> = var } -%main = @compute @workgroup_size(7, 3, 2) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(7, 3, 2) func():void { + $B2: { %3:array<Outer, 7> = load %wgvar ret } @@ -1168,20 +1168,20 @@ d:bool @offset(108) } -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, array<Outer, 7>, read_write> = var } -%main = @compute @workgroup_size(7, 3, 2) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { - loop [i: %b3, b: %b4, c: %b5] { # loop_1 - %b3 = block { # initializer - next_iteration %b4 %tint_local_index +%main = @compute @workgroup_size(7, 3, 2) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { + loop [i: $B3, b: $B4, c: $B5] { # loop_1 + $B3: { # initializer + next_iteration %tint_local_index # -> $B4 } - %b4 = block (%idx:u32) { # body + $B4 (%idx:u32): { # body %5:bool = gte %idx:u32, 7u - if %5 [t: %b6] { # if_1 - %b6 = block { # true + if %5 [t: $B6] { # if_1 + $B6: { # true exit_loop # loop_1 } } @@ -1189,21 +1189,21 @@ store %6, 0.0f %7:ptr<workgroup, bool, read_write> = access %wgvar, %idx:u32, 2u store %7, false - continue %b5 + continue # -> $B5 } - %b5 = block { # continuing + $B5: { # continuing %8:u32 = add %idx:u32, 42u - next_iteration %b4 %8 + next_iteration %8 # -> $B4 } } - loop [i: %b7, b: %b8, c: %b9] { # loop_2 - %b7 = block { # initializer - next_iteration %b8 %tint_local_index + loop [i: $B7, b: $B8, c: $B9] { # loop_2 + $B7: { # initializer + next_iteration %tint_local_index # -> $B8 } - %b8 = block (%idx_1:u32) { # body + $B8 (%idx_1:u32): { # body %10:bool = gte %idx_1:u32, 91u - if %10 [t: %b10] { # if_2 - %b10 = block { # true + if %10 [t: $B10] { # if_2 + $B10: { # true exit_loop # loop_2 } } @@ -1215,11 +1215,11 @@ %15:u32 = div %idx_1:u32, 13u %16:ptr<workgroup, atomic<u32>, read_write> = access %wgvar, %15, 1u, %14, 1u %17:void = atomicStore %16, 0u - continue %b9 + continue # -> $B9 } - %b9 = block { # continuing + $B9: { # continuing %18:u32 = add %idx_1:u32, 42u - next_iteration %b8 %18 + next_iteration %18 # -> $B8 } } %19:void = workgroupBarrier @@ -1248,14 +1248,14 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %var_a:ptr<workgroup, bool, read_write> = var %var_b:ptr<workgroup, array<i32, 4>, read_write> = var %var_c:ptr<workgroup, array<array<u32, 5>, 7>, read_write> = var } -%main = @compute @workgroup_size(11, 2, 3) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(11, 2, 3) func():void { + $B2: { %5:bool = load %var_a %6:array<i32, 4> = load %var_b %7:array<array<u32, 5>, 7> = load %var_c @@ -1266,49 +1266,49 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %var_a:ptr<workgroup, bool, read_write> = var %var_b:ptr<workgroup, array<i32, 4>, read_write> = var %var_c:ptr<workgroup, array<array<u32, 5>, 7>, read_write> = var } -%main = @compute @workgroup_size(11, 2, 3) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(11, 2, 3) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %6:bool = eq %tint_local_index, 0u - if %6 [t: %b3] { # if_1 - %b3 = block { # true + if %6 [t: $B3] { # if_1 + $B3: { # true store %var_a, false exit_if # if_1 } } - loop [i: %b4, b: %b5, c: %b6] { # loop_1 - %b4 = block { # initializer - next_iteration %b5 %tint_local_index + loop [i: $B4, b: $B5, c: $B6] { # loop_1 + $B4: { # initializer + next_iteration %tint_local_index # -> $B5 } - %b5 = block (%idx:u32) { # body + $B5 (%idx:u32): { # body %8:bool = gte %idx:u32, 4u - if %8 [t: %b7] { # if_2 - %b7 = block { # true + if %8 [t: $B7] { # if_2 + $B7: { # true exit_loop # loop_1 } } %9:ptr<workgroup, i32, read_write> = access %var_b, %idx:u32 store %9, 0i - continue %b6 + continue # -> $B6 } - %b6 = block { # continuing + $B6: { # continuing %10:u32 = add %idx:u32, 66u - next_iteration %b5 %10 + next_iteration %10 # -> $B5 } } - loop [i: %b8, b: %b9, c: %b10] { # loop_2 - %b8 = block { # initializer - next_iteration %b9 %tint_local_index + loop [i: $B8, b: $B9, c: $B10] { # loop_2 + $B8: { # initializer + next_iteration %tint_local_index # -> $B9 } - %b9 = block (%idx_1:u32) { # body + $B9 (%idx_1:u32): { # body %12:bool = gte %idx_1:u32, 35u - if %12 [t: %b11] { # if_3 - %b11 = block { # true + if %12 [t: $B11] { # if_3 + $B11: { # true exit_loop # loop_2 } } @@ -1316,11 +1316,11 @@ %14:u32 = div %idx_1:u32, 5u %15:ptr<workgroup, u32, read_write> = access %var_c, %14, %13 store %15, 0u - continue %b10 + continue # -> $B10 } - %b10 = block { # continuing + $B10: { # continuing %16:u32 = add %idx_1:u32, 66u - next_iteration %b9 %16 + next_iteration %16 # -> $B9 } } %17:void = workgroupBarrier @@ -1353,15 +1353,15 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %var_a:ptr<workgroup, bool, read_write> = var %var_b:ptr<workgroup, i32, read_write> = var %var_c:ptr<workgroup, array<i32, 42>, read_write> = var %var_d:ptr<workgroup, array<array<u32, 6>, 7>, read_write> = var } -%main = @compute @workgroup_size(11, 2, 3) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(11, 2, 3) func():void { + $B2: { %6:bool = load %var_a %7:i32 = load %var_b %8:array<i32, 42> = load %var_c @@ -1373,31 +1373,31 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %var_a:ptr<workgroup, bool, read_write> = var %var_b:ptr<workgroup, i32, read_write> = var %var_c:ptr<workgroup, array<i32, 42>, read_write> = var %var_d:ptr<workgroup, array<array<u32, 6>, 7>, read_write> = var } -%main = @compute @workgroup_size(11, 2, 3) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(11, 2, 3) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %7:bool = eq %tint_local_index, 0u - if %7 [t: %b3] { # if_1 - %b3 = block { # true + if %7 [t: $B3] { # if_1 + $B3: { # true store %var_a, false store %var_b, 0i exit_if # if_1 } } - loop [i: %b4, b: %b5, c: %b6] { # loop_1 - %b4 = block { # initializer - next_iteration %b5 %tint_local_index + loop [i: $B4, b: $B5, c: $B6] { # loop_1 + $B4: { # initializer + next_iteration %tint_local_index # -> $B5 } - %b5 = block (%idx:u32) { # body + $B5 (%idx:u32): { # body %9:bool = gte %idx:u32, 42u - if %9 [t: %b7] { # if_2 - %b7 = block { # true + if %9 [t: $B7] { # if_2 + $B7: { # true exit_loop # loop_1 } } @@ -1407,11 +1407,11 @@ %12:u32 = div %idx:u32, 6u %13:ptr<workgroup, u32, read_write> = access %var_d, %12, %11 store %13, 0u - continue %b6 + continue # -> $B6 } - %b6 = block { # continuing + $B6: { # continuing %14:u32 = add %idx:u32, 66u - next_iteration %b5 %14 + next_iteration %14 # -> $B5 } } %15:void = workgroupBarrier @@ -1444,12 +1444,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%global_id:vec4<u32> [@global_invocation_id], %index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%global_id:vec4<u32> [@global_invocation_id], %index:u32 [@local_invocation_index]):void { + $B2: { %5:bool = load %wgvar ret } @@ -1458,15 +1458,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%global_id:vec4<u32> [@global_invocation_id], %index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%global_id:vec4<u32> [@global_invocation_id], %index:u32 [@local_invocation_index]):void { + $B2: { %5:bool = eq %index, 0u - if %5 [t: %b3] { # if_1 - %b3 = block { # true + if %5 [t: $B3] { # if_1 + $B3: { # true store %wgvar, false exit_if # if_1 } @@ -1526,12 +1526,12 @@ index:u32 @offset(12), @builtin(local_invocation_index) } -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%params:MyStruct):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%params:MyStruct):void { + $B2: { %4:bool = load %wgvar ret } @@ -1545,16 +1545,16 @@ index:u32 @offset(12), @builtin(local_invocation_index) } -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%params:MyStruct):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%params:MyStruct):void { + $B2: { %4:u32 = access %params, 1u %5:bool = eq %4, 0u - if %5 [t: %b3] { # if_1 - %b3 = block { # true + if %5 [t: $B3] { # if_1 + $B3: { # true store %wgvar, false exit_if # if_1 } @@ -1597,23 +1597,23 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { - if true [t: %b3] { # if_1 - %b3 = block { # true - switch 42i [c: (default, %b4)] { # switch_1 - %b4 = block { # case - loop [b: %b5, c: %b6] { # loop_1 - %b5 = block { # body - continue %b6 +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { + if true [t: $B3] { # if_1 + $B3: { # true + switch 42i [c: (default, $B4)] { # switch_1 + $B4: { # case + loop [b: $B5, c: $B6] { # loop_1 + $B5: { # body + continue # -> $B6 } - %b6 = block { # continuing + $B6: { # continuing %3:bool = load %wgvar - break_if %3 %b5 + break_if %3 # -> [t: exit_loop loop_1, f: $B5] } } exit_switch # switch_1 @@ -1629,31 +1629,31 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B2: { %4:bool = eq %tint_local_index, 0u - if %4 [t: %b3] { # if_1 - %b3 = block { # true + if %4 [t: $B3] { # if_1 + $B3: { # true store %wgvar, false exit_if # if_1 } } %5:void = workgroupBarrier - if true [t: %b4] { # if_2 - %b4 = block { # true - switch 42i [c: (default, %b5)] { # switch_1 - %b5 = block { # case - loop [b: %b6, c: %b7] { # loop_1 - %b6 = block { # body - continue %b7 + if true [t: $B4] { # if_2 + $B4: { # true + switch 42i [c: (default, $B5)] { # switch_1 + $B5: { # case + loop [b: $B6, c: $B7] { # loop_1 + $B6: { # body + continue # -> $B7 } - %b7 = block { # continuing + $B7: { # continuing %6:bool = load %wgvar - break_if %6 %b6 + break_if %6 # -> [t: exit_loop loop_1, f: $B6] } } exit_switch # switch_1 @@ -1721,28 +1721,28 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%foo = func():void -> %b2 { - %b2 = block { - loop [b: %b3, c: %b4] { # loop_1 - %b3 = block { # body - continue %b4 +%foo = func():void { + $B2: { + loop [b: $B3, c: $B4] { # loop_1 + $B3: { # body + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %3:bool = load %wgvar - break_if %3 %b3 + break_if %3 # -> [t: exit_loop loop_1, f: $B3] } } ret } } -%foo_1 = func():void -> %b5 { # %foo_1: 'foo' - %b5 = block { - if true [t: %b6] { # if_1 - %b6 = block { # true +%foo_1 = func():void { # %foo_1: 'foo' + $B5: { + if true [t: $B6] { # if_1 + $B6: { # true %5:void = call %foo exit_if # if_1 } @@ -1750,19 +1750,19 @@ ret } } -%func = @compute @workgroup_size(1, 1, 1) func():void -> %b7 { - %b7 = block { - if true [t: %b8] { # if_2 - %b8 = block { # true - switch 42i [c: (default, %b9)] { # switch_1 - %b9 = block { # case - loop [b: %b10, c: %b11] { # loop_2 - %b10 = block { # body - continue %b11 +%func = @compute @workgroup_size(1, 1, 1) func():void { + $B7: { + if true [t: $B8] { # if_2 + $B8: { # true + switch 42i [c: (default, $B9)] { # switch_1 + $B9: { # case + loop [b: $B10, c: $B11] { # loop_2 + $B10: { # body + continue # -> $B11 } - %b11 = block { # continuing + $B11: { # continuing %7:void = call %foo_1 - break_if true %b10 + break_if true # -> [t: exit_loop loop_2, f: $B10] } } exit_switch # switch_1 @@ -1778,28 +1778,28 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%foo = func():void -> %b2 { - %b2 = block { - loop [b: %b3, c: %b4] { # loop_1 - %b3 = block { # body - continue %b4 +%foo = func():void { + $B2: { + loop [b: $B3, c: $B4] { # loop_1 + $B3: { # body + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %3:bool = load %wgvar - break_if %3 %b3 + break_if %3 # -> [t: exit_loop loop_1, f: $B3] } } ret } } -%foo_1 = func():void -> %b5 { # %foo_1: 'foo' - %b5 = block { - if true [t: %b6] { # if_1 - %b6 = block { # true +%foo_1 = func():void { # %foo_1: 'foo' + $B5: { + if true [t: $B6] { # if_1 + $B6: { # true %5:void = call %foo exit_if # if_1 } @@ -1807,27 +1807,27 @@ ret } } -%func = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b7 { - %b7 = block { +%func = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B7: { %8:bool = eq %tint_local_index, 0u - if %8 [t: %b8] { # if_2 - %b8 = block { # true + if %8 [t: $B8] { # if_2 + $B8: { # true store %wgvar, false exit_if # if_2 } } %9:void = workgroupBarrier - if true [t: %b9] { # if_3 - %b9 = block { # true - switch 42i [c: (default, %b10)] { # switch_1 - %b10 = block { # case - loop [b: %b11, c: %b12] { # loop_2 - %b11 = block { # body - continue %b12 + if true [t: $B9] { # if_3 + $B9: { # true + switch 42i [c: (default, $B10)] { # switch_1 + $B10: { # case + loop [b: $B11, c: $B12] { # loop_2 + $B11: { # body + continue # -> $B12 } - %b12 = block { # continuing + $B12: { # continuing %10:void = call %foo_1 - break_if true %b11 + break_if true # -> [t: exit_loop loop_2, f: $B11] } } exit_switch # switch_1 @@ -1875,32 +1875,32 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%foo = func():void -> %b2 { - %b2 = block { - loop [b: %b3, c: %b4] { # loop_1 - %b3 = block { # body - continue %b4 +%foo = func():void { + $B2: { + loop [b: $B3, c: $B4] { # loop_1 + $B3: { # body + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %3:bool = load %wgvar - break_if %3 %b3 + break_if %3 # -> [t: exit_loop loop_1, f: $B3] } } ret } } -%ep1 = @compute @workgroup_size(1, 1, 1) func():void -> %b5 { - %b5 = block { +%ep1 = @compute @workgroup_size(1, 1, 1) func():void { + $B5: { %5:void = call %foo ret } } -%ep2 = @compute @workgroup_size(1, 1, 1) func():void -> %b6 { - %b6 = block { +%ep2 = @compute @workgroup_size(1, 1, 1) func():void { + $B6: { %7:void = call %foo ret } @@ -1909,29 +1909,29 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, bool, read_write> = var } -%foo = func():void -> %b2 { - %b2 = block { - loop [b: %b3, c: %b4] { # loop_1 - %b3 = block { # body - continue %b4 +%foo = func():void { + $B2: { + loop [b: $B3, c: $B4] { # loop_1 + $B3: { # body + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %3:bool = load %wgvar - break_if %3 %b3 + break_if %3 # -> [t: exit_loop loop_1, f: $B3] } } ret } } -%ep1 = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void -> %b5 { - %b5 = block { +%ep1 = @compute @workgroup_size(1, 1, 1) func(%tint_local_index:u32 [@local_invocation_index]):void { + $B5: { %6:bool = eq %tint_local_index, 0u - if %6 [t: %b6] { # if_1 - %b6 = block { # true + if %6 [t: $B6] { # if_1 + $B6: { # true store %wgvar, false exit_if # if_1 } @@ -1941,11 +1941,11 @@ ret } } -%ep2 = @compute @workgroup_size(1, 1, 1) func(%tint_local_index_1:u32 [@local_invocation_index]):void -> %b7 { # %tint_local_index_1: 'tint_local_index' - %b7 = block { +%ep2 = @compute @workgroup_size(1, 1, 1) func(%tint_local_index_1:u32 [@local_invocation_index]):void { # %tint_local_index_1: 'tint_local_index' + $B7: { %11:bool = eq %tint_local_index_1, 0u - if %11 [t: %b8] { # if_2 - %b8 = block { # true + if %11 [t: $B8] { # if_2 + $B8: { # true store %wgvar, false exit_if # if_2 }
diff --git a/src/tint/lang/core/ir/validator_test.cc b/src/tint/lang/core/ir/validator_test.cc index 8742f8a..16bb823 100644 --- a/src/tint/lang/core/ir/validator_test.cc +++ b/src/tint/lang/core/ir/validator_test.cc
@@ -68,18 +68,18 @@ ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(:2:3 error: loop: root block: invalid instruction: tint::core::ir::Loop - loop [b: %b2] { # loop_1 + loop [b: $B2] { # loop_1 ^^^^^^^^^^^^^ :1:1 note: In block -%b1 = block { # root -^^^^^^^^^^^ +$B1: { # root +^^^ note: # Disassembly -%b1 = block { # root - loop [b: %b2] { # loop_1 - %b2 = block { # body - continue %b3 +$B1: { # root + loop [b: $B2] { # loop_1 + $B2: { # body + continue # -> $B3 } } } @@ -103,16 +103,16 @@ ^^^ :1:1 note: In block -%b1 = block { # root -^^^^^^^^^^^ +$B1: { # root +^^^ note: # Disassembly -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%f = func():void -> %b2 { - %b2 = block { +%f = func():void { + $B2: { ret } } @@ -140,17 +140,17 @@ ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(:1:1 error: function 'my_func' added to module multiple times -%my_func = func(%2:i32, %3:f32):void -> %b1 { +%my_func = func(%2:i32, %3:f32):void { ^^^^^^^^ note: # Disassembly -%my_func = func(%2:i32, %3:f32):void -> %b1 { - %b1 = block { +%my_func = func(%2:i32, %3:f32):void { + $B1: { ret } } -%my_func = func(%2:i32, %3:f32):void -> %b1 { - %b1 = block { +%my_func = func(%2:i32, %3:f32):void { + $B1: { ret } } @@ -169,12 +169,12 @@ ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(:1:17 error: destroyed parameter found in function parameter list -%my_func = func(%my_param:f32):void -> %b1 { +%my_func = func(%my_param:f32):void { ^^^^^^^^^^^^^ note: # Disassembly -%my_func = func(%my_param:f32):void -> %b1 { - %b1 = block { +%my_func = func(%my_param:f32):void { + $B1: { ret } } @@ -193,12 +193,12 @@ ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(:1:17 error: function parameter has nullptr parent function -%my_func = func(%my_param:f32):void -> %b1 { +%my_func = func(%my_param:f32):void { ^^^^^^^^^^^^^ note: # Disassembly -%my_func = func(%my_param:f32):void -> %b1 { - %b1 = block { +%my_func = func(%my_param:f32):void { + $B1: { ret } } @@ -218,21 +218,21 @@ ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(:1:18 error: function parameter has incorrect parent function -%my_func1 = func(%my_param:f32):void -> %b1 { +%my_func1 = func(%my_param:f32):void { ^^^^^^^^^^^^^ :6:1 note: parent function declared here -%my_func2 = func(%my_param:f32):void -> %b2 { +%my_func2 = func(%my_param:f32):void { ^^^^^^^^^ note: # Disassembly -%my_func1 = func(%my_param:f32):void -> %b1 { - %b1 = block { +%my_func1 = func(%my_param:f32):void { + $B1: { ret } } -%my_func2 = func(%my_param:f32):void -> %b2 { - %b2 = block { +%my_func2 = func(%my_param:f32):void { + $B2: { ret } } @@ -258,12 +258,12 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%f = func():void -> %b1 { - %b1 = block { +%f = func():void { + $B1: { %2:void = call %g ret } @@ -289,18 +289,18 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%f = func():void -> %b1 { - %b1 = block { +%f = func():void { + $B1: { %2:void = call %g ret } } -%g = @compute func():void -> %b2 { - %b2 = block { +%g = @compute func():void { + $B2: { ret } } @@ -326,17 +326,17 @@ ^^ :7:3 note: In block - %b2 = block { - ^^^^^^^^^^^ + $B2: { + ^^^ note: # Disassembly -%g = func(%2:i32, %3:i32):void -> %b1 { - %b1 = block { +%g = func(%2:i32, %3:i32):void { + $B1: { ret } } -%f = func():void -> %b2 { - %b2 = block { +%f = func():void { + $B2: { %5:void = call %g, 42i ret } @@ -363,17 +363,17 @@ ^^ :7:3 note: In block - %b2 = block { - ^^^^^^^^^^^ + $B2: { + ^^^ note: # Disassembly -%g = func(%2:i32, %3:i32):void -> %b1 { - %b1 = block { +%g = func(%2:i32, %3:i32):void { + $B1: { ret } } -%f = func():void -> %b2 { - %b2 = block { +%f = func():void { + $B2: { %5:void = call %g, 1i, 2i, 3i ret } @@ -400,17 +400,17 @@ ^^^^ :7:3 note: In block - %b2 = block { - ^^^^^^^^^^^ + $B2: { + ^^^ note: # Disassembly -%g = func(%2:i32, %3:i32, %4:i32):void -> %b1 { - %b1 = block { +%g = func(%2:i32, %3:i32, %4:i32):void { + $B1: { ret } } -%f = func():void -> %b2 { - %b2 = block { +%f = func():void { + $B2: { %6:void = call %g, 1i, 2.0f, 3i ret } @@ -425,12 +425,12 @@ ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(:2:3 error: block: does not end in a terminator instruction - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { } } )"); @@ -456,22 +456,22 @@ ^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%f = func():void -> %b1 { - %b1 = block { +%f = func():void { + $B1: { %2:ptr<function, i32, read_write> = var ret } } -%g = func():void -> %b2 { - %b2 = block { +%g = func():void { + $B2: { ret } } @@ -494,15 +494,15 @@ auto res = ir::Validate(mod); ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), - R"(:4:20 error: destroyed parameter found in block parameter list - %b2 = block (%my_param:f32) { # body - ^^^^^^^^^^^^^ + R"(:4:12 error: destroyed parameter found in block parameter list + $B2 (%my_param:f32): { # body + ^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block (%my_param:f32) { # body +%my_func = func():void { + $B1: { + loop [b: $B2] { # loop_1 + $B2 (%my_param:f32): { # body exit_loop # loop_1 } } @@ -528,15 +528,15 @@ auto res = ir::Validate(mod); ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), - R"(:4:20 error: block parameter has nullptr parent block - %b2 = block (%my_param:f32) { # body - ^^^^^^^^^^^^^ + R"(:4:12 error: block parameter has nullptr parent block + $B2 (%my_param:f32): { # body + ^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block (%my_param:f32) { # body +%my_func = func():void { + $B1: { + loop [b: $B2] { # loop_1 + $B2 (%my_param:f32): { # body exit_loop # loop_1 } } @@ -562,23 +562,23 @@ auto res = ir::Validate(mod); ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), - R"(:4:20 error: block parameter has incorrect parent block - %b2 = block (%my_param:f32) { # body - ^^^^^^^^^^^^^ + R"(:4:12 error: block parameter has incorrect parent block + $B2 (%my_param:f32): { # body + ^^^^^^^^^^^^^ :7:7 note: parent block declared here - %b3 = block (%my_param:f32) { # continuing - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + $B3 (%my_param:f32): { # continuing + ^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block (%my_param:f32) { # body - continue %b3 %my_param:f32 +%my_func = func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2 (%my_param:f32): { # body + continue %my_param:f32 # -> $B3 } - %b3 = block (%my_param:f32) { # continuing - next_iteration %b2 %my_param:f32 + $B3 (%my_param:f32): { # continuing + next_iteration %my_param:f32 # -> $B2 } } ret @@ -605,12 +605,12 @@ ^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func(%2:vec3<f32>):void -> %b1 { - %b1 = block { +%my_func = func(%2:vec3<f32>):void { + $B1: { %3:f32 = access %2, -1i ret } @@ -636,16 +636,16 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ :3:29 note: acceptable range: [0..1] %3:f32 = access %2, 1u, 3u ^^ note: # Disassembly -%my_func = func(%2:mat3x2<f32>):void -> %b1 { - %b1 = block { +%my_func = func(%2:mat3x2<f32>):void { + $B1: { %3:f32 = access %2, 1u, 3u ret } @@ -672,16 +672,16 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ :3:55 note: acceptable range: [0..1] %3:ptr<private, f32, read_write> = access %2, 1u, 3u ^^ note: # Disassembly -%my_func = func(%2:ptr<private, array<array<f32, 2>, 3>, read_write>):void -> %b1 { - %b1 = block { +%my_func = func(%2:ptr<private, array<array<f32, 2>, 3>, read_write>):void { + $B1: { %3:ptr<private, f32, read_write> = access %2, 1u, 3u ret } @@ -706,12 +706,12 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func(%2:f32):void -> %b1 { - %b1 = block { +%my_func = func(%2:f32):void { + $B1: { %3:f32 = access %2, 1u ret } @@ -737,12 +737,12 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func(%2:ptr<private, f32, read_write>):void -> %b1 { - %b1 = block { +%my_func = func(%2:ptr<private, f32, read_write>):void { + $B1: { %3:ptr<private, f32, read_write> = access %2, 1u ret } @@ -774,8 +774,8 @@ ^^ :7:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly MyStruct = struct @align(4) { @@ -783,8 +783,8 @@ b:i32 @offset(4) } -%my_func = func(%2:MyStruct, %3:i32):void -> %b1 { - %b1 = block { +%my_func = func(%2:MyStruct, %3:i32):void { + $B1: { %4:i32 = access %2, %3 ret } @@ -817,8 +817,8 @@ ^^ :7:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly MyStruct = struct @align(4) { @@ -826,8 +826,8 @@ b:i32 @offset(4) } -%my_func = func(%2:ptr<private, MyStruct, read_write>, %3:i32):void -> %b1 { - %b1 = block { +%my_func = func(%2:ptr<private, MyStruct, read_write>, %3:i32):void { + $B1: { %4:i32 = access %2, %3 ret } @@ -853,12 +853,12 @@ ^^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func(%2:mat3x2<f32>):void -> %b1 { - %b1 = block { +%my_func = func(%2:mat3x2<f32>):void { + $B1: { %3:i32 = access %2, 1u, 1u ret } @@ -885,12 +885,12 @@ ^^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func(%2:ptr<private, array<array<f32, 2>, 3>, read_write>):void -> %b1 { - %b1 = block { +%my_func = func(%2:ptr<private, array<array<f32, 2>, 3>, read_write>):void { + $B1: { %3:ptr<private, i32, read_write> = access %2, 1u, 1u ret } @@ -917,12 +917,12 @@ ^^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func(%2:ptr<private, array<array<f32, 2>, 3>, read_write>):void -> %b1 { - %b1 = block { +%my_func = func(%2:ptr<private, array<array<f32, 2>, 3>, read_write>):void { + $B1: { %3:f32 = access %2, 1u, 1u ret } @@ -948,12 +948,12 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func(%2:ptr<private, vec3<f32>, read_write>):void -> %b1 { - %b1 = block { +%my_func = func(%2:ptr<private, vec3<f32>, read_write>):void { + $B1: { %3:f32 = access %2, 1u ret } @@ -993,12 +993,12 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func(%2:ptr<private, mat3x2<f32>, read_write>):void -> %b1 { - %b1 = block { +%my_func = func(%2:ptr<private, mat3x2<f32>, read_write>):void { + $B1: { %3:f32 = access %2, 1u, 1u ret } @@ -1039,12 +1039,12 @@ ^^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func(%2:ptr<storage, array<f32, 2>, read>):void -> %b1 { - %b1 = block { +%my_func = func(%2:ptr<storage, array<f32, 2>, read>):void { + $B1: { %3:ptr<uniform, f32, read> = access %2, 1u ret } @@ -1071,12 +1071,12 @@ ^^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func(%2:ptr<storage, array<f32, 2>, read>):void -> %b1 { - %b1 = block { +%my_func = func(%2:ptr<storage, array<f32, 2>, read>):void { + $B1: { %3:ptr<storage, f32, read_write> = access %2, 1u ret } @@ -1128,12 +1128,12 @@ ^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { ret ret } @@ -1166,16 +1166,16 @@ ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(:4:7 error: block: does not end in a terminator instruction - %b2 = block { # true - ^^^^^^^^^^^ + $B2: { # true + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - if true [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%my_func = func():void { + $B1: { + if true [t: $B2, f: $B3] { # if_1 + $B2: { # true } - %b3 = block { # false + $B3: { # false ret } } @@ -1198,21 +1198,21 @@ auto res = ir::Validate(mod); ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(:3:8 error: if: condition must be a `bool` type - if 1i [t: %b2, f: %b3] { # if_1 + if 1i [t: $B2, f: $B3] { # if_1 ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - if 1i [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%my_func = func():void { + $B1: { + if 1i [t: $B2, f: $B3] { # if_1 + $B2: { # true ret } - %b3 = block { # false + $B3: { # false ret } } @@ -1235,21 +1235,21 @@ auto res = ir::Validate(mod); ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(:3:8 error: if: operand is undefined - if undef [t: %b2, f: %b3] { # if_1 + if undef [t: $B2, f: $B3] { # if_1 ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - if undef [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%my_func = func():void { + $B1: { + if undef [t: $B2, f: $B3] { # if_1 + $B2: { # true ret } - %b3 = block { # false + $B3: { # false ret } } @@ -1274,21 +1274,21 @@ auto res = ir::Validate(mod); ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(:3:5 error: if: result is undefined - undef = if true [t: %b2, f: %b3] { # if_1 + undef = if true [t: $B2, f: $B3] { # if_1 ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - undef = if true [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%my_func = func():void { + $B1: { + undef = if true [t: $B2, f: $B3] { # if_1 + $B2: { # true ret } - %b3 = block { # false + $B3: { # false ret } } @@ -1322,14 +1322,14 @@ ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(:4:7 error: block: does not end in a terminator instruction - %b2 = block { # body - ^^^^^^^^^^^ + $B2: { # body + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block { # body +%my_func = func():void { + $B1: { + loop [b: $B2] { # loop_1 + $B2: { # body } } ret @@ -1349,11 +1349,11 @@ ^^^^^ :1:1 note: In block -%b1 = block { # root -^^^^^^^^^^^ +$B1: { # root +^^^ note: # Disassembly -%b1 = block { # root +$B1: { # root undef = var } @@ -1376,12 +1376,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { undef = var ret } @@ -1406,12 +1406,12 @@ ^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, f32, read_write> = var, %3 ret } @@ -1435,12 +1435,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { undef = let 1i ret } @@ -1464,12 +1464,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:f32 = let undef ret } @@ -1494,12 +1494,12 @@ ^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:f32 = let 1i ret } @@ -1525,12 +1525,12 @@ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^$ARROWS^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { <destroyed tint::core::ir::Var $ADDRESS> ret } @@ -1562,12 +1562,12 @@ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, f32, read_write> = var ret } @@ -1593,12 +1593,12 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, f32, read_write> = var, %3 ret } @@ -1624,12 +1624,12 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, f32, read_write> = var, %3 ret } @@ -1651,8 +1651,8 @@ ASSERT_NE(res, Success); EXPECT_EQ(res.Failure().reason.Str(), R"(error: load: orphaned instruction: load note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, f32, read_write> = var ret } @@ -1674,12 +1674,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:i32 = add undef, 2i ret } @@ -1701,12 +1701,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:i32 = add 2i, undef ret } @@ -1731,12 +1731,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { undef = add 3i, 2i ret } @@ -1758,12 +1758,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:i32 = negation undef ret } @@ -1788,12 +1788,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { undef = negation 2i ret } @@ -1819,12 +1819,12 @@ ^^^^^^^^^^^^^^^^^^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:f32 = complement 2i ret } @@ -1860,14 +1860,14 @@ ^^^^^^^ :4:7 note: In block - %b2 = block { # true - ^^^^^^^^^^^ + $B2: { # true + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - if true [t: %b2] { # if_1 - %b2 = block { # true +%my_func = func():void { + $B1: { + if true [t: $B2] { # if_1 + $B2: { # true exit_if # undef } } @@ -1899,18 +1899,18 @@ ^^^^^^^^^^ :4:7 note: In block - %b2 = block { # true - ^^^^^^^^^^^ + $B2: { # true + ^^^ :3:5 note: control instruction - %2:i32, %3:f32 = if true [t: %b2] { # if_1 + %2:i32, %3:f32 = if true [t: $B2] { # if_1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - %2:i32, %3:f32 = if true [t: %b2] { # if_1 - %b2 = block { # true +%my_func = func():void { + $B1: { + %2:i32, %3:f32 = if true [t: $B2] { # if_1 + $B2: { # true exit_if 1i # if_1 } # implicit false block: exit_if undef, undef @@ -1943,18 +1943,18 @@ ^^^^^^^^^^^^^^^^^^^^ :4:7 note: In block - %b2 = block { # true - ^^^^^^^^^^^ + $B2: { # true + ^^^ :3:5 note: control instruction - %2:i32, %3:f32 = if true [t: %b2] { # if_1 + %2:i32, %3:f32 = if true [t: $B2] { # if_1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - %2:i32, %3:f32 = if true [t: %b2] { # if_1 - %b2 = block { # true +%my_func = func():void { + $B1: { + %2:i32, %3:f32 = if true [t: $B2] { # if_1 + $B2: { # true exit_if 1i, 2.0f, 3i # if_1 } # implicit false block: exit_if undef, undef @@ -2004,18 +2004,18 @@ ^^ :4:7 note: In block - %b2 = block { # true - ^^^^^^^^^^^ + $B2: { # true + ^^^ :3:5 note: control instruction - %2:i32, %3:f32 = if true [t: %b2] { # if_1 + %2:i32, %3:f32 = if true [t: $B2] { # if_1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - %2:i32, %3:f32 = if true [t: %b2] { # if_1 - %b2 = block { # true +%my_func = func():void { + $B1: { + %2:i32, %3:f32 = if true [t: $B2] { # if_1 + $B2: { # true exit_if 1i, 2i # if_1 } # implicit false block: exit_if undef, undef @@ -2044,14 +2044,14 @@ ^^^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - if true [t: %b2] { # if_1 - %b2 = block { # true +%my_func = func():void { + $B1: { + if true [t: $B2] { # if_1 + $B2: { # true ret } } @@ -2087,20 +2087,20 @@ ^^^^^^^ :6:11 note: In block - %b3 = block { # true - ^^^^^^^^^^^ + $B3: { # true + ^^^ :5:9 note: first control instruction jumped - if true [t: %b3] { # if_2 + if true [t: $B3] { # if_2 ^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - if true [t: %b2] { # if_1 - %b2 = block { # true - if true [t: %b3] { # if_2 - %b3 = block { # true +%my_func = func():void { + $B1: { + if true [t: $B2] { # if_1 + $B2: { # true + if true [t: $B3] { # if_2 + $B3: { # true exit_if # if_1 } } @@ -2140,20 +2140,20 @@ ^^^^^^^ :6:11 note: In block - %b3 = block { # case - ^^^^^^^^^^^ + $B3: { # case + ^^^ :5:9 note: first control instruction jumped - switch 1i [c: (1i, %b3)] { # switch_1 + switch 1i [c: (1i, $B3)] { # switch_1 ^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - if true [t: %b2] { # if_1 - %b2 = block { # true - switch 1i [c: (1i, %b3)] { # switch_1 - %b3 = block { # case +%my_func = func():void { + $B1: { + if true [t: $B2] { # if_1 + $B2: { # true + switch 1i [c: (1i, $B3)] { # switch_1 + $B3: { # case exit_if # if_1 } } @@ -2192,20 +2192,20 @@ ^^^^^^^ :6:11 note: In block - %b3 = block { # body - ^^^^^^^^^^^ + $B3: { # body + ^^^ :5:9 note: first control instruction jumped - loop [b: %b3] { # loop_1 + loop [b: $B3] { # loop_1 ^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - if true [t: %b2] { # if_1 - %b2 = block { # true - loop [b: %b3] { # loop_1 - %b3 = block { # body +%my_func = func():void { + $B1: { + if true [t: $B2] { # if_1 + $B2: { # true + loop [b: $B3] { # loop_1 + $B3: { # body exit_if # if_1 } } @@ -2251,14 +2251,14 @@ ^^^^^^^^^^^ :4:7 note: In block - %b2 = block { # case - ^^^^^^^^^^^ + $B2: { # case + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - switch true [c: (default, %b2)] { # switch_1 - %b2 = block { # case +%my_func = func():void { + $B1: { + switch true [c: (default, $B2)] { # switch_1 + $B2: { # case exit_switch # undef } } @@ -2292,18 +2292,18 @@ ^^^^^^^^^^^^^^ :4:7 note: In block - %b2 = block { # case - ^^^^^^^^^^^ + $B2: { # case + ^^^ :3:5 note: control instruction - %2:i32, %3:f32 = switch true [c: (default, %b2)] { # switch_1 + %2:i32, %3:f32 = switch true [c: (default, $B2)] { # switch_1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - %2:i32, %3:f32 = switch true [c: (default, %b2)] { # switch_1 - %b2 = block { # case +%my_func = func():void { + $B1: { + %2:i32, %3:f32 = switch true [c: (default, $B2)] { # switch_1 + $B2: { # case exit_switch 1i # switch_1 } } @@ -2336,18 +2336,18 @@ ^^^^^^^^^^^^^^^^^^^^^^^^ :4:7 note: In block - %b2 = block { # case - ^^^^^^^^^^^ + $B2: { # case + ^^^ :3:5 note: control instruction - %2:i32, %3:f32 = switch true [c: (default, %b2)] { # switch_1 + %2:i32, %3:f32 = switch true [c: (default, $B2)] { # switch_1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - %2:i32, %3:f32 = switch true [c: (default, %b2)] { # switch_1 - %b2 = block { # case +%my_func = func():void { + $B1: { + %2:i32, %3:f32 = switch true [c: (default, $B2)] { # switch_1 + $B2: { # case exit_switch 1i, 2.0f, 3i # switch_1 } } @@ -2398,18 +2398,18 @@ ^^ :4:7 note: In block - %b2 = block { # case - ^^^^^^^^^^^ + $B2: { # case + ^^^ :3:5 note: control instruction - %2:i32, %3:f32 = switch true [c: (default, %b2)] { # switch_1 + %2:i32, %3:f32 = switch true [c: (default, $B2)] { # switch_1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - %2:i32, %3:f32 = switch true [c: (default, %b2)] { # switch_1 - %b2 = block { # case +%my_func = func():void { + $B1: { + %2:i32, %3:f32 = switch true [c: (default, $B2)] { # switch_1 + $B2: { # case exit_switch 1i, 2i # switch_1 } } @@ -2442,19 +2442,19 @@ ^^^^^^^^^^^ :9:7 note: In block - %b3 = block { # true - ^^^^^^^^^^^ + $B3: { # true + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - switch true [c: (default, %b2)] { # switch_1 - %b2 = block { # case +%my_func = func():void { + $B1: { + switch true [c: (default, $B2)] { # switch_1 + $B2: { # case ret } } - if true [t: %b3] { # if_1 - %b3 = block { # true + if true [t: $B3] { # if_1 + $B3: { # true exit_switch # switch_1 } } @@ -2523,20 +2523,20 @@ ^^^^^^^^^^^ :6:11 note: In block - %b3 = block { # case - ^^^^^^^^^^^ + $B3: { # case + ^^^ :5:9 note: first control instruction jumped - switch false [c: (default, %b3)] { # switch_2 + switch false [c: (default, $B3)] { # switch_2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - switch true [c: (default, %b2)] { # switch_1 - %b2 = block { # case - switch false [c: (default, %b3)] { # switch_2 - %b3 = block { # case +%my_func = func():void { + $B1: { + switch true [c: (default, $B2)] { # switch_1 + $B2: { # case + switch false [c: (default, $B3)] { # switch_2 + $B3: { # case exit_switch # switch_1 } } @@ -2574,20 +2574,20 @@ ^^^^^^^^^^^ :6:11 note: In block - %b3 = block { # body - ^^^^^^^^^^^ + $B3: { # body + ^^^ :5:9 note: first control instruction jumped - loop [b: %b3] { # loop_1 + loop [b: $B3] { # loop_1 ^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - switch true [c: (default, %b2)] { # switch_1 - %b2 = block { # case - loop [b: %b3] { # loop_1 - %b3 = block { # body +%my_func = func():void { + $B1: { + switch true [c: (default, $B2)] { # switch_1 + $B2: { # case + loop [b: $B3] { # loop_1 + $B3: { # body exit_switch # switch_1 } } @@ -2631,18 +2631,18 @@ ^^^^^^^^^ :4:7 note: In block - %b2 = block { # body - ^^^^^^^^^^^ + $B2: { # body + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body +%my_func = func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body exit_loop # undef } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } ret @@ -2674,22 +2674,22 @@ ^^^^^^^^^^^^ :4:7 note: In block - %b2 = block { # body - ^^^^^^^^^^^ + $B2: { # body + ^^^ :3:5 note: control instruction - %2:i32, %3:f32 = loop [b: %b2, c: %b3] { # loop_1 + %2:i32, %3:f32 = loop [b: $B2, c: $B3] { # loop_1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - %2:i32, %3:f32 = loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body +%my_func = func():void { + $B1: { + %2:i32, %3:f32 = loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body exit_loop 1i # loop_1 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } ret @@ -2721,22 +2721,22 @@ ^^^^^^^^^^^^^^^^^^^^^^ :4:7 note: In block - %b2 = block { # body - ^^^^^^^^^^^ + $B2: { # body + ^^^ :3:5 note: control instruction - %2:i32, %3:f32 = loop [b: %b2, c: %b3] { # loop_1 + %2:i32, %3:f32 = loop [b: $B2, c: $B3] { # loop_1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - %2:i32, %3:f32 = loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body +%my_func = func():void { + $B1: { + %2:i32, %3:f32 = loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body exit_loop 1i, 2.0f, 3i # loop_1 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } ret @@ -2786,22 +2786,22 @@ ^^ :4:7 note: In block - %b2 = block { # body - ^^^^^^^^^^^ + $B2: { # body + ^^^ :3:5 note: control instruction - %2:i32, %3:f32 = loop [b: %b2, c: %b3] { # loop_1 + %2:i32, %3:f32 = loop [b: $B2, c: $B3] { # loop_1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - %2:i32, %3:f32 = loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body +%my_func = func():void { + $B1: { + %2:i32, %3:f32 = loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body exit_loop 1i, 2i # loop_1 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } ret @@ -2832,22 +2832,22 @@ ^^^^^^^^^ :12:7 note: In block - %b4 = block { # true - ^^^^^^^^^^^ + $B4: { # true + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body +%my_func = func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body ret } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } - if true [t: %b4] { # if_1 - %b4 = block { # true + if true [t: $B4] { # if_1 + $B4: { # true exit_loop # loop_1 } } @@ -2915,27 +2915,27 @@ ^^^^^^^^^ :6:11 note: In block - %b4 = block { # case - ^^^^^^^^^^^ + $B4: { # case + ^^^ :5:9 note: first control instruction jumped - switch false [c: (default, %b4)] { # switch_1 + switch false [c: (default, $B4)] { # switch_1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - switch false [c: (default, %b4)] { # switch_1 - %b4 = block { # case +%my_func = func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + switch false [c: (default, $B4)] { # switch_1 + $B4: { # case exit_loop # loop_1 } } exit_loop # loop_1 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } ret @@ -2970,27 +2970,27 @@ ^^^^^^^^^ :6:11 note: In block - %b4 = block { # body - ^^^^^^^^^^^ + $B4: { # body + ^^^ :5:9 note: first control instruction jumped - loop [b: %b4] { # loop_2 + loop [b: $B4] { # loop_2 ^^^^^^^^^^^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - loop [b: %b4] { # loop_2 - %b4 = block { # body +%my_func = func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + loop [b: $B4] { # loop_2 + $B4: { # body exit_loop # loop_1 } } exit_loop # loop_1 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } ret @@ -3020,17 +3020,17 @@ ^^^^^^^^^ :7:7 note: In block - %b3 = block { # continuing - ^^^^^^^^^^^ + $B3: { # continuing + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - continue %b3 +%my_func = func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + continue # -> $B3 } - %b3 = block { # continuing + $B3: { # continuing exit_loop # loop_1 } } @@ -3066,27 +3066,27 @@ ^^^^^^^^^ :9:11 note: In block - %b4 = block { # true - ^^^^^^^^^^^ + $B4: { # true + ^^^ :7:7 note: in continuing block - %b3 = block { # continuing - ^^^^^^^^^^^ + $B3: { # continuing + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - continue %b3 +%my_func = func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + continue # -> $B3 } - %b3 = block { # continuing - if true [t: %b4] { # if_1 - %b4 = block { # true + $B3: { # continuing + if true [t: $B4] { # if_1 + $B4: { # true exit_loop # loop_1 } } - next_iteration %b2 + next_iteration # -> $B2 } } ret @@ -3118,21 +3118,21 @@ ^^^^^^^^^ :4:7 note: In block - %b2 = block { # initializer - ^^^^^^^^^^^ + $B2: { # initializer + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [i: %b2, b: %b3, c: %b4] { # loop_1 - %b2 = block { # initializer +%my_func = func():void { + $B1: { + loop [i: $B2, b: $B3, c: $B4] { # loop_1 + $B2: { # initializer exit_loop # loop_1 } - %b3 = block { # body - continue %b4 + $B3: { # body + continue # -> $B4 } - %b4 = block { # continuing - next_iteration %b3 + $B4: { # continuing + next_iteration # -> $B3 } } ret @@ -3168,30 +3168,30 @@ ^^^^^^^^^ :6:11 note: In block - %b5 = block { # true - ^^^^^^^^^^^ + $B5: { # true + ^^^ :4:7 note: in initializer block - %b2 = block { # initializer - ^^^^^^^^^^^ + $B2: { # initializer + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { - loop [i: %b2, b: %b3, c: %b4] { # loop_1 - %b2 = block { # initializer - if true [t: %b5] { # if_1 - %b5 = block { # true +%my_func = func():void { + $B1: { + loop [i: $B2, b: $B3, c: $B4] { # loop_1 + $B2: { # initializer + if true [t: $B5] { # if_1 + $B5: { # true exit_loop # loop_1 } } - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body - continue %b4 + $B3: { # body + continue # -> $B4 } - %b4 = block { # continuing - next_iteration %b3 + $B4: { # continuing + next_iteration # -> $B3 } } ret @@ -3231,12 +3231,12 @@ ^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { ret } } @@ -3256,12 +3256,12 @@ ^^^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { ret 42i } } @@ -3281,12 +3281,12 @@ ^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():i32 -> %b1 { - %b1 = block { +%my_func = func():i32 { + $B1: { ret } } @@ -3307,12 +3307,12 @@ ^^^^^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():i32 -> %b1 { - %b1 = block { +%my_func = func():i32 { + $B1: { ret 42.0f } } @@ -3335,12 +3335,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:i32 = load undef ret } @@ -3366,12 +3366,12 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %l:i32 = let 1i %3:f32 = load %l ret @@ -3398,12 +3398,12 @@ ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, i32, read_write> = var %3:f32 = load %2 ret @@ -3427,12 +3427,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { store undef, 42i ret } @@ -3456,12 +3456,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, i32, read_write> = var store %2, undef ret @@ -3487,12 +3487,12 @@ ^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %l:i32 = let 1i store %l, 42u ret @@ -3518,12 +3518,12 @@ ^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 42u ret @@ -3550,12 +3550,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, vec3<f32>, read_write> = var undef = load_vector_element %2, 1i ret @@ -3580,12 +3580,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:f32 = load_vector_element undef, 1i ret } @@ -3610,12 +3610,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, vec3<f32>, read_write> = var %3:f32 = load_vector_element %2, undef ret @@ -3640,12 +3640,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { store_vector_element undef, 1i, 2i ret } @@ -3670,20 +3670,20 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ :4:37 error: store_vector_element: value type does not match vector pointer element type store_vector_element %2, undef, 2i ^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, vec3<f32>, read_write> = var store_vector_element %2, undef, 2i ret @@ -3709,12 +3709,12 @@ ^^^^^ :2:3 note: In block - %b1 = block { - ^^^^^^^^^^^ + $B1: { + ^^^ note: # Disassembly -%my_func = func():void -> %b1 { - %b1 = block { +%my_func = func():void { + $B1: { %2:ptr<function, vec3<f32>, read_write> = var store_vector_element %2, 1i, undef ret
diff --git a/src/tint/lang/glsl/writer/writer_ast_fuzz.cc b/src/tint/lang/glsl/writer/writer_ast_fuzz.cc index 577f4f2..839e466 100644 --- a/src/tint/lang/glsl/writer/writer_ast_fuzz.cc +++ b/src/tint/lang/glsl/writer/writer_ast_fuzz.cc
@@ -35,13 +35,31 @@ namespace tint::glsl::writer { namespace { -void ASTFuzzer(const tint::Program& program, Options options) { +bool CanRun(const tint::Program& program, const Options& options) { if (program.AST().HasOverrides()) { - return; + return false; // Overrides are not supported. } - if (options.first_instance_offset > 0x10000) { - return; // Excessive values can cause OOM. + // Excessive values can cause OOM / timeouts in the PadStructs transform. + static constexpr uint32_t kMaxOffset = 0x1000; + + if (options.first_instance_offset > kMaxOffset) { + return false; + } + + if (options.depth_range_offsets) { + if (options.depth_range_offsets->max > kMaxOffset || + options.depth_range_offsets->min > kMaxOffset) { + return false; + } + } + + return true; +} + +void ASTFuzzer(const tint::Program& program, const Options& options) { + if (!CanRun(program, options)) { + return; } auto inspector = tint::inspector::Inspector(program);
diff --git a/src/tint/lang/msl/writer/raise/builtin_polyfill_test.cc b/src/tint/lang/msl/writer/raise/builtin_polyfill_test.cc index b61a9a0..915307b 100644 --- a/src/tint/lang/msl/writer/raise/builtin_polyfill_test.cc +++ b/src/tint/lang/msl/writer/raise/builtin_polyfill_test.cc
@@ -52,8 +52,8 @@ }); auto* src = R"( -%foo = @compute func():void -> %b1 { - %b1 = block { +%foo = @compute func():void { + $B1: { %2:void = workgroupBarrier ret } @@ -62,8 +62,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = @compute func():void -> %b1 { - %b1 = block { +%foo = @compute func():void { + $B1: { %2:void = msl.threadgroup_barrier 4u ret } @@ -84,8 +84,8 @@ }); auto* src = R"( -%foo = @compute func():void -> %b1 { - %b1 = block { +%foo = @compute func():void { + $B1: { %2:void = storageBarrier ret } @@ -94,8 +94,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = @compute func():void -> %b1 { - %b1 = block { +%foo = @compute func():void { + $B1: { %2:void = msl.threadgroup_barrier 1u ret } @@ -116,8 +116,8 @@ }); auto* src = R"( -%foo = @compute func():void -> %b1 { - %b1 = block { +%foo = @compute func():void { + $B1: { %2:void = textureBarrier ret } @@ -126,8 +126,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = @compute func():void -> %b1 { - %b1 = block { +%foo = @compute func():void { + $B1: { %2:void = msl.threadgroup_barrier 2u ret }
diff --git a/src/tint/lang/spirv/reader/lower/vector_element_pointer_test.cc b/src/tint/lang/spirv/reader/lower/vector_element_pointer_test.cc index e7160a5..ade391c 100644 --- a/src/tint/lang/spirv/reader/lower/vector_element_pointer_test.cc +++ b/src/tint/lang/spirv/reader/lower/vector_element_pointer_test.cc
@@ -48,8 +48,8 @@ }); auto* src = R"( -%foo = func():u32 -> %b1 { - %b1 = block { +%foo = func():u32 { + $B1: { %2:u32 = access %vec, 2u ret %2 } @@ -73,8 +73,8 @@ }); auto* src = R"( -%foo = func():vec4<u32> -> %b1 { - %b1 = block { +%foo = func():vec4<u32> { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %3:ptr<function, vec4<u32>, read_write> = access %vec %4:vec4<u32> = load %3 @@ -102,8 +102,8 @@ }); auto* src = R"( -%foo = func():vec4<u32> -> %b1 { - %b1 = block { +%foo = func():vec4<u32> { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %3:ptr<function, vec4<u32>, read_write> = access %vec %4:ptr<function, vec4<u32>, read_write> = access %3 @@ -131,8 +131,8 @@ }); auto* src = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %3:ptr<function, u32, read_write> = access %vec, 2u ret @@ -142,8 +142,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var ret } @@ -165,8 +165,8 @@ }); auto* src = R"( -%foo = func():u32 -> %b1 { - %b1 = block { +%foo = func():u32 { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %3:ptr<function, u32, read_write> = access %vec, 2u %4:u32 = load %3 @@ -177,8 +177,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():u32 -> %b1 { - %b1 = block { +%foo = func():u32 { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %3:u32 = load_vector_element %vec, 2u ret %3 @@ -201,8 +201,8 @@ }); auto* src = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %3:ptr<function, u32, read_write> = access %vec, 2u store %3, 42u @@ -213,8 +213,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var store_vector_element %vec, 2u, 42u ret @@ -238,8 +238,8 @@ }); auto* src = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %3:ptr<function, u32, read_write> = access %vec, 2u %4:ptr<function, u32, read_write> = access %3 @@ -251,8 +251,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var store_vector_element %vec, 2u, 42u ret @@ -277,8 +277,8 @@ }); auto* src = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %3:ptr<function, u32, read_write> = access %vec, 2u %4:u32 = load %3 @@ -291,8 +291,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %vec:ptr<function, vec4<u32>, read_write> = var %3:u32 = load_vector_element %vec, 2u %4:u32 = add %3, 1u @@ -317,8 +317,8 @@ }); auto* src = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %mat:ptr<function, mat4x4<f32>, read_write> = var %3:ptr<function, f32, read_write> = access %mat, 1u, 2u store %3, 42.0f @@ -329,8 +329,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %mat:ptr<function, mat4x4<f32>, read_write> = var %3:ptr<function, vec4<f32>, read_write> = access %mat, 1u store_vector_element %3, 2u, 42.0f @@ -354,8 +354,8 @@ }); auto* src = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %arr:ptr<function, array<vec4<f32>, 4>, read_write> = var %3:ptr<function, f32, read_write> = access %arr, 1u, 2u store %3, 42.0f @@ -366,8 +366,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %arr:ptr<function, array<vec4<f32>, 4>, read_write> = var %3:ptr<function, vec4<f32>, read_write> = access %arr, 1u store_vector_element %3, 2u, 42.0f @@ -400,8 +400,8 @@ vec:vec4<f32> @offset(0) } -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %str:ptr<function, str, read_write> = var %3:ptr<function, f32, read_write> = access %str, 0u, 2u store %3, 42.0f @@ -416,8 +416,8 @@ vec:vec4<f32> @offset(0) } -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %str:ptr<function, str, read_write> = var %3:ptr<function, vec4<f32>, read_write> = access %str, 0u store_vector_element %3, 2u, 42.0f @@ -452,8 +452,8 @@ inner:array<mat4x4<f32>, 4> @offset(0) } -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %arr:ptr<function, array<str, 4>, read_write> = var %3:ptr<function, f32, read_write> = access %arr, 1u, 0u, 3u, 2u, 1u store %3, 42.0f @@ -468,8 +468,8 @@ inner:array<mat4x4<f32>, 4> @offset(0) } -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %arr:ptr<function, array<str, 4>, read_write> = var %3:ptr<function, vec4<f32>, read_write> = access %arr, 1u, 0u, 3u, 2u store_vector_element %3, 1u, 42.0f
diff --git a/src/tint/lang/spirv/reader/parser/composite_test.cc b/src/tint/lang/spirv/reader/parser/composite_test.cc index 6a0ce9f..463e33b 100644 --- a/src/tint/lang/spirv/reader/parser/composite_test.cc +++ b/src/tint/lang/spirv/reader/parser/composite_test.cc
@@ -57,7 +57,8 @@ OpFunctionEnd )", R"( - %b2 = block { +%2 = func():vec4<u32> { + $B2: { %3:vec4<u32> = construct 1u, 2u, 3u, 4u ret %3 } @@ -95,7 +96,8 @@ OpFunctionEnd )", R"( - %b2 = block { +%2 = func():mat4x3<f32> { + $B2: { %3:vec3<f32> = construct 1.0f, 2.0f, 3.0f %4:vec3<f32> = construct 2.0f, 3.0f, 1.0f %5:vec3<f32> = construct 3.0f, 2.0f, 1.0f @@ -133,7 +135,8 @@ OpFunctionEnd )", R"( - %b2 = block { +%2 = func():array<u32, 4> { + $B2: { %3:array<u32, 4> = construct 1u, 2u, 3u, 4u ret %3 } @@ -172,7 +175,8 @@ OpFunctionEnd )", R"( - %b2 = block { +%2 = func():array<vec4<u32>, 4> { + $B2: { %3:vec4<u32> = construct 1u, 2u, 3u, 4u %4:vec4<u32> = construct 2u, 3u, 4u, 1u %5:vec4<u32> = construct 3u, 4u, 1u, 2u @@ -222,13 +226,13 @@ tint_symbol_2:array<vec4<u32>, 2> @offset(32) } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { ret } } -%2 = func():tint_symbol_3 -> %b2 { - %b2 = block { +%2 = func():tint_symbol_3 { + $B2: { %3:vec4<u32> = construct 1u, 2u, 3u, 4u %4:vec4<u32> = construct 2u, 3u, 4u, 1u %5:vec4<u32> = construct 3u, 4u, 1u, 2u @@ -264,8 +268,8 @@ OpFunctionEnd )", R"( -%2 = func(%3:vec4<u32>):u32 -> %b2 { - %b2 = block { +%2 = func(%3:vec4<u32>):u32 { + $B2: { %4:u32 = access %3, 2u ret %4 } @@ -299,8 +303,8 @@ OpFunctionEnd )", R"( -%2 = func(%3:mat4x3<f32>):vec3<f32> -> %b2 { - %b2 = block { +%2 = func(%3:mat4x3<f32>):vec3<f32> { + $B2: { %4:vec3<f32> = access %3, 2u ret %4 } @@ -334,8 +338,8 @@ OpFunctionEnd )", R"( -%2 = func(%3:mat4x3<f32>):f32 -> %b2 { - %b2 = block { +%2 = func(%3:mat4x3<f32>):f32 { + $B2: { %4:f32 = access %3, 2u, 1u ret %4 } @@ -368,8 +372,8 @@ OpFunctionEnd )", R"( -%2 = func(%3:array<u32, 4>):u32 -> %b2 { - %b2 = block { +%2 = func(%3:array<u32, 4>):u32 { + $B2: { %4:u32 = access %3, 2u ret %4 } @@ -403,8 +407,8 @@ OpFunctionEnd )", R"( -%2 = func(%3:array<vec3<u32>, 4>):u32 -> %b2 { - %b2 = block { +%2 = func(%3:array<vec3<u32>, 4>):u32 { + $B2: { %4:u32 = access %3, 1u, 2u ret %4 } @@ -441,13 +445,13 @@ tint_symbol_1:u32 @offset(4) } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { ret } } -%2 = func(%3:tint_symbol_2):u32 -> %b2 { - %b2 = block { +%2 = func(%3:tint_symbol_2):u32 { + $B2: { %4:u32 = access %3, 1u ret %4 }
diff --git a/src/tint/lang/spirv/reader/parser/constant_test.cc b/src/tint/lang/spirv/reader/parser/constant_test.cc index 862db10..b509dc0 100644 --- a/src/tint/lang/spirv/reader/parser/constant_test.cc +++ b/src/tint/lang/spirv/reader/parser/constant_test.cc
@@ -64,8 +64,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:void = call %2, true %6:void = call %2, false %7:void = call %2, false @@ -115,8 +115,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:void = call %2, 0i %6:void = call %2, 1i %7:void = call %2, -1i @@ -165,8 +165,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:void = call %2, 0u %6:void = call %2, 1u %7:void = call %2, 4294967295u @@ -218,8 +218,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:void = call %2, 0.0h %6:void = call %2, 1.0h %7:void = call %2, 65504.0h @@ -272,8 +272,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:void = call %2, 0.0f %6:void = call %2, 1.0f %7:void = call %2, 340282346638528859811704183484516925440.0f @@ -321,8 +321,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:vec2<bool> = call %2, vec2<bool>(true, false) %6:vec2<bool> = call %2, vec2<bool>(false) ret @@ -367,8 +367,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:vec3<i32> = call %2, vec3<i32>(0i, 1i, -1i) %6:vec3<i32> = call %2, vec3<i32>(0i) ret @@ -414,8 +414,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:vec4<f32> = call %2, vec4<f32>(0.0f, 1.0f, 340282346638528859811704183484516925440.0f, -340282346638528859811704183484516925440.0f) %6:vec4<f32> = call %2, vec4<f32>(0.0f) ret @@ -462,8 +462,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:mat2x4<f32> = call %2, mat2x4<f32>(vec4<f32>(0.0f), vec4<f32>(1.0f)) %6:mat2x4<f32> = call %2, mat2x4<f32>(vec4<f32>(0.0f)) ret @@ -513,8 +513,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:mat3x2<f16> = call %2, mat3x2<f16>(vec2<f16>(0.0h), vec2<f16>(1.0h), vec2<f16>(65504.0h)) %6:mat3x2<f16> = call %2, mat3x2<f16>(vec2<f16>(0.0h)) ret @@ -561,8 +561,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:array<i32, 4> = call %2, array<i32, 4>(0i, 1i, -1i, 2147483647i) %6:array<i32, 4> = call %2, array<i32, 4>(0i) ret @@ -614,8 +614,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:array<array<f32, 4>, 2> = call %2, array<array<f32, 4>, 2>(array<f32, 4>(0.0f, 1.0f, 340282346638528859811704183484516925440.0f, -340282346638528859811704183484516925440.0f), array<f32, 4>(-340282346638528859811704183484516925440.0f, 340282346638528859811704183484516925440.0f, 1.0f, 0.0f)) %6:array<array<f32, 4>, 2> = call %2, array<array<f32, 4>, 2>(array<f32, 4>(0.0f)) ret @@ -660,8 +660,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:tint_symbol_2 = call %2, tint_symbol_2(42i, -1.0f) %6:tint_symbol_2 = call %2, tint_symbol_2(0i, 0.0f) ret @@ -715,8 +715,8 @@ OpFunctionEnd )", R"( -%4 = func():void -> %b3 { - %b3 = block { +%4 = func():void { + $B3: { %5:tint_symbol_5 = call %2, tint_symbol_5(array<tint_symbol_2, 2>(tint_symbol_2(42i, -1.0f), tint_symbol_2(-1i, 42.0f)), array<tint_symbol_2, 2>(tint_symbol_2(-1i, 42.0f), tint_symbol_2(42i, -1.0f))) %6:tint_symbol_5 = call %2, tint_symbol_5(array<tint_symbol_2, 2>(tint_symbol_2(0i, 0.0f))) ret
diff --git a/src/tint/lang/spirv/reader/parser/function_test.cc b/src/tint/lang/spirv/reader/parser/function_test.cc index a66b1e0..d268ebb 100644 --- a/src/tint/lang/spirv/reader/parser/function_test.cc +++ b/src/tint/lang/spirv/reader/parser/function_test.cc
@@ -44,8 +44,8 @@ OpFunctionEnd )", R"( -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { ret } } @@ -66,8 +66,8 @@ OpFunctionEnd )", R"( -%main = @compute @workgroup_size(3, 4, 5) func():void -> %b1 { - %b1 = block { +%main = @compute @workgroup_size(3, 4, 5) func():void { + $B1: { ret } } @@ -88,8 +88,8 @@ OpFunctionEnd )", R"( -%main = @fragment func():void -> %b1 { - %b1 = block { +%main = @fragment func():void { + $B1: { ret } } @@ -109,8 +109,8 @@ OpFunctionEnd )", R"( -%main = @vertex func():void -> %b1 { - %b1 = block { +%main = @vertex func():void { + $B1: { ret } } @@ -139,13 +139,13 @@ OpFunctionEnd )", R"( -%foo = @compute @workgroup_size(3, 4, 5) func():void -> %b1 { - %b1 = block { +%foo = @compute @workgroup_size(3, 4, 5) func():void { + $B1: { ret } } -%bar = @compute @workgroup_size(6, 7, 8) func():void -> %b2 { - %b2 = block { +%bar = @compute @workgroup_size(6, 7, 8) func():void { + $B2: { ret } } @@ -173,13 +173,13 @@ OpFunctionEnd )", R"( -%1 = func():void -> %b1 { - %b1 = block { +%1 = func():void { + $B1: { ret } } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:void = call %1 ret } @@ -208,14 +208,14 @@ OpFunctionEnd )", R"( -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:void = call %3 ret } } -%3 = func():void -> %b2 { - %b2 = block { +%3 = func():void { + $B2: { ret } } @@ -249,13 +249,13 @@ OpFunctionEnd )", R"( -%1 = func(%2:bool):void -> %b1 { - %b1 = block { +%1 = func(%2:bool):void { + $B1: { ret } } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %4:void = call %1, true %5:void = call %1, false ret @@ -298,19 +298,19 @@ OpFunctionEnd )", R"( -%1 = func(%2:bool):void -> %b1 { - %b1 = block { +%1 = func(%2:bool):void { + $B1: { ret } } -%3 = func(%4:bool):void -> %b2 { - %b2 = block { +%3 = func(%4:bool):void { + $B2: { %5:void = call %1, %4 ret } } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b3 { - %b3 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B3: { %7:void = call %3, true %8:void = call %3, false ret @@ -346,13 +346,13 @@ OpFunctionEnd )", R"( -%1 = func(%2:bool, %3:bool):void -> %b1 { - %b1 = block { +%1 = func(%2:bool, %3:bool):void { + $B1: { ret } } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %5:void = call %1, true, false ret } @@ -384,13 +384,13 @@ OpFunctionEnd )", R"( -%1 = func():bool -> %b1 { - %b1 = block { +%1 = func():bool { + $B1: { ret true } } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:bool = call %1 ret } @@ -428,19 +428,19 @@ OpFunctionEnd )", R"( -%1 = func():bool -> %b1 { - %b1 = block { +%1 = func():bool { + $B1: { ret true } } -%2 = func():bool -> %b2 { - %b2 = block { +%2 = func():bool { + $B2: { %3:bool = call %2 ret %3 } } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b3 { - %b3 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B3: { %5:bool = call %1 ret } @@ -473,13 +473,13 @@ OpFunctionEnd )", R"( -%1 = func(%2:bool):bool -> %b1 { - %b1 = block { +%1 = func(%2:bool):bool { + $B1: { ret %2 } } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %4:bool = call %1, true ret }
diff --git a/src/tint/lang/spirv/reader/parser/memory_test.cc b/src/tint/lang/spirv/reader/parser/memory_test.cc index acb3972..90e4945 100644 --- a/src/tint/lang/spirv/reader/parser/memory_test.cc +++ b/src/tint/lang/spirv/reader/parser/memory_test.cc
@@ -48,7 +48,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, u32, read_write> = var %3:u32 = load %2 ret @@ -75,7 +76,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, vec4<u32>, read_write> = var %3:vec4<u32> = load %2 ret @@ -105,7 +107,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, vec4<u32>, read_write> = var %3:ptr<function, u32, read_write> = access %2, 2u %4:u32 = load %3 @@ -135,7 +138,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, mat3x4<f32>, read_write> = var %3:mat3x4<f32> = load %2 ret @@ -167,7 +171,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, mat3x4<f32>, read_write> = var %3:ptr<function, vec4<f32>, read_write> = access %2, 2u %4:vec4<f32> = load %3 @@ -196,7 +201,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, array<u32, 4>, read_write> = var %3:array<u32, 4> = load %2 ret @@ -227,7 +233,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, array<u32, 4>, read_write> = var %3:ptr<function, u32, read_write> = access %2, 2u %4:u32 = load %3 @@ -255,7 +262,13 @@ OpFunctionEnd )", R"( - %b1 = block { +tint_symbol_2 = struct @align(4) { + tint_symbol:u32 @offset(0) + tint_symbol_1:u32 @offset(4) +} + +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, tint_symbol_2, read_write> = var %3:tint_symbol_2 = load %2 ret @@ -285,7 +298,13 @@ OpFunctionEnd )", R"( - %b1 = block { +tint_symbol_2 = struct @align(4) { + tint_symbol:u32 @offset(0) + tint_symbol_1:u32 @offset(4) +} + +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, tint_symbol_2, read_write> = var %3:ptr<function, u32, read_write> = access %2, 1u %4:u32 = load %3 @@ -313,7 +332,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, u32, read_write> = var store %2, 42u ret @@ -341,7 +361,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, vec4<u32>, read_write> = var store %2, vec4<u32>(0u) ret @@ -372,7 +393,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, vec4<u32>, read_write> = var %3:ptr<function, u32, read_write> = access %2, 2u store %3, 42u @@ -403,7 +425,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, mat3x4<f32>, read_write> = var store %2, mat3x4<f32>(vec4<f32>(0.0f)) ret @@ -436,7 +459,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, mat3x4<f32>, read_write> = var %3:ptr<function, vec4<f32>, read_write> = access %2, 2u store %3, vec4<f32>(0.0f) @@ -466,7 +490,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, array<u32, 4>, read_write> = var store %2, array<u32, 4>(0u) ret @@ -498,7 +523,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, array<u32, 4>, read_write> = var %3:ptr<function, u32, read_write> = access %2, 2u store %3, 42u @@ -527,7 +553,13 @@ OpFunctionEnd )", R"( - %b1 = block { +tint_symbol_2 = struct @align(4) { + tint_symbol:u32 @offset(0) + tint_symbol_1:u32 @offset(4) +} + +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, tint_symbol_2, read_write> = var store %2, tint_symbol_2(0u) ret @@ -558,7 +590,13 @@ OpFunctionEnd )", R"( - %b1 = block { +tint_symbol_2 = struct @align(4) { + tint_symbol:u32 @offset(0) + tint_symbol_1:u32 @offset(4) +} + +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, tint_symbol_2, read_write> = var %3:ptr<function, u32, read_write> = access %2, 1u store %3, 42u @@ -596,7 +634,14 @@ OpFunctionEnd )", R"( - %b1 = block { + tint_symbol:array<u32, 4> @offset(0) + tint_symbol_1:array<u32, 4> @offset(16) + tint_symbol_2:array<u32, 4> @offset(32) + tint_symbol_3:array<u32, 4> @offset(48) +} + +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, array<tint_symbol_4, 4>, read_write> = var %3:ptr<function, u32, read_write> = access %2, 1u, 2u, 3u %4:u32 = load %3 @@ -639,7 +684,14 @@ OpFunctionEnd )", R"( - %b1 = block { + tint_symbol:array<u32, 4> @offset(0) + tint_symbol_1:array<u32, 4> @offset(16) + tint_symbol_2:array<u32, 4> @offset(32) + tint_symbol_3:array<u32, 4> @offset(48) +} + +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, array<tint_symbol_4, 4>, read_write> = var %3:ptr<function, tint_symbol_4, read_write> = access %2, 1u %4:ptr<function, array<u32, 4>, read_write> = access %3, 2u @@ -671,7 +723,8 @@ OpFunctionEnd )", R"( - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, u32, read_write> = var %3:ptr<function, u32, read_write> = access %2 %4:ptr<function, u32, read_write> = access %3 @@ -711,7 +764,14 @@ OpFunctionEnd )", R"( - %b1 = block { + tint_symbol:array<u32, 4> @offset(0) + tint_symbol_1:array<u32, 4> @offset(16) + tint_symbol_2:array<u32, 4> @offset(32) + tint_symbol_3:array<u32, 4> @offset(48) +} + +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, array<tint_symbol_4, 4>, read_write> = var %3:ptr<function, u32, read_write> = access %2, 1i, 2u, 3i %4:u32 = load %3 @@ -750,7 +810,14 @@ OpFunctionEnd )", R"( - %b1 = block { + tint_symbol:array<u32, 4> @offset(0) + tint_symbol_1:array<u32, 4> @offset(16) + tint_symbol_2:array<u32, 4> @offset(32) + tint_symbol_3:array<u32, 4> @offset(48) +} + +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, array<tint_symbol_4, 4>, read_write> = var %3:ptr<function, u32, read_write> = access %2, 1u, 2u, 3u %4:u32 = load %3 @@ -797,13 +864,13 @@ tint_symbol:u32 @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, tint_symbol_1, read> = var @binding_point(1, 2) %2:ptr<storage, tint_symbol_1, read_write> = var @binding_point(1, 3) } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %4:ptr<storage, u32, read> = access %1, 0u %5:ptr<storage, u32, read_write> = access %2, 0u %6:u32 = load %4
diff --git a/src/tint/lang/spirv/reader/parser/struct_test.cc b/src/tint/lang/spirv/reader/parser/struct_test.cc index bedb4e2..88d7349 100644 --- a/src/tint/lang/spirv/reader/parser/struct_test.cc +++ b/src/tint/lang/spirv/reader/parser/struct_test.cc
@@ -90,8 +90,8 @@ tint_symbol_1:i32 @offset(4) } -%1 = func(%2:tint_symbol_2):void -> %b1 { - %b1 = block { +%1 = func(%2:tint_symbol_2):void { + $B1: { ret } } @@ -128,8 +128,8 @@ tint_symbol_1:i32 @offset(4) } -%1 = func(%2:tint_symbol_2, %3:tint_symbol_2):tint_symbol_2 -> %b1 { - %b1 = block { +%1 = func(%2:tint_symbol_2, %3:tint_symbol_2):tint_symbol_2 { + $B1: { ret %2 } } @@ -178,8 +178,8 @@ tint_symbol_8:tint_symbol_2 @offset(24) } -%1 = func(%2:tint_symbol_9):void -> %b1 { - %b1 = block { +%1 = func(%2:tint_symbol_9):void { + $B1: { ret } } @@ -221,8 +221,8 @@ tint_symbol_3:i32 @offset(64) } -%1 = func(%2:tint_symbol_4):void -> %b1 { - %b1 = block { +%1 = func(%2:tint_symbol_4):void { + $B1: { ret } }
diff --git a/src/tint/lang/spirv/reader/parser/var_test.cc b/src/tint/lang/spirv/reader/parser/var_test.cc index f524b23..f7bbc1b 100644 --- a/src/tint/lang/spirv/reader/parser/var_test.cc +++ b/src/tint/lang/spirv/reader/parser/var_test.cc
@@ -47,8 +47,8 @@ OpFunctionEnd )", R"( -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, u32, read_write> = var ret } @@ -74,8 +74,8 @@ OpFunctionEnd )", R"( -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, u32, read_write> = var, 42u ret } @@ -100,12 +100,12 @@ OpFunctionEnd )", R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, u32, read_write> = var } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { ret } } @@ -130,12 +130,12 @@ OpFunctionEnd )", R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, u32, read_write> = var, 42u } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { ret } } @@ -170,12 +170,12 @@ tint_symbol:u32 @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, tint_symbol_1, read> = var @binding_point(1, 2) } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { ret } } @@ -209,12 +209,12 @@ tint_symbol:u32 @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, tint_symbol_1, read_write> = var @binding_point(1, 2) } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { ret } } @@ -252,13 +252,13 @@ tint_symbol:u32 @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, tint_symbol_1, read> = var @binding_point(1, 2) %2:ptr<storage, tint_symbol_1, read_write> = var @binding_point(1, 3) } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { ret } } @@ -292,12 +292,12 @@ tint_symbol:u32 @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<uniform, tint_symbol_1, read> = var @binding_point(1, 2) } -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { ret } }
diff --git a/src/tint/lang/spirv/reader/reader_test.cc b/src/tint/lang/spirv/reader/reader_test.cc index 40c07da..20a0ebb 100644 --- a/src/tint/lang/spirv/reader/reader_test.cc +++ b/src/tint/lang/spirv/reader/reader_test.cc
@@ -110,8 +110,8 @@ )"); ASSERT_EQ(got, Success); EXPECT_EQ(got, R"( -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, vec4<u32>, read_write> = var %3:u32 = load_vector_element %2, 2u ret @@ -144,8 +144,8 @@ )"); ASSERT_EQ(got, Success); EXPECT_EQ(got, R"( -%main = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%main = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %2:ptr<function, vec4<u32>, read_write> = var store_vector_element %2, 2u, 42u ret
diff --git a/src/tint/lang/spirv/writer/raise/builtin_polyfill_test.cc b/src/tint/lang/spirv/writer/raise/builtin_polyfill_test.cc index 29b11d0..1049aac 100644 --- a/src/tint/lang/spirv/writer/raise/builtin_polyfill_test.cc +++ b/src/tint/lang/spirv/writer/raise/builtin_polyfill_test.cc
@@ -71,12 +71,12 @@ arr:array<i32> @offset(8) } -%b1 = block { # root +$B1: { # root %var:ptr<storage, Buffer, read_write> = var @binding_point(0, 0) } -%foo = func():u32 -> %b2 { - %b2 = block { +%foo = func():u32 { + $B2: { %3:ptr<storage, array<i32>, read_write> = access %var, 2u %4:u32 = arrayLength %3 ret %4 @@ -92,12 +92,12 @@ arr:array<i32> @offset(8) } -%b1 = block { # root +$B1: { # root %var:ptr<storage, Buffer, read_write> = var @binding_point(0, 0) } -%foo = func():u32 -> %b2 { - %b2 = block { +%foo = func():u32 { + $B2: { %3:ptr<storage, array<i32>, read_write> = access %var, 2u %4:u32 = spirv.array_length %var, 2u ret %4 @@ -137,12 +137,12 @@ arr:array<i32> @offset(8) } -%b1 = block { # root +$B1: { # root %var:ptr<storage, Buffer, read_write> = var @binding_point(0, 0) } -%foo = func():u32 -> %b2 { - %b2 = block { +%foo = func():u32 { + $B2: { %a:ptr<storage, Buffer, read_write> = let %var %b:ptr<storage, Buffer, read_write> = let %a %5:ptr<storage, array<i32>, read_write> = access %b, 2u @@ -160,12 +160,12 @@ arr:array<i32> @offset(8) } -%b1 = block { # root +$B1: { # root %var:ptr<storage, Buffer, read_write> = var @binding_point(0, 0) } -%foo = func():u32 -> %b2 { - %b2 = block { +%foo = func():u32 { + $B2: { %a:ptr<storage, Buffer, read_write> = let %var %b:ptr<storage, Buffer, read_write> = let %a %5:ptr<storage, array<i32>, read_write> = access %b, 2u @@ -207,12 +207,12 @@ arr:array<i32> @offset(8) } -%b1 = block { # root +$B1: { # root %var:ptr<storage, Buffer, read_write> = var @binding_point(0, 0) } -%foo = func():u32 -> %b2 { - %b2 = block { +%foo = func():u32 { + $B2: { %3:ptr<storage, array<i32>, read_write> = access %var, 2u %a:ptr<storage, array<i32>, read_write> = let %3 %b:ptr<storage, array<i32>, read_write> = let %a @@ -230,12 +230,12 @@ arr:array<i32> @offset(8) } -%b1 = block { # root +$B1: { # root %var:ptr<storage, Buffer, read_write> = var @binding_point(0, 0) } -%foo = func():u32 -> %b2 { - %b2 = block { +%foo = func():u32 { + $B2: { %3:ptr<storage, array<i32>, read_write> = access %var, 2u %a:ptr<storage, array<i32>, read_write> = let %3 %b:ptr<storage, array<i32>, read_write> = let %a @@ -265,12 +265,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<storage, atomic<i32>, read_write> = var @binding_point(0, 0) } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = atomicAdd %1, %arg1 ret %4 } @@ -279,12 +279,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<storage, atomic<i32>, read_write> = var @binding_point(0, 0) } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = spirv.atomic_iadd %1, 1u, 0u, %arg1 ret %4 } @@ -309,12 +309,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = atomicAdd %1, %arg1 ret %4 } @@ -323,12 +323,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = spirv.atomic_iadd %1, 2u, 0u, %arg1 ret %4 } @@ -353,12 +353,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = atomicAnd %1, %arg1 ret %4 } @@ -367,12 +367,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = spirv.atomic_and %1, 2u, 0u, %arg1 ret %4 } @@ -405,12 +405,12 @@ exchanged:bool @offset(4) } -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%cmp:i32, %val:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%cmp:i32, %val:i32):i32 { + $B2: { %5:__atomic_compare_exchange_result_i32 = atomicCompareExchangeWeak %1, %cmp, %val %6:i32 = access %5, 0u ret %6 @@ -425,12 +425,12 @@ exchanged:bool @offset(4) } -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%cmp:i32, %val:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%cmp:i32, %val:i32):i32 { + $B2: { %5:i32 = spirv.atomic_compare_exchange %1, 2u, 0u, 0u, %val, %cmp %6:bool = eq %5, %cmp %7:__atomic_compare_exchange_result_i32 = construct %5, %6 @@ -458,12 +458,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = atomicExchange %1, %arg1 ret %4 } @@ -472,12 +472,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = spirv.atomic_exchange %1, 2u, 0u, %arg1 ret %4 } @@ -500,12 +500,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func():i32 -> %b2 { - %b2 = block { +%foo = func():i32 { + $B2: { %3:i32 = atomicLoad %1 ret %3 } @@ -514,12 +514,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func():i32 -> %b2 { - %b2 = block { +%foo = func():i32 { + $B2: { %3:i32 = spirv.atomic_load %1, 2u, 0u ret %3 } @@ -544,12 +544,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = atomicMax %1, %arg1 ret %4 } @@ -558,12 +558,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = spirv.atomic_smax %1, 2u, 0u, %arg1 ret %4 } @@ -588,12 +588,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<u32>, read_write> = var } -%foo = func(%arg1:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%arg1:u32):u32 { + $B2: { %4:u32 = atomicMax %1, %arg1 ret %4 } @@ -602,12 +602,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<u32>, read_write> = var } -%foo = func(%arg1:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%arg1:u32):u32 { + $B2: { %4:u32 = spirv.atomic_umax %1, 2u, 0u, %arg1 ret %4 } @@ -632,12 +632,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = atomicMin %1, %arg1 ret %4 } @@ -646,12 +646,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = spirv.atomic_smin %1, 2u, 0u, %arg1 ret %4 } @@ -676,12 +676,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<u32>, read_write> = var } -%foo = func(%arg1:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%arg1:u32):u32 { + $B2: { %4:u32 = atomicMin %1, %arg1 ret %4 } @@ -690,12 +690,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<u32>, read_write> = var } -%foo = func(%arg1:u32):u32 -> %b2 { - %b2 = block { +%foo = func(%arg1:u32):u32 { + $B2: { %4:u32 = spirv.atomic_umin %1, 2u, 0u, %arg1 ret %4 } @@ -720,12 +720,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = atomicOr %1, %arg1 ret %4 } @@ -734,12 +734,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = spirv.atomic_or %1, 2u, 0u, %arg1 ret %4 } @@ -764,12 +764,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):void -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):void { + $B2: { %4:void = atomicStore %1, %arg1 ret } @@ -778,12 +778,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):void -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):void { + $B2: { %4:void = spirv.atomic_store %1, 2u, 0u, %arg1 ret } @@ -808,12 +808,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = atomicSub %1, %arg1 ret %4 } @@ -822,12 +822,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = spirv.atomic_isub %1, 2u, 0u, %arg1 ret %4 } @@ -852,12 +852,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = atomicXor %1, %arg1 ret %4 } @@ -866,12 +866,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<workgroup, atomic<i32>, read_write> = var } -%foo = func(%arg1:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%arg1:i32):i32 { + $B2: { %4:i32 = spirv.atomic_xor %1, 2u, 0u, %arg1 ret %4 } @@ -895,8 +895,8 @@ }); auto* src = R"( -%foo = func(%arg1:vec4<f32>, %arg2:vec4<f32>):f32 -> %b1 { - %b1 = block { +%foo = func(%arg1:vec4<f32>, %arg2:vec4<f32>):f32 { + $B1: { %4:f32 = dot %arg1, %arg2 ret %4 } @@ -905,8 +905,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:vec4<f32>, %arg2:vec4<f32>):f32 -> %b1 { - %b1 = block { +%foo = func(%arg1:vec4<f32>, %arg2:vec4<f32>):f32 { + $B1: { %4:f32 = spirv.dot %arg1, %arg2 ret %4 } @@ -930,8 +930,8 @@ }); auto* src = R"( -%foo = func(%arg1:vec2<i32>, %arg2:vec2<i32>):i32 -> %b1 { - %b1 = block { +%foo = func(%arg1:vec2<i32>, %arg2:vec2<i32>):i32 { + $B1: { %4:i32 = dot %arg1, %arg2 ret %4 } @@ -940,8 +940,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:vec2<i32>, %arg2:vec2<i32>):i32 -> %b1 { - %b1 = block { +%foo = func(%arg1:vec2<i32>, %arg2:vec2<i32>):i32 { + $B1: { %4:i32 = access %arg1, 0u %5:i32 = access %arg2, 0u %6:i32 = mul %4, %5 @@ -971,8 +971,8 @@ }); auto* src = R"( -%foo = func(%arg1:vec4<u32>, %arg2:vec4<u32>):u32 -> %b1 { - %b1 = block { +%foo = func(%arg1:vec4<u32>, %arg2:vec4<u32>):u32 { + $B1: { %4:u32 = dot %arg1, %arg2 ret %4 } @@ -981,8 +981,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:vec4<u32>, %arg2:vec4<u32>):u32 -> %b1 { - %b1 = block { +%foo = func(%arg1:vec4<u32>, %arg2:vec4<u32>):u32 { + $B1: { %4:u32 = access %arg1, 0u %5:u32 = access %arg2, 0u %6:u32 = mul %4, %5 @@ -1020,8 +1020,8 @@ }); auto* src = R"( -%foo = func(%arg1:u32, %arg2:u32):i32 -> %b1 { - %b1 = block { +%foo = func(%arg1:u32, %arg2:u32):i32 { + $B1: { %4:i32 = dot4I8Packed %arg1, %arg2 ret %4 } @@ -1030,8 +1030,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:u32, %arg2:u32):i32 -> %b1 { - %b1 = block { +%foo = func(%arg1:u32, %arg2:u32):i32 { + $B1: { %4:i32 = spirv.sdot %arg1, %arg2, 0u ret %4 } @@ -1055,8 +1055,8 @@ }); auto* src = R"( -%foo = func(%arg1:u32, %arg2:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg1:u32, %arg2:u32):u32 { + $B1: { %4:u32 = dot4U8Packed %arg1, %arg2 ret %4 } @@ -1065,8 +1065,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:u32, %arg2:u32):u32 -> %b1 { - %b1 = block { +%foo = func(%arg1:u32, %arg2:u32):u32 { + $B1: { %4:u32 = spirv.udot %arg1, %arg2, 0u ret %4 } @@ -1091,8 +1091,8 @@ }); auto* src = R"( -%foo = func(%argf:i32, %argt:i32, %cond:bool):i32 -> %b1 { - %b1 = block { +%foo = func(%argf:i32, %argt:i32, %cond:bool):i32 { + $B1: { %5:i32 = select %argf, %argt, %cond ret %5 } @@ -1101,8 +1101,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%argf:i32, %argt:i32, %cond:bool):i32 -> %b1 { - %b1 = block { +%foo = func(%argf:i32, %argt:i32, %cond:bool):i32 { + $B1: { %5:i32 = spirv.select %cond, %argt, %argf ret %5 } @@ -1127,8 +1127,8 @@ }); auto* src = R"( -%foo = func(%argf:vec4<i32>, %argt:vec4<i32>, %cond:vec4<bool>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%argf:vec4<i32>, %argt:vec4<i32>, %cond:vec4<bool>):vec4<i32> { + $B1: { %5:vec4<i32> = select %argf, %argt, %cond ret %5 } @@ -1137,8 +1137,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%argf:vec4<i32>, %argt:vec4<i32>, %cond:vec4<bool>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%argf:vec4<i32>, %argt:vec4<i32>, %cond:vec4<bool>):vec4<i32> { + $B1: { %5:vec4<i32> = spirv.select %cond, %argt, %argf ret %5 } @@ -1163,8 +1163,8 @@ }); auto* src = R"( -%foo = func(%argf:vec4<i32>, %argt:vec4<i32>, %cond:bool):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%argf:vec4<i32>, %argt:vec4<i32>, %cond:bool):vec4<i32> { + $B1: { %5:vec4<i32> = select %argf, %argt, %cond ret %5 } @@ -1173,8 +1173,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%argf:vec4<i32>, %argt:vec4<i32>, %cond:bool):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%argf:vec4<i32>, %argt:vec4<i32>, %cond:bool):vec4<i32> { + $B1: { %5:vec4<bool> = construct %cond, %cond, %cond, %cond %6:vec4<i32> = spirv.select %5, %argt, %argf ret %6 @@ -1201,8 +1201,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>, %coords:vec2<i32>, %lod:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %coords:vec2<i32>, %lod:i32):vec4<f32> { + $B1: { %5:vec4<f32> = textureLoad %t, %coords, %lod ret %5 } @@ -1211,8 +1211,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>, %coords:vec2<i32>, %lod:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %coords:vec2<i32>, %lod:i32):vec4<f32> { + $B1: { %5:vec4<f32> = spirv.image_fetch %t, %coords, 2u, %lod ret %5 } @@ -1240,8 +1240,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d_array<f32>, %coords:vec2<i32>, %array_idx:i32, %lod:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %coords:vec2<i32>, %array_idx:i32, %lod:i32):vec4<f32> { + $B1: { %6:vec4<f32> = textureLoad %t, %coords, %array_idx, %lod ret %6 } @@ -1250,8 +1250,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d_array<f32>, %coords:vec2<i32>, %array_idx:i32, %lod:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %coords:vec2<i32>, %array_idx:i32, %lod:i32):vec4<f32> { + $B1: { %6:vec3<i32> = construct %coords, %array_idx %7:vec4<f32> = spirv.image_fetch %t, %6, 2u, %lod ret %7 @@ -1280,8 +1280,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d_array<f32>, %coords:vec2<i32>, %array_idx:u32, %lod:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %coords:vec2<i32>, %array_idx:u32, %lod:i32):vec4<f32> { + $B1: { %6:vec4<f32> = textureLoad %t, %coords, %array_idx, %lod ret %6 } @@ -1290,8 +1290,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d_array<f32>, %coords:vec2<i32>, %array_idx:u32, %lod:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %coords:vec2<i32>, %array_idx:u32, %lod:i32):vec4<f32> { + $B1: { %6:i32 = convert %array_idx %7:vec3<i32> = construct %coords, %6 %8:vec4<f32> = spirv.image_fetch %t, %7, 2u, %lod @@ -1319,8 +1319,8 @@ }); auto* src = R"( -%foo = func(%t:texture_multisampled_2d<f32>, %coords:vec2<i32>, %sample_idx:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_multisampled_2d<f32>, %coords:vec2<i32>, %sample_idx:i32):vec4<f32> { + $B1: { %5:vec4<f32> = textureLoad %t, %coords, %sample_idx ret %5 } @@ -1329,8 +1329,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_multisampled_2d<f32>, %coords:vec2<i32>, %sample_idx:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_multisampled_2d<f32>, %coords:vec2<i32>, %sample_idx:i32):vec4<f32> { + $B1: { %5:vec4<f32> = spirv.image_fetch %t, %coords, 64u, %sample_idx ret %5 } @@ -1356,8 +1356,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d, %coords:vec2<i32>, %lod:i32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %coords:vec2<i32>, %lod:i32):f32 { + $B1: { %5:f32 = textureLoad %t, %coords, %lod ret %5 } @@ -1366,8 +1366,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d, %coords:vec2<i32>, %lod:i32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %coords:vec2<i32>, %lod:i32):f32 { + $B1: { %5:vec4<f32> = spirv.image_fetch %t, %coords, 2u, %lod %6:f32 = access %5, 0u ret %6 @@ -1394,8 +1394,8 @@ }); auto* src = R"( -%foo = func(%t:texture_1d<f32>, %s:sampler, %coords:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_1d<f32>, %s:sampler, %coords:f32):vec4<f32> { + $B1: { %5:vec4<f32> = textureSample %t, %s, %coords ret %5 } @@ -1404,8 +1404,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_1d<f32>, %s:sampler, %coords:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_1d<f32>, %s:sampler, %coords:f32):vec4<f32> { + $B1: { %5:spirv.sampled_image<texture_1d<f32>> = spirv.sampled_image %t, %s %6:vec4<f32> = spirv.image_sample_implicit_lod %5, %coords, 0u ret %6 @@ -1432,8 +1432,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> { + $B1: { %5:vec4<f32> = textureSample %t, %s, %coords ret %5 } @@ -1442,8 +1442,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> { + $B1: { %5:spirv.sampled_image<texture_2d<f32>> = spirv.sampled_image %t, %s %6:vec4<f32> = spirv.image_sample_implicit_lod %5, %coords, 0u ret %6 @@ -1471,8 +1471,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> { + $B1: { %5:vec4<f32> = textureSample %t, %s, %coords, vec2<i32>(1i) ret %5 } @@ -1481,8 +1481,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> { + $B1: { %5:spirv.sampled_image<texture_2d<f32>> = spirv.sampled_image %t, %s %6:vec4<f32> = spirv.image_sample_implicit_lod %5, %coords, 8u, vec2<i32>(1i) ret %6 @@ -1511,8 +1511,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32):vec4<f32> { + $B1: { %6:vec4<f32> = textureSample %t, %s, %coords, %array_idx, vec2<i32>(1i) ret %6 } @@ -1521,8 +1521,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32):vec4<f32> { + $B1: { %6:spirv.sampled_image<texture_2d_array<f32>> = spirv.sampled_image %t, %s %7:f32 = convert %array_idx %8:vec3<f32> = construct %coords, %7 @@ -1553,8 +1553,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %bias:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %bias:f32):vec4<f32> { + $B1: { %6:vec4<f32> = textureSampleBias %t, %s, %coords, %bias ret %6 } @@ -1563,8 +1563,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %bias:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %bias:f32):vec4<f32> { + $B1: { %6:spirv.sampled_image<texture_2d<f32>> = spirv.sampled_image %t, %s %7:vec4<f32> = spirv.image_sample_implicit_lod %6, %coords, 1u, %bias ret %7 @@ -1593,8 +1593,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %bias:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %bias:f32):vec4<f32> { + $B1: { %6:vec4<f32> = textureSampleBias %t, %s, %coords, %bias, vec2<i32>(1i) ret %6 } @@ -1603,8 +1603,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %bias:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %bias:f32):vec4<f32> { + $B1: { %6:spirv.sampled_image<texture_2d<f32>> = spirv.sampled_image %t, %s %7:vec4<f32> = spirv.image_sample_implicit_lod %6, %coords, 9u, %bias, vec2<i32>(1i) ret %7 @@ -1634,8 +1634,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %bias:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %bias:f32):vec4<f32> { + $B1: { %7:vec4<f32> = textureSampleBias %t, %s, %coords, %array_idx, %bias, vec2<i32>(1i) ret %7 } @@ -1644,8 +1644,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %bias:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %bias:f32):vec4<f32> { + $B1: { %7:spirv.sampled_image<texture_2d_array<f32>> = spirv.sampled_image %t, %s %8:f32 = convert %array_idx %9:vec3<f32> = construct %coords, %8 @@ -1675,8 +1675,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 { + $B1: { %6:f32 = textureSampleCompare %t, %s, %coords, %dref ret %6 } @@ -1685,8 +1685,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 { + $B1: { %6:spirv.sampled_image<texture_depth_2d> = spirv.sampled_image %t, %s %7:f32 = spirv.image_sample_dref_implicit_lod %6, %coords, %dref, 0u ret %7 @@ -1715,8 +1715,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 { + $B1: { %6:f32 = textureSampleCompare %t, %s, %coords, %dref, vec2<i32>(1i) ret %6 } @@ -1725,8 +1725,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 { + $B1: { %6:spirv.sampled_image<texture_depth_2d> = spirv.sampled_image %t, %s %7:f32 = spirv.image_sample_dref_implicit_lod %6, %coords, %dref, 8u, vec2<i32>(1i) ret %7 @@ -1756,8 +1756,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:i32, %bias:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:i32, %bias:f32):f32 { + $B1: { %7:f32 = textureSampleCompare %t, %s, %coords, %array_idx, %bias, vec2<i32>(1i) ret %7 } @@ -1766,8 +1766,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:i32, %bias:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:i32, %bias:f32):f32 { + $B1: { %7:spirv.sampled_image<texture_depth_2d_array> = spirv.sampled_image %t, %s %8:f32 = convert %array_idx %9:vec3<f32> = construct %coords, %8 @@ -1798,8 +1798,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 { + $B1: { %6:f32 = textureSampleCompareLevel %t, %s, %coords, %dref ret %6 } @@ -1808,8 +1808,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 { + $B1: { %6:spirv.sampled_image<texture_depth_2d> = spirv.sampled_image %t, %s %7:f32 = spirv.image_sample_dref_explicit_lod %6, %coords, %dref, 2u, 0.0f ret %7 @@ -1838,8 +1838,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 { + $B1: { %6:f32 = textureSampleCompareLevel %t, %s, %coords, %dref, vec2<i32>(1i) ret %6 } @@ -1848,8 +1848,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %dref:f32):f32 { + $B1: { %6:spirv.sampled_image<texture_depth_2d> = spirv.sampled_image %t, %s %7:f32 = spirv.image_sample_dref_explicit_lod %6, %coords, %dref, 10u, 0.0f, vec2<i32>(1i) ret %7 @@ -1879,8 +1879,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:i32, %bias:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:i32, %bias:f32):f32 { + $B1: { %7:f32 = textureSampleCompareLevel %t, %s, %coords, %array_idx, %bias, vec2<i32>(1i) ret %7 } @@ -1889,8 +1889,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:i32, %bias:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:i32, %bias:f32):f32 { + $B1: { %7:spirv.sampled_image<texture_depth_2d_array> = spirv.sampled_image %t, %s %8:f32 = convert %array_idx %9:vec3<f32> = construct %coords, %8 @@ -1922,8 +1922,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> { + $B1: { %7:vec4<f32> = textureSampleGrad %t, %s, %coords, %ddx, %ddy ret %7 } @@ -1932,8 +1932,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> { + $B1: { %7:spirv.sampled_image<texture_2d<f32>> = spirv.sampled_image %t, %s %8:vec4<f32> = spirv.image_sample_explicit_lod %7, %coords, 4u, %ddx, %ddy ret %8 @@ -1963,8 +1963,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> { + $B1: { %7:vec4<f32> = textureSampleGrad %t, %s, %coords, %ddx, %ddy, vec2<i32>(1i) ret %7 } @@ -1973,8 +1973,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> { + $B1: { %7:spirv.sampled_image<texture_2d<f32>> = spirv.sampled_image %t, %s %8:vec4<f32> = spirv.image_sample_explicit_lod %7, %coords, 12u, %ddx, %ddy, vec2<i32>(1i) ret %8 @@ -2005,8 +2005,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> { + $B1: { %8:vec4<f32> = textureSampleGrad %t, %s, %coords, %array_idx, %ddx, %ddy, vec2<i32>(1i) ret %8 } @@ -2015,8 +2015,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %ddx:vec2<f32>, %ddy:vec2<f32>):vec4<f32> { + $B1: { %8:spirv.sampled_image<texture_2d_array<f32>> = spirv.sampled_image %t, %s %9:f32 = convert %array_idx %10:vec3<f32> = construct %coords, %9 @@ -2047,8 +2047,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %lod:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %lod:f32):vec4<f32> { + $B1: { %6:vec4<f32> = textureSampleLevel %t, %s, %coords, %lod ret %6 } @@ -2057,8 +2057,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %lod:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %lod:f32):vec4<f32> { + $B1: { %6:spirv.sampled_image<texture_2d<f32>> = spirv.sampled_image %t, %s %7:vec4<f32> = spirv.image_sample_explicit_lod %6, %coords, 2u, %lod ret %7 @@ -2087,8 +2087,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %lod:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %lod:f32):vec4<f32> { + $B1: { %6:vec4<f32> = textureSampleLevel %t, %s, %coords, %lod, vec2<i32>(1i) ret %6 } @@ -2097,8 +2097,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %lod:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>, %lod:f32):vec4<f32> { + $B1: { %6:spirv.sampled_image<texture_2d<f32>> = spirv.sampled_image %t, %s %7:vec4<f32> = spirv.image_sample_explicit_lod %6, %coords, 10u, %lod, vec2<i32>(1i) ret %7 @@ -2128,8 +2128,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %lod:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %lod:f32):vec4<f32> { + $B1: { %7:vec4<f32> = textureSampleLevel %t, %s, %coords, %array_idx, %lod, vec2<i32>(1i) ret %7 } @@ -2138,8 +2138,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %lod:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %s:sampler, %coords:vec2<f32>, %array_idx:i32, %lod:f32):vec4<f32> { + $B1: { %7:spirv.sampled_image<texture_2d_array<f32>> = spirv.sampled_image %t, %s %8:f32 = convert %array_idx %9:vec3<f32> = construct %coords, %8 @@ -2170,8 +2170,8 @@ }); auto* src = R"( -%foo = func(%component:i32, %t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%component:i32, %t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> { + $B1: { %6:vec4<f32> = textureGather %component, %t, %s, %coords ret %6 } @@ -2180,8 +2180,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%component:i32, %t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%component:i32, %t:texture_2d<f32>, %s:sampler, %coords:vec2<f32>):vec4<f32> { + $B1: { %6:spirv.sampled_image<texture_2d<f32>> = spirv.sampled_image %t, %s %7:vec4<f32> = spirv.image_gather %6, %coords, %component, 0u ret %7 @@ -2210,8 +2210,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %component:i32, %coords:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %component:i32, %coords:vec2<f32>):vec4<f32> { + $B1: { %6:vec4<f32> = textureGather %component, %t, %s, %coords, vec2<i32>(1i) ret %6 } @@ -2220,8 +2220,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>, %s:sampler, %component:i32, %coords:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %s:sampler, %component:i32, %coords:vec2<f32>):vec4<f32> { + $B1: { %6:spirv.sampled_image<texture_2d<f32>> = spirv.sampled_image %t, %s %7:vec4<f32> = spirv.image_gather %6, %coords, %component, 8u, vec2<i32>(1i) ret %7 @@ -2251,8 +2251,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d_array<f32>, %s:sampler, %component:i32, %coords:vec2<f32>, %array_idx:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %s:sampler, %component:i32, %coords:vec2<f32>, %array_idx:i32):vec4<f32> { + $B1: { %7:vec4<f32> = textureGather %component, %t, %s, %coords, %array_idx, vec2<i32>(1i) ret %7 } @@ -2261,8 +2261,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d_array<f32>, %s:sampler, %component:i32, %coords:vec2<f32>, %array_idx:i32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>, %s:sampler, %component:i32, %coords:vec2<f32>, %array_idx:i32):vec4<f32> { + $B1: { %7:spirv.sampled_image<texture_2d_array<f32>> = spirv.sampled_image %t, %s %8:f32 = convert %array_idx %9:vec3<f32> = construct %coords, %8 @@ -2291,8 +2291,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d, %s:sampler, %coords:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler, %coords:vec2<f32>):vec4<f32> { + $B1: { %5:vec4<f32> = textureGather %t, %s, %coords ret %5 } @@ -2301,8 +2301,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d, %s:sampler, %coords:vec2<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler, %coords:vec2<f32>):vec4<f32> { + $B1: { %5:spirv.sampled_image<texture_depth_2d> = spirv.sampled_image %t, %s %6:vec4<f32> = spirv.image_gather %5, %coords, 0u, 0u ret %6 @@ -2331,8 +2331,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %depth:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %depth:f32):vec4<f32> { + $B1: { %6:vec4<f32> = textureGatherCompare %t, %s, %coords, %depth ret %6 } @@ -2341,8 +2341,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %depth:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %depth:f32):vec4<f32> { + $B1: { %6:spirv.sampled_image<texture_depth_2d> = spirv.sampled_image %t, %s %7:vec4<f32> = spirv.image_dref_gather %6, %coords, %depth, 0u ret %7 @@ -2371,8 +2371,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %depth:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %depth:f32):vec4<f32> { + $B1: { %6:vec4<f32> = textureGatherCompare %t, %s, %coords, %depth, vec2<i32>(1i) ret %6 } @@ -2381,8 +2381,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %depth:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d, %s:sampler_comparison, %coords:vec2<f32>, %depth:f32):vec4<f32> { + $B1: { %6:spirv.sampled_image<texture_depth_2d> = spirv.sampled_image %t, %s %7:vec4<f32> = spirv.image_dref_gather %6, %coords, %depth, 8u, vec2<i32>(1i) ret %7 @@ -2412,8 +2412,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:u32, %depth:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:u32, %depth:f32):vec4<f32> { + $B1: { %7:vec4<f32> = textureGatherCompare %t, %s, %coords, %array_idx, %depth ret %7 } @@ -2422,8 +2422,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:u32, %depth:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d_array, %s:sampler_comparison, %coords:vec2<f32>, %array_idx:u32, %depth:f32):vec4<f32> { + $B1: { %7:spirv.sampled_image<texture_depth_2d_array> = spirv.sampled_image %t, %s %8:f32 = convert %array_idx %9:vec3<f32> = construct %coords, %8 @@ -2455,8 +2455,8 @@ }); auto* src = R"( -%foo = func(%t:texture_storage_2d<r32uint, write>, %coords:vec2<i32>, %texel:vec4<u32>):void -> %b1 { - %b1 = block { +%foo = func(%t:texture_storage_2d<r32uint, write>, %coords:vec2<i32>, %texel:vec4<u32>):void { + $B1: { %5:void = textureStore %t, %coords, %texel ret } @@ -2465,8 +2465,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_storage_2d<r32uint, write>, %coords:vec2<i32>, %texel:vec4<u32>):void -> %b1 { - %b1 = block { +%foo = func(%t:texture_storage_2d<r32uint, write>, %coords:vec2<i32>, %texel:vec4<u32>):void { + $B1: { %5:void = spirv.image_write %t, %coords, %texel, 0u ret } @@ -2496,8 +2496,8 @@ }); auto* src = R"( -%foo = func(%t:texture_storage_2d_array<rgba8sint, write>, %coords:vec2<i32>, %array_idx:i32, %texel:vec4<i32>):void -> %b1 { - %b1 = block { +%foo = func(%t:texture_storage_2d_array<rgba8sint, write>, %coords:vec2<i32>, %array_idx:i32, %texel:vec4<i32>):void { + $B1: { %6:void = textureStore %t, %coords, %array_idx, %texel ret } @@ -2506,8 +2506,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_storage_2d_array<rgba8sint, write>, %coords:vec2<i32>, %array_idx:i32, %texel:vec4<i32>):void -> %b1 { - %b1 = block { +%foo = func(%t:texture_storage_2d_array<rgba8sint, write>, %coords:vec2<i32>, %array_idx:i32, %texel:vec4<i32>):void { + $B1: { %6:vec3<i32> = construct %coords, %array_idx %7:void = spirv.image_write %t, %6, %texel, 0u ret @@ -2538,8 +2538,8 @@ }); auto* src = R"( -%foo = func(%t:texture_storage_2d_array<rgba32uint, write>, %coords:vec2<i32>, %array_idx:u32, %texel:vec4<u32>):void -> %b1 { - %b1 = block { +%foo = func(%t:texture_storage_2d_array<rgba32uint, write>, %coords:vec2<i32>, %array_idx:u32, %texel:vec4<u32>):void { + $B1: { %6:void = textureStore %t, %coords, %array_idx, %texel ret } @@ -2548,8 +2548,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_storage_2d_array<rgba32uint, write>, %coords:vec2<i32>, %array_idx:u32, %texel:vec4<u32>):void -> %b1 { - %b1 = block { +%foo = func(%t:texture_storage_2d_array<rgba32uint, write>, %coords:vec2<i32>, %array_idx:u32, %texel:vec4<u32>):void { + $B1: { %6:i32 = convert %array_idx %7:vec3<i32> = construct %coords, %6 %8:void = spirv.image_write %t, %7, %texel, 0u @@ -2575,8 +2575,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>):vec2<u32> { + $B1: { %3:vec2<u32> = textureDimensions %t ret %3 } @@ -2585,8 +2585,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>):vec2<u32> { + $B1: { %3:vec2<u32> = spirv.image_query_size_lod %t, 0u ret %3 } @@ -2611,8 +2611,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d<f32>, %lod:i32):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %lod:i32):vec2<u32> { + $B1: { %4:vec2<u32> = textureDimensions %t, %lod ret %4 } @@ -2621,8 +2621,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d<f32>, %lod:i32):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d<f32>, %lod:i32):vec2<u32> { + $B1: { %4:vec2<u32> = spirv.image_query_size_lod %t, %lod ret %4 } @@ -2646,8 +2646,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d_array<f32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>):vec2<u32> { + $B1: { %3:vec2<u32> = textureDimensions %t ret %3 } @@ -2656,8 +2656,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d_array<f32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>):vec2<u32> { + $B1: { %3:vec3<u32> = spirv.image_query_size_lod %t, 0u %4:vec2<u32> = swizzle %3, xy ret %4 @@ -2682,8 +2682,8 @@ }); auto* src = R"( -%foo = func(%t:texture_multisampled_2d<f32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_multisampled_2d<f32>):vec2<u32> { + $B1: { %3:vec2<u32> = textureDimensions %t ret %3 } @@ -2692,8 +2692,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_multisampled_2d<f32>):vec2<u32> -> %b1 { - %b1 = block { +%foo = func(%t:texture_multisampled_2d<f32>):vec2<u32> { + $B1: { %3:vec2<u32> = spirv.image_query_size %t ret %3 } @@ -2717,8 +2717,8 @@ }); auto* src = R"( -%foo = func(%t:texture_2d_array<f32>):u32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>):u32 { + $B1: { %3:u32 = textureNumLayers %t ret %3 } @@ -2727,8 +2727,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_2d_array<f32>):u32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_2d_array<f32>):u32 { + $B1: { %3:vec3<u32> = spirv.image_query_size_lod %t, 0u %4:u32 = access %3, 2u ret %4 @@ -2753,8 +2753,8 @@ }); auto* src = R"( -%foo = func(%t:texture_cube_array<f32>):u32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_cube_array<f32>):u32 { + $B1: { %3:u32 = textureNumLayers %t ret %3 } @@ -2763,8 +2763,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_cube_array<f32>):u32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_cube_array<f32>):u32 { + $B1: { %3:vec3<u32> = spirv.image_query_size_lod %t, 0u %4:u32 = access %3, 2u ret %4 @@ -2789,8 +2789,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_2d_array):u32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d_array):u32 { + $B1: { %3:u32 = textureNumLayers %t ret %3 } @@ -2799,8 +2799,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_2d_array):u32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_2d_array):u32 { + $B1: { %3:vec3<u32> = spirv.image_query_size_lod %t, 0u %4:u32 = access %3, 2u ret %4 @@ -2825,8 +2825,8 @@ }); auto* src = R"( -%foo = func(%t:texture_depth_cube_array):u32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_cube_array):u32 { + $B1: { %3:u32 = textureNumLayers %t ret %3 } @@ -2835,8 +2835,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_depth_cube_array):u32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_depth_cube_array):u32 { + $B1: { %3:vec3<u32> = spirv.image_query_size_lod %t, 0u %4:u32 = access %3, 2u ret %4 @@ -2864,8 +2864,8 @@ }); auto* src = R"( -%foo = func(%t:texture_storage_2d_array<r32float, write>):u32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_storage_2d_array<r32float, write>):u32 { + $B1: { %3:u32 = textureNumLayers %t ret %3 } @@ -2874,8 +2874,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%t:texture_storage_2d_array<r32float, write>):u32 -> %b1 { - %b1 = block { +%foo = func(%t:texture_storage_2d_array<r32float, write>):u32 { + $B1: { %3:vec3<u32> = spirv.image_query_size %t %4:u32 = access %3, 2u ret %4 @@ -2899,8 +2899,8 @@ }); auto* src = R"( -%foo = func(%arg:f32):f32 -> %b1 { - %b1 = block { +%foo = func(%arg:f32):f32 { + $B1: { %3:f32 = quantizeToF16 %arg ret %3 } @@ -2926,8 +2926,8 @@ }); auto* src = R"( -%foo = func(%arg:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<f32>):vec4<f32> { + $B1: { %3:vec4<f32> = quantizeToF16 %arg ret %3 } @@ -2936,8 +2936,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%arg:vec4<f32>):vec4<f32> { + $B1: { %3:f32 = access %arg, 0u %4:f32 = quantizeToF16 %3 %5:f32 = access %arg, 1u
diff --git a/src/tint/lang/spirv/writer/raise/expand_implicit_splats_test.cc b/src/tint/lang/spirv/writer/raise/expand_implicit_splats_test.cc index ef4afaa..3e9bb3d 100644 --- a/src/tint/lang/spirv/writer/raise/expand_implicit_splats_test.cc +++ b/src/tint/lang/spirv/writer/raise/expand_implicit_splats_test.cc
@@ -50,8 +50,8 @@ }); auto* expect = R"( -%foo = func(%vector:vec2<i32>):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%vector:vec2<i32>):vec2<i32> { + $B1: { %3:vec2<i32> = construct %vector ret %3 } @@ -75,8 +75,8 @@ }); auto* expect = R"( -%foo = func(%scalar:i32, %vector:vec2<i32>):vec3<i32> -> %b1 { - %b1 = block { +%foo = func(%scalar:i32, %vector:vec2<i32>):vec3<i32> { + $B1: { %4:vec3<i32> = construct %scalar, %vector ret %4 } @@ -99,8 +99,8 @@ }); auto* expect = R"( -%foo = func(%scalar:i32):vec3<i32> -> %b1 { - %b1 = block { +%foo = func(%scalar:i32):vec3<i32> { + $B1: { %3:vec3<i32> = construct %scalar, %scalar, %scalar ret %3 } @@ -123,8 +123,8 @@ }); auto* src = R"( -%foo = func(%scalar:i32):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%scalar:i32):vec2<i32> { + $B1: { %3:vec2<i32> = construct %scalar ret %3 } @@ -133,8 +133,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:i32):vec2<i32> -> %b1 { - %b1 = block { +%foo = func(%scalar:i32):vec2<i32> { + $B1: { %3:vec2<i32> = construct %scalar, %scalar ret %3 } @@ -157,8 +157,8 @@ }); auto* src = R"( -%foo = func(%scalar:u32):vec3<u32> -> %b1 { - %b1 = block { +%foo = func(%scalar:u32):vec3<u32> { + $B1: { %3:vec3<u32> = construct %scalar ret %3 } @@ -167,8 +167,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:u32):vec3<u32> -> %b1 { - %b1 = block { +%foo = func(%scalar:u32):vec3<u32> { + $B1: { %3:vec3<u32> = construct %scalar, %scalar, %scalar ret %3 } @@ -191,8 +191,8 @@ }); auto* src = R"( -%foo = func(%scalar:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32):vec4<f32> { + $B1: { %3:vec4<f32> = construct %scalar ret %3 } @@ -201,8 +201,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32):vec4<f32> { + $B1: { %3:vec4<f32> = construct %scalar, %scalar, %scalar, %scalar ret %3 } @@ -226,8 +226,8 @@ }); auto* src = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = add %vector, %scalar ret %4 } @@ -236,8 +236,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = construct %scalar, %scalar, %scalar, %scalar %5:vec4<f32> = add %vector, %4 ret %5 @@ -262,8 +262,8 @@ }); auto* src = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = add %scalar, %vector ret %4 } @@ -272,8 +272,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = construct %scalar, %scalar, %scalar, %scalar %5:vec4<f32> = add %4, %vector ret %5 @@ -298,8 +298,8 @@ }); auto* src = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = sub %vector, %scalar ret %4 } @@ -308,8 +308,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = construct %scalar, %scalar, %scalar, %scalar %5:vec4<f32> = sub %vector, %4 ret %5 @@ -334,8 +334,8 @@ }); auto* src = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = sub %scalar, %vector ret %4 } @@ -344,8 +344,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = construct %scalar, %scalar, %scalar, %scalar %5:vec4<f32> = sub %4, %vector ret %5 @@ -370,8 +370,8 @@ }); auto* src = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = div %vector, %scalar ret %4 } @@ -380,8 +380,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = construct %scalar, %scalar, %scalar, %scalar %5:vec4<f32> = div %vector, %4 ret %5 @@ -406,8 +406,8 @@ }); auto* src = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = div %scalar, %vector ret %4 } @@ -416,8 +416,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = construct %scalar, %scalar, %scalar, %scalar %5:vec4<f32> = div %4, %vector ret %5 @@ -442,8 +442,8 @@ }); auto* src = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = mod %vector, %scalar ret %4 } @@ -452,8 +452,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = construct %scalar, %scalar, %scalar, %scalar %5:vec4<f32> = mod %vector, %4 ret %5 @@ -478,8 +478,8 @@ }); auto* src = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = mod %scalar, %vector ret %4 } @@ -488,8 +488,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = construct %scalar, %scalar, %scalar, %scalar %5:vec4<f32> = mod %4, %vector ret %5 @@ -514,8 +514,8 @@ }); auto* src = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = mul %vector, %scalar ret %4 } @@ -524,8 +524,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = spirv.vector_times_scalar %vector, %scalar ret %4 } @@ -549,8 +549,8 @@ }); auto* src = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = mul %scalar, %vector ret %4 } @@ -559,8 +559,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%scalar:f32, %vector:vec4<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = spirv.vector_times_scalar %vector, %scalar ret %4 } @@ -584,8 +584,8 @@ }); auto* src = R"( -%foo = func(%scalar:i32, %vector:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%scalar:i32, %vector:vec4<i32>):vec4<i32> { + $B1: { %4:vec4<i32> = mul %vector, %scalar ret %4 } @@ -594,8 +594,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:i32, %vector:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%scalar:i32, %vector:vec4<i32>):vec4<i32> { + $B1: { %4:vec4<i32> = construct %scalar, %scalar, %scalar, %scalar %5:vec4<i32> = mul %vector, %4 ret %5 @@ -620,8 +620,8 @@ }); auto* src = R"( -%foo = func(%scalar:i32, %vector:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%scalar:i32, %vector:vec4<i32>):vec4<i32> { + $B1: { %4:vec4<i32> = mul %scalar, %vector ret %4 } @@ -630,8 +630,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%scalar:i32, %vector:vec4<i32>):vec4<i32> -> %b1 { - %b1 = block { +%foo = func(%scalar:i32, %vector:vec4<i32>):vec4<i32> { + $B1: { %4:vec4<i32> = construct %scalar, %scalar, %scalar, %scalar %5:vec4<i32> = mul %4, %vector ret %5 @@ -657,8 +657,8 @@ }); auto* src = R"( -%foo = func(%arg1:vec4<f32>, %arg2:vec4<f32>, %factor:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:vec4<f32>, %arg2:vec4<f32>, %factor:f32):vec4<f32> { + $B1: { %5:vec4<f32> = mix %arg1, %arg2, %factor ret %5 } @@ -667,8 +667,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:vec4<f32>, %arg2:vec4<f32>, %factor:f32):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:vec4<f32>, %arg2:vec4<f32>, %factor:f32):vec4<f32> { + $B1: { %5:vec4<f32> = construct %factor, %factor, %factor, %factor %6:vec4<f32> = mix %arg1, %arg2, %5 ret %6
diff --git a/src/tint/lang/spirv/writer/raise/handle_matrix_arithmetic_test.cc b/src/tint/lang/spirv/writer/raise/handle_matrix_arithmetic_test.cc index 89a025d..835a4e1 100644 --- a/src/tint/lang/spirv/writer/raise/handle_matrix_arithmetic_test.cc +++ b/src/tint/lang/spirv/writer/raise/handle_matrix_arithmetic_test.cc
@@ -52,8 +52,8 @@ }); auto* src = R"( -%foo = func(%arg1:mat2x3<f32>, %arg2:mat2x3<f32>):mat2x3<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat2x3<f32>, %arg2:mat2x3<f32>):mat2x3<f32> { + $B1: { %4:mat2x3<f32> = add %arg1, %arg2 ret %4 } @@ -62,8 +62,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:mat2x3<f32>, %arg2:mat2x3<f32>):mat2x3<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat2x3<f32>, %arg2:mat2x3<f32>):mat2x3<f32> { + $B1: { %4:vec3<f32> = access %arg1, 0u %5:vec3<f32> = access %arg2, 0u %6:vec3<f32> = add %4, %5 @@ -93,8 +93,8 @@ }); auto* src = R"( -%foo = func(%arg1:mat4x2<f16>, %arg2:mat4x2<f16>):mat4x2<f16> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat4x2<f16>, %arg2:mat4x2<f16>):mat4x2<f16> { + $B1: { %4:mat4x2<f16> = add %arg1, %arg2 ret %4 } @@ -103,8 +103,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:mat4x2<f16>, %arg2:mat4x2<f16>):mat4x2<f16> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat4x2<f16>, %arg2:mat4x2<f16>):mat4x2<f16> { + $B1: { %4:vec2<f16> = access %arg1, 0u %5:vec2<f16> = access %arg2, 0u %6:vec2<f16> = add %4, %5 @@ -140,8 +140,8 @@ }); auto* src = R"( -%foo = func(%arg1:mat3x2<f32>, %arg2:mat3x2<f32>):mat3x2<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat3x2<f32>, %arg2:mat3x2<f32>):mat3x2<f32> { + $B1: { %4:mat3x2<f32> = sub %arg1, %arg2 ret %4 } @@ -150,8 +150,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:mat3x2<f32>, %arg2:mat3x2<f32>):mat3x2<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat3x2<f32>, %arg2:mat3x2<f32>):mat3x2<f32> { + $B1: { %4:vec2<f32> = access %arg1, 0u %5:vec2<f32> = access %arg2, 0u %6:vec2<f32> = sub %4, %5 @@ -184,8 +184,8 @@ }); auto* src = R"( -%foo = func(%arg1:mat2x4<f16>, %arg2:mat2x4<f16>):mat2x4<f16> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat2x4<f16>, %arg2:mat2x4<f16>):mat2x4<f16> { + $B1: { %4:mat2x4<f16> = sub %arg1, %arg2 ret %4 } @@ -194,8 +194,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:mat2x4<f16>, %arg2:mat2x4<f16>):mat2x4<f16> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat2x4<f16>, %arg2:mat2x4<f16>):mat2x4<f16> { + $B1: { %4:vec4<f16> = access %arg1, 0u %5:vec4<f16> = access %arg2, 0u %6:vec4<f16> = sub %4, %5 @@ -225,8 +225,8 @@ }); auto* src = R"( -%foo = func(%arg1:mat2x3<f32>, %arg2:f32):mat2x3<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat2x3<f32>, %arg2:f32):mat2x3<f32> { + $B1: { %4:mat2x3<f32> = mul %arg1, %arg2 ret %4 } @@ -235,8 +235,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:mat2x3<f32>, %arg2:f32):mat2x3<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat2x3<f32>, %arg2:f32):mat2x3<f32> { + $B1: { %4:mat2x3<f32> = spirv.matrix_times_scalar %arg1, %arg2 ret %4 } @@ -260,8 +260,8 @@ }); auto* src = R"( -%foo = func(%arg1:mat3x4<f32>, %arg2:vec3<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat3x4<f32>, %arg2:vec3<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = mul %arg1, %arg2 ret %4 } @@ -270,8 +270,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:mat3x4<f32>, %arg2:vec3<f32>):vec4<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat3x4<f32>, %arg2:vec3<f32>):vec4<f32> { + $B1: { %4:vec4<f32> = spirv.matrix_times_vector %arg1, %arg2 ret %4 } @@ -295,8 +295,8 @@ }); auto* src = R"( -%foo = func(%arg1:mat4x2<f32>, %arg2:mat2x4<f32>):mat2x2<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat4x2<f32>, %arg2:mat2x4<f32>):mat2x2<f32> { + $B1: { %4:mat2x2<f32> = mul %arg1, %arg2 ret %4 } @@ -305,8 +305,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:mat4x2<f32>, %arg2:mat2x4<f32>):mat2x2<f32> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat4x2<f32>, %arg2:mat2x4<f32>):mat2x2<f32> { + $B1: { %4:mat2x2<f32> = spirv.matrix_times_matrix %arg1, %arg2 ret %4 } @@ -330,8 +330,8 @@ }); auto* src = R"( -%foo = func(%arg1:f16, %arg2:mat3x2<f16>):mat3x2<f16> -> %b1 { - %b1 = block { +%foo = func(%arg1:f16, %arg2:mat3x2<f16>):mat3x2<f16> { + $B1: { %4:mat3x2<f16> = mul %arg1, %arg2 ret %4 } @@ -340,8 +340,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:f16, %arg2:mat3x2<f16>):mat3x2<f16> -> %b1 { - %b1 = block { +%foo = func(%arg1:f16, %arg2:mat3x2<f16>):mat3x2<f16> { + $B1: { %4:mat3x2<f16> = spirv.matrix_times_scalar %arg2, %arg1 ret %4 } @@ -365,8 +365,8 @@ }); auto* src = R"( -%foo = func(%arg1:vec3<f16>, %arg2:mat4x3<f16>):vec4<f16> -> %b1 { - %b1 = block { +%foo = func(%arg1:vec3<f16>, %arg2:mat4x3<f16>):vec4<f16> { + $B1: { %4:vec4<f16> = mul %arg1, %arg2 ret %4 } @@ -375,8 +375,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:vec3<f16>, %arg2:mat4x3<f16>):vec4<f16> -> %b1 { - %b1 = block { +%foo = func(%arg1:vec3<f16>, %arg2:mat4x3<f16>):vec4<f16> { + $B1: { %4:vec4<f16> = spirv.vector_times_matrix %arg1, %arg2 ret %4 } @@ -400,8 +400,8 @@ }); auto* src = R"( -%foo = func(%arg1:mat3x3<f16>, %arg2:mat3x3<f16>):mat3x3<f16> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat3x3<f16>, %arg2:mat3x3<f16>):mat3x3<f16> { + $B1: { %4:mat3x3<f16> = mul %arg1, %arg2 ret %4 } @@ -410,8 +410,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg1:mat3x3<f16>, %arg2:mat3x3<f16>):mat3x3<f16> -> %b1 { - %b1 = block { +%foo = func(%arg1:mat3x3<f16>, %arg2:mat3x3<f16>):mat3x3<f16> { + $B1: { %4:mat3x3<f16> = spirv.matrix_times_matrix %arg1, %arg2 ret %4 } @@ -434,8 +434,8 @@ }); auto* src = R"( -%foo = func(%arg:mat2x3<f32>):mat2x3<f16> -> %b1 { - %b1 = block { +%foo = func(%arg:mat2x3<f32>):mat2x3<f16> { + $B1: { %3:mat2x3<f16> = convert %arg ret %3 } @@ -444,8 +444,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:mat2x3<f32>):mat2x3<f16> -> %b1 { - %b1 = block { +%foo = func(%arg:mat2x3<f32>):mat2x3<f16> { + $B1: { %3:vec3<f32> = access %arg, 0u %4:vec3<f16> = convert %3 %5:vec3<f32> = access %arg, 1u @@ -472,8 +472,8 @@ }); auto* src = R"( -%foo = func(%arg:mat4x4<f32>):mat4x4<f16> -> %b1 { - %b1 = block { +%foo = func(%arg:mat4x4<f32>):mat4x4<f16> { + $B1: { %3:mat4x4<f16> = convert %arg ret %3 } @@ -482,8 +482,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:mat4x4<f32>):mat4x4<f16> -> %b1 { - %b1 = block { +%foo = func(%arg:mat4x4<f32>):mat4x4<f16> { + $B1: { %3:vec4<f32> = access %arg, 0u %4:vec4<f16> = convert %3 %5:vec4<f32> = access %arg, 1u @@ -514,8 +514,8 @@ }); auto* src = R"( -%foo = func(%arg:mat4x3<f16>):mat4x3<f32> -> %b1 { - %b1 = block { +%foo = func(%arg:mat4x3<f16>):mat4x3<f32> { + $B1: { %3:mat4x3<f32> = convert %arg ret %3 } @@ -524,8 +524,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:mat4x3<f16>):mat4x3<f32> -> %b1 { - %b1 = block { +%foo = func(%arg:mat4x3<f16>):mat4x3<f32> { + $B1: { %3:vec3<f16> = access %arg, 0u %4:vec3<f32> = convert %3 %5:vec3<f16> = access %arg, 1u @@ -556,8 +556,8 @@ }); auto* src = R"( -%foo = func(%arg:mat2x2<f32>):mat2x2<f16> -> %b1 { - %b1 = block { +%foo = func(%arg:mat2x2<f32>):mat2x2<f16> { + $B1: { %3:mat2x2<f16> = convert %arg ret %3 } @@ -566,8 +566,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%arg:mat2x2<f32>):mat2x2<f16> -> %b1 { - %b1 = block { +%foo = func(%arg:mat2x2<f32>):mat2x2<f16> { + $B1: { %3:vec2<f32> = access %arg, 0u %4:vec2<f16> = convert %3 %5:vec2<f32> = access %arg, 1u
diff --git a/src/tint/lang/spirv/writer/raise/merge_return_test.cc b/src/tint/lang/spirv/writer/raise/merge_return_test.cc index cc18a71..75998f5 100644 --- a/src/tint/lang/spirv/writer/raise/merge_return_test.cc +++ b/src/tint/lang/spirv/writer/raise/merge_return_test.cc
@@ -47,8 +47,8 @@ b.Append(func->Block(), [&] { b.Return(func, b.Add(ty.i32(), in, 1_i)); }); auto* src = R"( -%foo = func(%2:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:i32):i32 { + $B1: { %3:i32 = add %2, 1i ret %3 } @@ -78,14 +78,14 @@ b.Return(func, ifelse->Result(0)); }); auto* src = R"( -%foo = func(%2:i32):i32 -> %b1 { - %b1 = block { - %3:i32 = if %4 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%foo = func(%2:i32):i32 { + $B1: { + %3:i32 = if %4 [t: $B2, f: $B3] { # if_1 + $B2: { # true %5:i32 = add %2, 1i exit_if %5 # if_1 } - %b3 = block { # false + $B3: { # false %6:i32 = add %2, 2i exit_if %6 # if_1 } @@ -125,24 +125,24 @@ }); auto* src = R"( -%foo = func(%2:i32):i32 -> %b1 { - %b1 = block { - switch %2 [c: (default, %b2)] { # switch_1 - %b2 = block { # case +%foo = func(%2:i32):i32 { + $B1: { + switch %2 [c: (default, $B2)] { # switch_1 + $B2: { # case exit_switch # switch_1 } } - loop [b: %b3] { # loop_1 - %b3 = block { # body + loop [b: $B3] { # loop_1 + $B3: { # body exit_loop # loop_1 } } - %3:i32 = if %4 [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + %3:i32 = if %4 [t: $B4, f: $B5] { # if_1 + $B4: { # true %5:i32 = add %2, 1i exit_if %5 # if_1 } - %b5 = block { # false + $B5: { # false %6:i32 = add %2, 2i exit_if %6 # if_1 } @@ -174,13 +174,13 @@ }); auto* src = R"( -%foo = func(%2:bool):void -> %b1 { - %b1 = block { - if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%foo = func(%2:bool):void { + $B1: { + if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true ret } - %b3 = block { # false + $B3: { # false exit_if # if_1 } } @@ -191,13 +191,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:bool):void -> %b1 { - %b1 = block { - if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%foo = func(%2:bool):void { + $B1: { + if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true exit_if # if_1 } - %b3 = block { # false + $B3: { # false exit_if # if_1 } } @@ -227,13 +227,13 @@ }); auto* src = R"( -%foo = func(%2:bool):void -> %b1 { - %b1 = block { - if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%foo = func(%2:bool):void { + $B1: { + if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true ret } - %b3 = block { # false + $B3: { # false exit_if # if_1 } } @@ -244,13 +244,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:bool):void -> %b1 { - %b1 = block { - if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%foo = func(%2:bool):void { + $B1: { + if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true exit_if # if_1 } - %b3 = block { # false + $B3: { # false exit_if # if_1 } } @@ -278,13 +278,13 @@ }); auto* src = R"( -%foo = func(%2:bool):i32 -> %b1 { - %b1 = block { - if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%foo = func(%2:bool):i32 { + $B1: { + if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true ret 1i } - %b3 = block { # false + $B3: { # false exit_if # if_1 } } @@ -295,23 +295,23 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:bool):i32 -> %b1 { - %b1 = block { +%foo = func(%2:bool):i32 { + $B1: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true + if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true store %continue_execution, false store %return_value, 1i exit_if # if_1 } - %b3 = block { # false + $B3: { # false exit_if # if_1 } } %5:bool = load %continue_execution - if %5 [t: %b4] { # if_2 - %b4 = block { # true + if %5 [t: $B4] { # if_2 + $B4: { # true store %return_value, 2i exit_if # if_2 } @@ -342,13 +342,13 @@ }); auto* src = R"( -%foo = func(%2:bool):i32 -> %b1 { - %b1 = block { - %3:i32 = if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%foo = func(%2:bool):i32 { + $B1: { + %3:i32 = if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true ret 1i } - %b3 = block { # false + $B3: { # false exit_if 2i # if_1 } } @@ -359,23 +359,23 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:bool):i32 -> %b1 { - %b1 = block { +%foo = func(%2:bool):i32 { + $B1: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - %5:i32 = if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true + %5:i32 = if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true store %continue_execution, false store %return_value, 1i exit_if undef # if_1 } - %b3 = block { # false + $B3: { # false exit_if 2i # if_1 } } %6:bool = load %continue_execution - if %6 [t: %b4] { # if_2 - %b4 = block { # true + if %6 [t: $B4] { # if_2 + $B4: { # true store %return_value, %5 exit_if # if_2 } @@ -407,13 +407,13 @@ }); auto* src = R"( -%foo = func(%2:bool):i32 -> %b1 { - %b1 = block { - %3:i32 = if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%foo = func(%2:bool):i32 { + $B1: { + %3:i32 = if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true ret 1i } - %b3 = block { # false + $B3: { # false exit_if undef # if_1 } } @@ -424,23 +424,23 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:bool):i32 -> %b1 { - %b1 = block { +%foo = func(%2:bool):i32 { + $B1: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - %5:i32 = if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true + %5:i32 = if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true store %continue_execution, false store %return_value, 1i exit_if undef # if_1 } - %b3 = block { # false + $B3: { # false exit_if undef # if_1 } } %6:bool = load %continue_execution - if %6 [t: %b4] { # if_2 - %b4 = block { # true + if %6 [t: $B4] { # if_2 + $B4: { # true store %return_value, %5 exit_if # if_2 } @@ -470,13 +470,13 @@ }); auto* src = R"( -%foo = func(%2:bool):void -> %b1 { - %b1 = block { - if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%foo = func(%2:bool):void { + $B1: { + if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true ret } - %b3 = block { # false + $B3: { # false ret } } @@ -488,13 +488,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:bool):void -> %b1 { - %b1 = block { - if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%foo = func(%2:bool):void { + $B1: { + if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true exit_if # if_1 } - %b3 = block { # false + $B3: { # false exit_if # if_1 } } @@ -533,21 +533,21 @@ }); auto* src = R"( -%foo = func(%2:bool):void -> %b1 { - %b1 = block { - %3:i32, %4:f32 = if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true - if %2 [t: %b4, f: %b5] { # if_2 - %b4 = block { # true +%foo = func(%2:bool):void { + $B1: { + %3:i32, %4:f32 = if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true + if %2 [t: $B4, f: $B5] { # if_2 + $B4: { # true ret } - %b5 = block { # false + $B5: { # false ret } } unreachable } - %b3 = block { # false + $B3: { # false ret } } @@ -559,21 +559,21 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:bool):void -> %b1 { - %b1 = block { - %3:i32, %4:f32 = if %2 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true - if %2 [t: %b4, f: %b5] { # if_2 - %b4 = block { # true +%foo = func(%2:bool):void { + $B1: { + %3:i32, %4:f32 = if %2 [t: $B2, f: $B3] { # if_1 + $B2: { # true + if %2 [t: $B4, f: $B5] { # if_2 + $B4: { # true exit_if # if_2 } - %b5 = block { # false + $B5: { # false exit_if # if_2 } } exit_if undef, undef # if_1 } - %b3 = block { # false + $B3: { # false exit_if undef, undef # if_1 } } @@ -608,15 +608,15 @@ }); auto* src = R"( -%foo = func(%2:bool):void -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block { # body - if %2 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true +%foo = func(%2:bool):void { + $B1: { + loop [b: $B2] { # loop_1 + $B2: { # body + if %2 [t: $B3, f: $B4] { # if_1 + $B3: { # true ret } - %b4 = block { # false + $B4: { # false ret } } @@ -631,15 +631,15 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:bool):void -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block { # body - if %2 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true +%foo = func(%2:bool):void { + $B1: { + loop [b: $B2] { # loop_1 + $B2: { # body + if %2 [t: $B3, f: $B4] { # if_1 + $B3: { # true exit_if # if_1 } - %b4 = block { # false + $B4: { # false exit_if # if_1 } } @@ -674,17 +674,17 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%3:bool):void -> %b2 { - %b2 = block { - if %3 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true +%foo = func(%3:bool):void { + $B2: { + if %3 [t: $B3, f: $B4] { # if_1 + $B3: { # true ret } - %b4 = block { # false + $B4: { # false exit_if # if_1 } } @@ -697,25 +697,25 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%3:bool):void -> %b2 { - %b2 = block { +%foo = func(%3:bool):void { + $B2: { %continue_execution:ptr<function, bool, read_write> = var, true - if %3 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + if %3 [t: $B3, f: $B4] { # if_1 + $B3: { # true store %continue_execution, false exit_if # if_1 } - %b4 = block { # false + $B4: { # false exit_if # if_1 } } %5:bool = load %continue_execution - if %5 [t: %b5] { # if_2 - %b5 = block { # true + if %5 [t: $B5] { # if_2 + $B5: { # true store %1, 42i exit_if # if_2 } @@ -750,17 +750,17 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%3:bool):void -> %b2 { - %b2 = block { - if %3 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true +%foo = func(%3:bool):void { + $B2: { + if %3 [t: $B3, f: $B4] { # if_1 + $B3: { # true ret } - %b4 = block { # false + $B4: { # false exit_if # if_1 } } @@ -773,25 +773,25 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%3:bool):void -> %b2 { - %b2 = block { +%foo = func(%3:bool):void { + $B2: { %continue_execution:ptr<function, bool, read_write> = var, true - if %3 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + if %3 [t: $B3, f: $B4] { # if_1 + $B3: { # true store %continue_execution, false exit_if # if_1 } - %b4 = block { # false + $B4: { # false exit_if # if_1 } } %5:bool = load %continue_execution - if %5 [t: %b5] { # if_2 - %b5 = block { # true + if %5 [t: $B5] { # if_2 + $B5: { # true store %1, 42i exit_if # if_2 } @@ -838,31 +838,31 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 -> %b2 { - %b2 = block { - if %condA [t: %b3, f: %b4] { # if_1 - %b3 = block { # true +%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 { + $B2: { + if %condA [t: $B3, f: $B4] { # if_1 + $B3: { # true ret 3i } - %b4 = block { # false - if %condB [t: %b5, f: %b6] { # if_2 - %b5 = block { # true - if %condC [t: %b7, f: %b8] { # if_3 - %b7 = block { # true + $B4: { # false + if %condB [t: $B5, f: $B6] { # if_2 + $B5: { # true + if %condC [t: $B7, f: $B8] { # if_3 + $B7: { # true ret 1i } - %b8 = block { # false + $B8: { # false exit_if # if_3 } } store %1, 1i ret 2i } - %b6 = block { # false + $B6: { # false exit_if # if_2 } } @@ -880,36 +880,36 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 -> %b2 { - %b2 = block { +%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 { + $B2: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - if %condA [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + if %condA [t: $B3, f: $B4] { # if_1 + $B3: { # true store %continue_execution, false store %return_value, 3i exit_if # if_1 } - %b4 = block { # false - if %condB [t: %b5, f: %b6] { # if_2 - %b5 = block { # true - if %condC [t: %b7, f: %b8] { # if_3 - %b7 = block { # true + $B4: { # false + if %condB [t: $B5, f: $B6] { # if_2 + $B5: { # true + if %condC [t: $B7, f: $B8] { # if_3 + $B7: { # true store %continue_execution, false store %return_value, 1i exit_if # if_3 } - %b8 = block { # false + $B8: { # false exit_if # if_3 } } %8:bool = load %continue_execution - if %8 [t: %b9] { # if_4 - %b9 = block { # true + if %8 [t: $B9] { # if_4 + $B9: { # true store %1, 1i store %continue_execution, false store %return_value, 2i @@ -918,13 +918,13 @@ } exit_if # if_2 } - %b6 = block { # false + $B6: { # false exit_if # if_2 } } %9:bool = load %continue_execution - if %9 [t: %b10] { # if_5 - %b10 = block { # true + if %9 [t: $B10] { # if_5 + $B10: { # true store %1, 2i exit_if # if_5 } @@ -933,8 +933,8 @@ } } %10:bool = load %continue_execution - if %10 [t: %b11] { # if_6 - %b11 = block { # true + if %10 [t: $B11] { # if_6 + $B11: { # true store %1, 3i %11:i32 = add 5i, 6i store %return_value, %11 @@ -981,30 +981,30 @@ b.Return(func, 3_i); }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 -> %b2 { - %b2 = block { - if %condA [t: %b3, f: %b4] { # if_1 - %b3 = block { # true +%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 { + $B2: { + if %condA [t: $B3, f: $B4] { # if_1 + $B3: { # true ret 3i } - %b4 = block { # false - if %condB [t: %b5, f: %b6] { # if_2 - %b5 = block { # true - if %condC [t: %b7, f: %b8] { # if_3 - %b7 = block { # true + $B4: { # false + if %condB [t: $B5, f: $B6] { # if_2 + $B5: { # true + if %condC [t: $B7, f: $B8] { # if_3 + $B7: { # true ret 1i } - %b8 = block { # false + $B8: { # false exit_if # if_3 } } exit_if # if_2 } - %b6 = block { # false + $B6: { # false exit_if # if_2 } } @@ -1019,36 +1019,36 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 -> %b2 { - %b2 = block { +%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 { + $B2: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - if %condA [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + if %condA [t: $B3, f: $B4] { # if_1 + $B3: { # true store %continue_execution, false store %return_value, 3i exit_if # if_1 } - %b4 = block { # false - if %condB [t: %b5, f: %b6] { # if_2 - %b5 = block { # true - if %condC [t: %b7, f: %b8] { # if_3 - %b7 = block { # true + $B4: { # false + if %condB [t: $B5, f: $B6] { # if_2 + $B5: { # true + if %condC [t: $B7, f: $B8] { # if_3 + $B7: { # true store %continue_execution, false store %return_value, 1i exit_if # if_3 } - %b8 = block { # false + $B8: { # false exit_if # if_3 } } exit_if # if_2 } - %b6 = block { # false + $B6: { # false exit_if # if_2 } } @@ -1056,8 +1056,8 @@ } } %8:bool = load %continue_execution - if %8 [t: %b9] { # if_4 - %b9 = block { # true + if %8 [t: $B9] { # if_4 + $B9: { # true store %return_value, 3i exit_if # if_4 } @@ -1107,31 +1107,31 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 -> %b2 { - %b2 = block { - %6:i32 = if %condA [t: %b3, f: %b4] { # if_1 - %b3 = block { # true +%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 { + $B2: { + %6:i32 = if %condA [t: $B3, f: $B4] { # if_1 + $B3: { # true ret 3i } - %b4 = block { # false - %7:i32 = if %condB [t: %b5, f: %b6] { # if_2 - %b5 = block { # true - if %condC [t: %b7, f: %b8] { # if_3 - %b7 = block { # true + $B4: { # false + %7:i32 = if %condB [t: $B5, f: $B6] { # if_2 + $B5: { # true + if %condC [t: $B7, f: $B8] { # if_3 + $B7: { # true ret 1i } - %b8 = block { # false + $B8: { # false exit_if # if_3 } } %8:i32 = add 42i, 1i exit_if %8 # if_2 } - %b6 = block { # false + $B6: { # false %9:i32 = add 43i, 2i exit_if %9 # if_2 } @@ -1149,36 +1149,36 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 -> %b2 { - %b2 = block { +%foo = func(%condA:bool, %condB:bool, %condC:bool):i32 { + $B2: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - %8:i32 = if %condA [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + %8:i32 = if %condA [t: $B3, f: $B4] { # if_1 + $B3: { # true store %continue_execution, false store %return_value, 3i exit_if undef # if_1 } - %b4 = block { # false - %9:i32 = if %condB [t: %b5, f: %b6] { # if_2 - %b5 = block { # true - if %condC [t: %b7, f: %b8] { # if_3 - %b7 = block { # true + $B4: { # false + %9:i32 = if %condB [t: $B5, f: $B6] { # if_2 + $B5: { # true + if %condC [t: $B7, f: $B8] { # if_3 + $B7: { # true store %continue_execution, false store %return_value, 1i exit_if # if_3 } - %b8 = block { # false + $B8: { # false exit_if # if_3 } } %10:bool = load %continue_execution - %11:i32 = if %10 [t: %b9] { # if_4 - %b9 = block { # true + %11:i32 = if %10 [t: $B9] { # if_4 + $B9: { # true %12:i32 = add 42i, 1i exit_if %12 # if_4 } @@ -1186,14 +1186,14 @@ } exit_if %11 # if_2 } - %b6 = block { # false + $B6: { # false %13:i32 = add 43i, 2i exit_if %13 # if_2 } } %14:bool = load %continue_execution - %15:i32 = if %14 [t: %b10] { # if_5 - %b10 = block { # true + %15:i32 = if %14 [t: $B10] { # if_5 + $B10: { # true %16:i32 = add %9, 1i exit_if %16 # if_5 } @@ -1203,8 +1203,8 @@ } } %17:bool = load %continue_execution - if %17 [t: %b11] { # if_6 - %b11 = block { # true + if %17 [t: $B11] { # if_6 + $B11: { # true %18:i32 = add %8, 1i store %return_value, %18 exit_if # if_6 @@ -1243,23 +1243,23 @@ }); auto* src = R"( -%foo = func(%2:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:i32):i32 { + $B1: { %3:bool = eq %2, 1i - if %3 [t: %b2] { # if_1 - %b2 = block { # true + if %3 [t: $B2] { # if_1 + $B2: { # true ret 101i } } %4:bool = eq %2, 2i - if %4 [t: %b3] { # if_2 - %b3 = block { # true + if %4 [t: $B3] { # if_2 + $B3: { # true ret 202i } } %5:bool = eq %2, 3i - if %5 [t: %b4] { # if_3 - %b4 = block { # true + if %5 [t: $B4] { # if_3 + $B4: { # true ret 303i } } @@ -1270,43 +1270,43 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:i32):i32 { + $B1: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true %5:bool = eq %2, 1i - if %5 [t: %b2] { # if_1 - %b2 = block { # true + if %5 [t: $B2] { # if_1 + $B2: { # true store %continue_execution, false store %return_value, 101i exit_if # if_1 } } %6:bool = load %continue_execution - if %6 [t: %b3] { # if_2 - %b3 = block { # true + if %6 [t: $B3] { # if_2 + $B3: { # true %7:bool = eq %2, 2i - if %7 [t: %b4] { # if_3 - %b4 = block { # true + if %7 [t: $B4] { # if_3 + $B4: { # true store %continue_execution, false store %return_value, 202i exit_if # if_3 } } %8:bool = load %continue_execution - if %8 [t: %b5] { # if_4 - %b5 = block { # true + if %8 [t: $B5] { # if_4 + $B5: { # true %9:bool = eq %2, 3i - if %9 [t: %b6] { # if_5 - %b6 = block { # true + if %9 [t: $B6] { # if_5 + $B6: { # true store %continue_execution, false store %return_value, 303i exit_if # if_5 } } %10:bool = load %continue_execution - if %10 [t: %b7] { # if_6 - %b7 = block { # true + if %10 [t: $B7] { # if_6 + $B7: { # true store %return_value, 404i exit_if # if_6 } @@ -1347,20 +1347,20 @@ }); auto* src = R"( -%foo = func(%2:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:i32):i32 { + $B1: { %3:bool = eq %2, 1i - if %3 [t: %b2] { # if_1 - %b2 = block { # true + if %3 [t: $B2] { # if_1 + $B2: { # true ret 101i } } %4:bool = eq %2, 2i - if %4 [t: %b3, f: %b4] { # if_2 - %b3 = block { # true + if %4 [t: $B3, f: $B4] { # if_2 + $B3: { # true ret 202i } - %b4 = block { # false + $B4: { # false ret 303i } } @@ -1371,29 +1371,29 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:i32):i32 { + $B1: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true %5:bool = eq %2, 1i - if %5 [t: %b2] { # if_1 - %b2 = block { # true + if %5 [t: $B2] { # if_1 + $B2: { # true store %continue_execution, false store %return_value, 101i exit_if # if_1 } } %6:bool = load %continue_execution - if %6 [t: %b3] { # if_2 - %b3 = block { # true + if %6 [t: $B3] { # if_2 + $B3: { # true %7:bool = eq %2, 2i - if %7 [t: %b4, f: %b5] { # if_3 - %b4 = block { # true + if %7 [t: $B4, f: $B5] { # if_3 + $B4: { # true store %continue_execution, false store %return_value, 202i exit_if # if_3 } - %b5 = block { # false + $B5: { # false store %continue_execution, false store %return_value, 303i exit_if # if_3 @@ -1423,10 +1423,10 @@ b.Unreachable(); }); auto* src = R"( -%foo = func():i32 -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block { # body +%foo = func():i32 { + $B1: { + loop [b: $B2] { # loop_1 + $B2: { # body ret 42i } } @@ -1437,11 +1437,11 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():i32 -> %b1 { - %b1 = block { +%foo = func():i32 { + $B1: { %return_value:ptr<function, i32, read_write> = var - loop [b: %b2] { # loop_1 - %b2 = block { # body + loop [b: $B2] { # loop_1 + $B2: { # body store %return_value, 42i exit_loop # loop_1 } @@ -1486,28 +1486,28 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%3:bool):i32 -> %b2 { - %b2 = block { - loop [b: %b3, c: %b4] { # loop_1 - %b3 = block { # body - if %3 [t: %b5, f: %b6] { # if_1 - %b5 = block { # true +%foo = func(%3:bool):i32 { + $B2: { + loop [b: $B3, c: $B4] { # loop_1 + $B3: { # body + if %3 [t: $B5, f: $B6] { # if_1 + $B5: { # true ret 42i } - %b6 = block { # false + $B6: { # false exit_if # if_1 } } store %1, 2i - continue %b4 + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing store %1, 1i - break_if true %b3 + break_if true # -> [t: exit_loop loop_1, f: $B3] } } store %1, 3i @@ -1518,43 +1518,43 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%3:bool):i32 -> %b2 { - %b2 = block { +%foo = func(%3:bool):i32 { + $B2: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - loop [b: %b3, c: %b4] { # loop_1 - %b3 = block { # body - if %3 [t: %b5, f: %b6] { # if_1 - %b5 = block { # true + loop [b: $B3, c: $B4] { # loop_1 + $B3: { # body + if %3 [t: $B5, f: $B6] { # if_1 + $B5: { # true store %continue_execution, false store %return_value, 42i exit_if # if_1 } - %b6 = block { # false + $B6: { # false exit_if # if_1 } } %6:bool = load %continue_execution - if %6 [t: %b7] { # if_2 - %b7 = block { # true + if %6 [t: $B7] { # if_2 + $B7: { # true store %1, 2i - continue %b4 + continue # -> $B4 } } exit_loop # loop_1 } - %b4 = block { # continuing + $B4: { # continuing store %1, 1i - break_if true %b3 + break_if true # -> [t: exit_loop loop_1, f: $B3] } } %7:bool = load %continue_execution - if %7 [t: %b8] { # if_3 - %b8 = block { # true + if %7 [t: $B8] { # if_3 + $B8: { # true store %1, 3i store %return_value, 43i exit_if # if_3 @@ -1600,28 +1600,28 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%3:bool):i32 -> %b2 { - %b2 = block { - loop [b: %b3, c: %b4] { # loop_1 - %b3 = block { # body - if %3 [t: %b5, f: %b6] { # if_1 - %b5 = block { # true +%foo = func(%3:bool):i32 { + $B2: { + loop [b: $B3, c: $B4] { # loop_1 + $B3: { # body + if %3 [t: $B5, f: $B6] { # if_1 + $B5: { # true ret 42i } - %b6 = block { # false + $B6: { # false exit_if # if_1 } } store %1, 2i - continue %b4 + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing store %1, 1i - next_iteration %b3 + next_iteration # -> $B3 } } unreachable @@ -1631,38 +1631,38 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%3:bool):i32 -> %b2 { - %b2 = block { +%foo = func(%3:bool):i32 { + $B2: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - loop [b: %b3, c: %b4] { # loop_1 - %b3 = block { # body - if %3 [t: %b5, f: %b6] { # if_1 - %b5 = block { # true + loop [b: $B3, c: $B4] { # loop_1 + $B3: { # body + if %3 [t: $B5, f: $B6] { # if_1 + $B5: { # true store %continue_execution, false store %return_value, 42i exit_if # if_1 } - %b6 = block { # false + $B6: { # false exit_if # if_1 } } %6:bool = load %continue_execution - if %6 [t: %b7] { # if_2 - %b7 = block { # true + if %6 [t: $B7] { # if_2 + $B7: { # true store %1, 2i - continue %b4 + continue # -> $B4 } } exit_loop # loop_1 } - %b4 = block { # continuing + $B4: { # continuing store %1, 1i - next_iteration %b3 + next_iteration # -> $B3 } } %7:i32 = load %return_value @@ -1804,13 +1804,13 @@ }); auto* src = R"( -%foo = func(%2:i32):i32 -> %b1 { - %b1 = block { - switch %2 [c: (1i, %b2), c: (default, %b3)] { # switch_1 - %b2 = block { # case +%foo = func(%2:i32):i32 { + $B1: { + switch %2 [c: (1i, $B2), c: (default, $B3)] { # switch_1 + $B2: { # case ret 42i } - %b3 = block { # case + $B3: { # case exit_switch # switch_1 } } @@ -1821,23 +1821,23 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:i32):i32 { + $B1: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - switch %2 [c: (1i, %b2), c: (default, %b3)] { # switch_1 - %b2 = block { # case + switch %2 [c: (1i, $B2), c: (default, $B3)] { # switch_1 + $B2: { # case store %continue_execution, false store %return_value, 42i exit_switch # switch_1 } - %b3 = block { # case + $B3: { # case exit_switch # switch_1 } } %5:bool = load %continue_execution - if %5 [t: %b4] { # if_1 - %b4 = block { # true + if %5 [t: $B4] { # if_1 + $B4: { # true store %return_value, 0i exit_if # if_1 } @@ -1879,27 +1879,27 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%3:i32):i32 -> %b2 { - %b2 = block { - switch %3 [c: (1i, %b3), c: (default, %b4)] { # switch_1 - %b3 = block { # case +%foo = func(%3:i32):i32 { + $B2: { + switch %3 [c: (1i, $B3), c: (default, $B4)] { # switch_1 + $B3: { # case %4:bool = eq %3, 1i - if %4 [t: %b5, f: %b6] { # if_1 - %b5 = block { # true + if %4 [t: $B5, f: $B6] { # if_1 + $B5: { # true ret 42i } - %b6 = block { # false + $B6: { # false exit_if # if_1 } } store %1, 2i exit_switch # switch_1 } - %b4 = block { # case + $B4: { # case exit_switch # switch_1 } } @@ -1910,43 +1910,43 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } -%foo = func(%3:i32):i32 -> %b2 { - %b2 = block { +%foo = func(%3:i32):i32 { + $B2: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - switch %3 [c: (1i, %b3), c: (default, %b4)] { # switch_1 - %b3 = block { # case + switch %3 [c: (1i, $B3), c: (default, $B4)] { # switch_1 + $B3: { # case %6:bool = eq %3, 1i - if %6 [t: %b5, f: %b6] { # if_1 - %b5 = block { # true + if %6 [t: $B5, f: $B6] { # if_1 + $B5: { # true store %continue_execution, false store %return_value, 42i exit_if # if_1 } - %b6 = block { # false + $B6: { # false exit_if # if_1 } } %7:bool = load %continue_execution - if %7 [t: %b7] { # if_2 - %b7 = block { # true + if %7 [t: $B7] { # if_2 + $B7: { # true store %1, 2i exit_switch # switch_1 } } exit_switch # switch_1 } - %b4 = block { # case + $B4: { # case exit_switch # switch_1 } } %8:bool = load %continue_execution - if %8 [t: %b8] { # if_3 - %b8 = block { # true + if %8 [t: $B8] { # if_3 + $B8: { # true store %return_value, 0i exit_if # if_3 } @@ -1979,19 +1979,19 @@ }); auto* src = R"( -%foo = func(%2:i32):i32 -> %b1 { - %b1 = block { - %3:i32 = switch %2 [c: (1i, %b2), c: (2i, %b3), c: (3i, %b4), c: (default, %b5)] { # switch_1 - %b2 = block { # case +%foo = func(%2:i32):i32 { + $B1: { + %3:i32 = switch %2 [c: (1i, $B2), c: (2i, $B3), c: (3i, $B4), c: (default, $B5)] { # switch_1 + $B2: { # case ret 42i } - %b3 = block { # case + $B3: { # case ret 99i } - %b4 = block { # case + $B4: { # case exit_switch 1i # switch_1 } - %b5 = block { # case + $B5: { # case exit_switch 0i # switch_1 } } @@ -2002,31 +2002,31 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func(%2:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:i32):i32 { + $B1: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - %5:i32 = switch %2 [c: (1i, %b2), c: (2i, %b3), c: (3i, %b4), c: (default, %b5)] { # switch_1 - %b2 = block { # case + %5:i32 = switch %2 [c: (1i, $B2), c: (2i, $B3), c: (3i, $B4), c: (default, $B5)] { # switch_1 + $B2: { # case store %continue_execution, false store %return_value, 42i exit_switch undef # switch_1 } - %b3 = block { # case + $B3: { # case store %continue_execution, false store %return_value, 99i exit_switch undef # switch_1 } - %b4 = block { # case + $B4: { # case exit_switch 1i # switch_1 } - %b5 = block { # case + $B5: { # case exit_switch 0i # switch_1 } } %6:bool = load %continue_execution - if %6 [t: %b6] { # if_1 - %b6 = block { # true + if %6 [t: $B6] { # if_1 + $B6: { # true store %return_value, %5 exit_if # if_1 } @@ -2055,16 +2055,16 @@ }); auto* src = R"( -%foo = func():void -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block { # body - if true [t: %b3] { # if_1 - %b3 = block { # true +%foo = func():void { + $B1: { + loop [b: $B2] { # loop_1 + $B2: { # body + if true [t: $B3] { # if_1 + $B3: { # true ret } } - continue %b4 + continue # -> $B4 } } unreachable @@ -2074,21 +2074,21 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():void -> %b1 { - %b1 = block { +%foo = func():void { + $B1: { %continue_execution:ptr<function, bool, read_write> = var, true - loop [b: %b2] { # loop_1 - %b2 = block { # body - if true [t: %b3] { # if_1 - %b3 = block { # true + loop [b: $B2] { # loop_1 + $B2: { # body + if true [t: $B3] { # if_1 + $B3: { # true store %continue_execution, false exit_if # if_1 } } %3:bool = load %continue_execution - if %3 [t: %b4] { # if_2 - %b4 = block { # true - continue %b5 + if %3 [t: $B4] { # if_2 + $B4: { # true + continue # -> $B5 } } exit_loop # loop_1 @@ -2116,12 +2116,12 @@ }); auto* src = R"( -%foo = func():i32 -> %b1 { - %b1 = block { - if true [t: %b2] { # if_1 - %b2 = block { # true - if true [t: %b3] { # if_2 - %b3 = block { # true +%foo = func():i32 { + $B1: { + if true [t: $B2] { # if_1 + $B2: { # true + if true [t: $B3] { # if_2 + $B3: { # true ret 1i } } @@ -2135,22 +2135,22 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%foo = func():i32 -> %b1 { - %b1 = block { +%foo = func():i32 { + $B1: { %return_value:ptr<function, i32, read_write> = var %continue_execution:ptr<function, bool, read_write> = var, true - if true [t: %b2] { # if_1 - %b2 = block { # true - if true [t: %b3] { # if_2 - %b3 = block { # true + if true [t: $B2] { # if_1 + $B2: { # true + if true [t: $B3] { # if_2 + $B3: { # true store %continue_execution, false store %return_value, 1i exit_if # if_2 } } %4:bool = load %continue_execution - if %4 [t: %b4] { # if_3 - %b4 = block { # true + if %4 [t: $B4] { # if_3 + $B4: { # true store %continue_execution, false store %return_value, 2i exit_if # if_3 @@ -2160,8 +2160,8 @@ } } %5:bool = load %continue_execution - if %5 [t: %b5] { # if_4 - %b5 = block { # true + if %5 [t: $B5] { # if_4 + $B5: { # true store %return_value, 3i exit_if # if_4 }
diff --git a/src/tint/lang/spirv/writer/raise/pass_matrix_by_pointer_test.cc b/src/tint/lang/spirv/writer/raise/pass_matrix_by_pointer_test.cc index 5dc737d..e50d515 100644 --- a/src/tint/lang/spirv/writer/raise/pass_matrix_by_pointer_test.cc +++ b/src/tint/lang/spirv/writer/raise/pass_matrix_by_pointer_test.cc
@@ -58,18 +58,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, array<f32, 4>, read_write> = var } -%target = func(%value:array<f32, 4>):f32 -> %b2 { - %b2 = block { +%target = func(%value:array<f32, 4>):f32 { + $B2: { %4:f32 = access %value, 1i ret %4 } } -%caller = func():f32 -> %b3 { - %b3 = block { +%caller = func():f32 { + $B3: { %6:array<f32, 4> = load %var %7:f32 = call %target, %6 ret %7 @@ -104,19 +104,19 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, mat3x3<f32>, read_write> = var } -%target = func(%value:ptr<private, mat3x3<f32>, read_write>):vec3<f32> -> %b2 { - %b2 = block { +%target = func(%value:ptr<private, mat3x3<f32>, read_write>):vec3<f32> { + $B2: { %4:ptr<private, vec3<f32>, read_write> = access %value, 1i %5:vec3<f32> = load %4 ret %5 } } -%caller = func():vec3<f32> -> %b3 { - %b3 = block { +%caller = func():vec3<f32> { + $B3: { %7:vec3<f32> = call %target, %var ret %7 } @@ -142,12 +142,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, mat3x3<f32>, read_write> = var } -%caller = func():f32 -> %b2 { - %b2 = block { +%caller = func():f32 { + $B2: { %3:mat3x3<f32> = load %var %4:f32 = determinant %3 ret %4 @@ -182,18 +182,18 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, mat3x3<f32>, read_write> = var } -%target = func(%value:mat3x3<f32>):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%value:mat3x3<f32>):mat3x3<f32> { + $B2: { %4:mat3x3<f32> = mul %value, 2.0f ret %4 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %6:mat3x3<f32> = load %var %7:mat3x3<f32> = call %target, %6 ret %7 @@ -203,19 +203,19 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, mat3x3<f32>, read_write> = var } -%target = func(%3:ptr<function, mat3x3<f32>, read_write>):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%3:ptr<function, mat3x3<f32>, read_write>):mat3x3<f32> { + $B2: { %4:mat3x3<f32> = load %3 %5:mat3x3<f32> = mul %4, 2.0f ret %5 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %7:mat3x3<f32> = load %var %8:ptr<function, mat3x3<f32>, read_write> = var, %7 %9:mat3x3<f32> = call %target, %8 @@ -254,19 +254,19 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, array<mat3x3<f32>, 4>, read_write> = var } -%target = func(%value_a:mat3x3<f32>, %scalar:f32, %value_b:mat3x3<f32>):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%value_a:mat3x3<f32>, %scalar:f32, %value_b:mat3x3<f32>):mat3x3<f32> { + $B2: { %6:mat3x3<f32> = mul %value_a, %scalar %7:mat3x3<f32> = add %6, %value_b ret %7 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %9:ptr<private, mat3x3<f32>, read_write> = access %var, 0u %10:mat3x3<f32> = load %9 %11:ptr<private, mat3x3<f32>, read_write> = access %var, 1u @@ -279,12 +279,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, array<mat3x3<f32>, 4>, read_write> = var } -%target = func(%3:ptr<function, mat3x3<f32>, read_write>, %scalar:f32, %5:ptr<function, mat3x3<f32>, read_write>):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%3:ptr<function, mat3x3<f32>, read_write>, %scalar:f32, %5:ptr<function, mat3x3<f32>, read_write>):mat3x3<f32> { + $B2: { %6:mat3x3<f32> = load %5 %7:mat3x3<f32> = load %3 %8:mat3x3<f32> = mul %7, %scalar @@ -292,8 +292,8 @@ ret %9 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %11:ptr<private, mat3x3<f32>, read_write> = access %var, 0u %12:mat3x3<f32> = load %11 %13:ptr<private, mat3x3<f32>, read_write> = access %var, 1u @@ -331,19 +331,19 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, mat3x3<f32>, read_write> = var } -%target = func(%value:mat3x3<f32>):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%value:mat3x3<f32>):mat3x3<f32> { + $B2: { %4:mat3x3<f32> = add %value, %value %5:mat3x3<f32> = mul %4, %value ret %5 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %7:mat3x3<f32> = load %var %8:mat3x3<f32> = call %target, %7 ret %8 @@ -353,20 +353,20 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, mat3x3<f32>, read_write> = var } -%target = func(%3:ptr<function, mat3x3<f32>, read_write>):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%3:ptr<function, mat3x3<f32>, read_write>):mat3x3<f32> { + $B2: { %4:mat3x3<f32> = load %3 %5:mat3x3<f32> = add %4, %4 %6:mat3x3<f32> = mul %5, %4 ret %6 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %8:mat3x3<f32> = load %var %9:ptr<function, mat3x3<f32>, read_write> = var, %8 %10:mat3x3<f32> = call %target, %9 @@ -412,32 +412,32 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, mat3x3<f32>, read_write> = var } -%target = func(%value:mat3x3<f32>, %scalar:f32):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%value:mat3x3<f32>, %scalar:f32):mat3x3<f32> { + $B2: { %5:mat3x3<f32> = mul %value, %scalar ret %5 } } -%caller_a = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller_a = func():mat3x3<f32> { + $B3: { %7:mat3x3<f32> = load %var %8:mat3x3<f32> = call %target, %7, 2.0f ret %8 } } -%caller_b = func():mat3x3<f32> -> %b4 { - %b4 = block { +%caller_b = func():mat3x3<f32> { + $B4: { %10:mat3x3<f32> = load %var %11:mat3x3<f32> = call %target, %10, 3.0f ret %11 } } -%caller_c = func():mat3x3<f32> -> %b5 { - %b5 = block { +%caller_c = func():mat3x3<f32> { + $B5: { %13:mat3x3<f32> = load %var %14:mat3x3<f32> = call %target, %13, 4.0f ret %14 @@ -447,35 +447,35 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, mat3x3<f32>, read_write> = var } -%target = func(%3:ptr<function, mat3x3<f32>, read_write>, %scalar:f32):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%3:ptr<function, mat3x3<f32>, read_write>, %scalar:f32):mat3x3<f32> { + $B2: { %5:mat3x3<f32> = load %3 %6:mat3x3<f32> = mul %5, %scalar ret %6 } } -%caller_a = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller_a = func():mat3x3<f32> { + $B3: { %8:mat3x3<f32> = load %var %9:ptr<function, mat3x3<f32>, read_write> = var, %8 %10:mat3x3<f32> = call %target, %9, 2.0f ret %10 } } -%caller_b = func():mat3x3<f32> -> %b4 { - %b4 = block { +%caller_b = func():mat3x3<f32> { + $B4: { %12:mat3x3<f32> = load %var %13:ptr<function, mat3x3<f32>, read_write> = var, %12 %14:mat3x3<f32> = call %target, %13, 3.0f ret %14 } } -%caller_c = func():mat3x3<f32> -> %b5 { - %b5 = block { +%caller_c = func():mat3x3<f32> { + $B5: { %16:mat3x3<f32> = load %var %17:ptr<function, mat3x3<f32>, read_write> = var, %16 %18:mat3x3<f32> = call %target, %17, 4.0f @@ -511,20 +511,20 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, array<mat3x3<f32>, 2>, read_write> = var } -%target = func(%value:array<mat3x3<f32>, 2>):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%value:array<mat3x3<f32>, 2>):mat3x3<f32> { + $B2: { %4:mat3x3<f32> = access %value, 0u %5:mat3x3<f32> = access %value, 1u %6:mat3x3<f32> = add %4, %5 ret %6 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %8:array<mat3x3<f32>, 2> = load %var %9:mat3x3<f32> = call %target, %8 ret %9 @@ -534,12 +534,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %var:ptr<private, array<mat3x3<f32>, 2>, read_write> = var } -%target = func(%3:ptr<function, array<mat3x3<f32>, 2>, read_write>):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%3:ptr<function, array<mat3x3<f32>, 2>, read_write>):mat3x3<f32> { + $B2: { %4:array<mat3x3<f32>, 2> = load %3 %5:mat3x3<f32> = access %4, 0u %6:mat3x3<f32> = access %4, 1u @@ -547,8 +547,8 @@ ret %7 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %9:array<mat3x3<f32>, 2> = load %var %10:ptr<function, array<mat3x3<f32>, 2>, read_write> = var, %9 %11:mat3x3<f32> = call %target, %10 @@ -592,20 +592,20 @@ s:f32 @offset(48) } -%b1 = block { # root +$B1: { # root %var:ptr<private, MyStruct, read_write> = var } -%target = func(%value:MyStruct):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%value:MyStruct):mat3x3<f32> { + $B2: { %4:mat3x3<f32> = access %value, 0u %5:f32 = access %value, 1u %6:mat3x3<f32> = mul %4, %5 ret %6 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %8:MyStruct = load %var %9:mat3x3<f32> = call %target, %8 ret %9 @@ -620,12 +620,12 @@ s:f32 @offset(48) } -%b1 = block { # root +$B1: { # root %var:ptr<private, MyStruct, read_write> = var } -%target = func(%3:ptr<function, MyStruct, read_write>):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%3:ptr<function, MyStruct, read_write>):mat3x3<f32> { + $B2: { %4:MyStruct = load %3 %5:mat3x3<f32> = access %4, 0u %6:f32 = access %4, 1u @@ -633,8 +633,8 @@ ret %7 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %9:MyStruct = load %var %10:ptr<function, MyStruct, read_write> = var, %9 %11:mat3x3<f32> = call %target, %10 @@ -682,12 +682,12 @@ s:f32 @offset(96) } -%b1 = block { # root +$B1: { # root %var:ptr<private, array<MyStruct, 4>, read_write> = var } -%target = func(%value:array<MyStruct, 4>):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%value:array<MyStruct, 4>):mat3x3<f32> { + $B2: { %4:mat3x3<f32> = access %value, 2u, 0u, 0u %5:mat3x3<f32> = access %value, 2u, 0u, 1u %6:f32 = access %value, 2u, 1u @@ -696,8 +696,8 @@ ret %8 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %10:array<MyStruct, 4> = load %var %11:mat3x3<f32> = call %target, %10 ret %11 @@ -712,12 +712,12 @@ s:f32 @offset(96) } -%b1 = block { # root +$B1: { # root %var:ptr<private, array<MyStruct, 4>, read_write> = var } -%target = func(%3:ptr<function, array<MyStruct, 4>, read_write>):mat3x3<f32> -> %b2 { - %b2 = block { +%target = func(%3:ptr<function, array<MyStruct, 4>, read_write>):mat3x3<f32> { + $B2: { %4:array<MyStruct, 4> = load %3 %5:mat3x3<f32> = access %4, 2u, 0u, 0u %6:mat3x3<f32> = access %4, 2u, 0u, 1u @@ -727,8 +727,8 @@ ret %9 } } -%caller = func():mat3x3<f32> -> %b3 { - %b3 = block { +%caller = func():mat3x3<f32> { + $B3: { %11:array<MyStruct, 4> = load %var %12:ptr<function, array<MyStruct, 4>, read_write> = var, %11 %13:mat3x3<f32> = call %target, %12
diff --git a/src/tint/lang/spirv/writer/raise/shader_io_test.cc b/src/tint/lang/spirv/writer/raise/shader_io_test.cc index 61d3ef7..4faaf5d 100644 --- a/src/tint/lang/spirv/writer/raise/shader_io_test.cc +++ b/src/tint/lang/spirv/writer/raise/shader_io_test.cc
@@ -48,8 +48,8 @@ }); auto* src = R"( -%foo = @compute func():void -> %b1 { - %b1 = block { +%foo = @compute func():void { + $B1: { ret } } @@ -91,10 +91,10 @@ }); auto* src = R"( -%foo = @fragment func(%front_facing:bool [@front_facing], %position:vec4<f32> [@invariant, @position], %color1:f32 [@location(0)], %color2:f32 [@location(1), @interpolate(linear, sample)]):void -> %b1 { - %b1 = block { - if %front_facing [t: %b2] { # if_1 - %b2 = block { # true +%foo = @fragment func(%front_facing:bool [@front_facing], %position:vec4<f32> [@invariant, @position], %color1:f32 [@location(0)], %color2:f32 [@location(1), @interpolate(linear, sample)]):void { + $B1: { + if %front_facing [t: $B2] { # if_1 + $B2: { # true %6:f32 = add %color1, %color2 %7:vec4<f32> = mul %position, %6 exit_if # if_1 @@ -107,17 +107,17 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %foo_front_facing_Input:ptr<__in, bool, read> = var @builtin(front_facing) %foo_position_Input:ptr<__in, vec4<f32>, read> = var @invariant @builtin(position) %foo_loc0_Input:ptr<__in, f32, read> = var @location(0) %foo_loc1_Input:ptr<__in, f32, read> = var @location(1) @interpolate(linear, sample) } -%foo_inner = func(%front_facing:bool, %position:vec4<f32>, %color1:f32, %color2:f32):void -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%foo_inner = func(%front_facing:bool, %position:vec4<f32>, %color1:f32, %color2:f32):void { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true %10:f32 = add %color1, %color2 %11:vec4<f32> = mul %position, %10 exit_if # if_1 @@ -126,8 +126,8 @@ ret } } -%foo = @fragment func():void -> %b4 { - %b4 = block { +%foo = @fragment func():void { + $B4: { %13:bool = load %foo_front_facing_Input %14:vec4<f32> = load %foo_position_Input %15:f32 = load %foo_loc0_Input @@ -227,11 +227,11 @@ color2:f32 @offset(36), @location(1), @interpolate(linear, sample) } -%foo = @fragment func(%inputs:Inputs):void -> %b1 { - %b1 = block { +%foo = @fragment func(%inputs:Inputs):void { + $B1: { %3:bool = access %inputs, 0i - if %3 [t: %b2] { # if_1 - %b2 = block { # true + if %3 [t: $B2] { # if_1 + $B2: { # true %4:vec4<f32> = access %inputs, 1i %5:f32 = access %inputs, 2i %6:f32 = access %inputs, 3i @@ -254,18 +254,18 @@ color2:f32 @offset(36) } -%b1 = block { # root +$B1: { # root %foo_front_facing_Input:ptr<__in, bool, read> = var @builtin(front_facing) %foo_position_Input:ptr<__in, vec4<f32>, read> = var @invariant @builtin(position) %foo_loc0_Input:ptr<__in, f32, read> = var @location(0) %foo_loc1_Input:ptr<__in, f32, read> = var @location(1) @interpolate(linear, sample) } -%foo_inner = func(%inputs:Inputs):void -> %b2 { - %b2 = block { +%foo_inner = func(%inputs:Inputs):void { + $B2: { %7:bool = access %inputs, 0i - if %7 [t: %b3] { # if_1 - %b3 = block { # true + if %7 [t: $B3] { # if_1 + $B3: { # true %8:vec4<f32> = access %inputs, 1i %9:f32 = access %inputs, 2i %10:f32 = access %inputs, 3i @@ -277,8 +277,8 @@ ret } } -%foo = @fragment func():void -> %b4 { - %b4 = block { +%foo = @fragment func():void { + $B4: { %14:bool = load %foo_front_facing_Input %15:vec4<f32> = load %foo_position_Input %16:f32 = load %foo_loc0_Input @@ -354,10 +354,10 @@ color1:f32 @offset(16), @location(0) } -%foo = @fragment func(%front_facing:bool [@front_facing], %inputs:Inputs, %color2:f32 [@location(1), @interpolate(linear, sample)]):void -> %b1 { - %b1 = block { - if %front_facing [t: %b2] { # if_1 - %b2 = block { # true +%foo = @fragment func(%front_facing:bool [@front_facing], %inputs:Inputs, %color2:f32 [@location(1), @interpolate(linear, sample)]):void { + $B1: { + if %front_facing [t: $B2] { # if_1 + $B2: { # true %5:vec4<f32> = access %inputs, 0i %6:f32 = access %inputs, 1i %7:f32 = add %6, %color2 @@ -377,17 +377,17 @@ color1:f32 @offset(16) } -%b1 = block { # root +$B1: { # root %foo_front_facing_Input:ptr<__in, bool, read> = var @builtin(front_facing) %foo_position_Input:ptr<__in, vec4<f32>, read> = var @invariant @builtin(position) %foo_loc0_Input:ptr<__in, f32, read> = var @location(0) %foo_loc1_Input:ptr<__in, f32, read> = var @location(1) @interpolate(linear, sample) } -%foo_inner = func(%front_facing:bool, %inputs:Inputs, %color2:f32):void -> %b2 { - %b2 = block { - if %front_facing [t: %b3] { # if_1 - %b3 = block { # true +%foo_inner = func(%front_facing:bool, %inputs:Inputs, %color2:f32):void { + $B2: { + if %front_facing [t: $B3] { # if_1 + $B3: { # true %9:vec4<f32> = access %inputs, 0i %10:f32 = access %inputs, 1i %11:f32 = add %10, %color2 @@ -398,8 +398,8 @@ ret } } -%foo = @fragment func():void -> %b4 { - %b4 = block { +%foo = @fragment func():void { + $B4: { %14:bool = load %foo_front_facing_Input %15:vec4<f32> = load %foo_position_Input %16:f32 = load %foo_loc0_Input @@ -429,8 +429,8 @@ }); auto* src = R"( -%foo = @vertex func():vec4<f32> [@invariant, @position] -> %b1 { - %b1 = block { +%foo = @vertex func():vec4<f32> [@invariant, @position] { + $B1: { %2:vec4<f32> = construct 0.5f ret %2 } @@ -439,18 +439,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %foo_position_Output:ptr<__out, vec4<f32>, write> = var @invariant @builtin(position) } -%foo_inner = func():vec4<f32> -> %b2 { - %b2 = block { +%foo_inner = func():vec4<f32> { + $B2: { %3:vec4<f32> = construct 0.5f ret %3 } } -%foo = @vertex func():void -> %b3 { - %b3 = block { +%foo = @vertex func():void { + $B3: { %5:vec4<f32> = call %foo_inner store %foo_position_Output, %5 ret @@ -475,8 +475,8 @@ }); auto* src = R"( -%foo = @fragment func():vec4<f32> [@location(1)] -> %b1 { - %b1 = block { +%foo = @fragment func():vec4<f32> [@location(1)] { + $B1: { %2:vec4<f32> = construct 0.5f ret %2 } @@ -485,18 +485,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %foo_loc1_Output:ptr<__out, vec4<f32>, write> = var @location(1) } -%foo_inner = func():vec4<f32> -> %b2 { - %b2 = block { +%foo_inner = func():vec4<f32> { + $B2: { %3:vec4<f32> = construct 0.5f ret %3 } } -%foo = @fragment func():void -> %b3 { - %b3 = block { +%foo = @fragment func():void { + $B3: { %5:vec4<f32> = call %foo_inner store %foo_loc1_Output, %5 ret @@ -570,8 +570,8 @@ color2:f32 @offset(20), @location(1), @interpolate(linear, sample) } -%foo = @vertex func():Outputs -> %b1 { - %b1 = block { +%foo = @vertex func():Outputs { + $B1: { %2:vec4<f32> = construct 0.0f %3:Outputs = construct %2, 0.25f, 0.75f ret %3 @@ -587,21 +587,21 @@ color2:f32 @offset(20) } -%b1 = block { # root +$B1: { # root %foo_position_Output:ptr<__out, vec4<f32>, write> = var @invariant @builtin(position) %foo_loc0_Output:ptr<__out, f32, write> = var @location(0) %foo_loc1_Output:ptr<__out, f32, write> = var @location(1) @interpolate(linear, sample) } -%foo_inner = func():Outputs -> %b2 { - %b2 = block { +%foo_inner = func():Outputs { + $B2: { %5:vec4<f32> = construct 0.0f %6:Outputs = construct %5, 0.25f, 0.75f ret %6 } } -%foo = @vertex func():void -> %b3 { - %b3 = block { +%foo = @vertex func():void { + $B3: { %8:Outputs = call %foo_inner %9:vec4<f32> = access %8, 0u store %foo_position_Output, %9 @@ -663,8 +663,8 @@ color2:f32 @offset(4), @location(0) } -%foo = @fragment func():Output -> %b1 { - %b1 = block { +%foo = @fragment func():Output { + $B1: { %2:Output = construct 0.25f, 0.75f ret %2 } @@ -678,19 +678,19 @@ color2:f32 @offset(4) } -%b1 = block { # root +$B1: { # root %foo_loc0_idx0_Output:ptr<__out, f32, write> = var @location(0) @blend_src(0) %foo_loc0_idx1_Output:ptr<__out, f32, write> = var @location(0) @blend_src(1) } -%foo_inner = func():Output -> %b2 { - %b2 = block { +%foo_inner = func():Output { + $B2: { %4:Output = construct 0.25f, 0.75f ret %4 } } -%foo = @fragment func():void -> %b3 { - %b3 = block { +%foo = @fragment func():void { + $B3: { %6:Output = call %foo_inner %7:f32 = access %6, 0u store %foo_loc0_idx0_Output, %7 @@ -771,16 +771,16 @@ color:vec4<f32> @offset(16), @location(0) } -%vert = @vertex func():Interface -> %b1 { - %b1 = block { +%vert = @vertex func():Interface { + $B1: { %2:vec4<f32> = construct 0.0f %3:vec4<f32> = construct 1.0f %4:Interface = construct %2, %3 ret %4 } } -%frag = @fragment func(%inputs:Interface):vec4<f32> [@location(0)] -> %b2 { - %b2 = block { +%frag = @fragment func(%inputs:Interface):vec4<f32> [@location(0)] { + $B2: { %7:vec4<f32> = access %inputs, 0u %8:vec4<f32> = access %inputs, 1u %9:vec4<f32> = add %7, %8 @@ -796,7 +796,7 @@ color:vec4<f32> @offset(16) } -%b1 = block { # root +$B1: { # root %vert_position_Output:ptr<__out, vec4<f32>, write> = var @builtin(position) %vert_loc0_Output:ptr<__out, vec4<f32>, write> = var @location(0) %frag_position_Input:ptr<__in, vec4<f32>, read> = var @builtin(position) @@ -804,24 +804,24 @@ %frag_loc0_Output:ptr<__out, vec4<f32>, write> = var @location(0) } -%vert_inner = func():Interface -> %b2 { - %b2 = block { +%vert_inner = func():Interface { + $B2: { %7:vec4<f32> = construct 0.0f %8:vec4<f32> = construct 1.0f %9:Interface = construct %7, %8 ret %9 } } -%frag_inner = func(%inputs:Interface):vec4<f32> -> %b3 { - %b3 = block { +%frag_inner = func(%inputs:Interface):vec4<f32> { + $B3: { %12:vec4<f32> = access %inputs, 0u %13:vec4<f32> = access %inputs, 1u %14:vec4<f32> = add %12, %13 ret %14 } } -%vert = @vertex func():void -> %b4 { - %b4 = block { +%vert = @vertex func():void { + $B4: { %16:Interface = call %vert_inner %17:vec4<f32> = access %16, 0u store %vert_position_Output, %17 @@ -830,8 +830,8 @@ ret } } -%frag = @fragment func():void -> %b5 { - %b5 = block { +%frag = @fragment func():void { + $B5: { %20:vec4<f32> = load %frag_position_Input %21:vec4<f32> = load %frag_loc0_Input %22:Interface = construct %20, %21 @@ -894,12 +894,12 @@ color:vec4<f32> @offset(16), @location(0) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, Outputs, read> = var } -%vert = @vertex func():Outputs -> %b2 { - %b2 = block { +%vert = @vertex func():Outputs { + $B2: { %3:Outputs = load %1 ret %3 } @@ -913,20 +913,20 @@ color:vec4<f32> @offset(16) } -%b1 = block { # root +$B1: { # root %1:ptr<storage, Outputs, read> = var %vert_position_Output:ptr<__out, vec4<f32>, write> = var @builtin(position) %vert_loc0_Output:ptr<__out, vec4<f32>, write> = var @location(0) } -%vert_inner = func():Outputs -> %b2 { - %b2 = block { +%vert_inner = func():Outputs { + $B2: { %5:Outputs = load %1 ret %5 } } -%vert = @vertex func():void -> %b3 { - %b3 = block { +%vert = @vertex func():void { + $B3: { %7:Outputs = call %vert_inner %8:vec4<f32> = access %7, 0u store %vert_position_Output, %8 @@ -991,8 +991,8 @@ mask:u32 @offset(4), @builtin(sample_mask) } -%foo = @fragment func(%mask_in:u32 [@sample_mask]):Outputs -> %b1 { - %b1 = block { +%foo = @fragment func(%mask_in:u32 [@sample_mask]):Outputs { + $B1: { %3:Outputs = construct 0.5f, %mask_in ret %3 } @@ -1006,20 +1006,20 @@ mask:u32 @offset(4) } -%b1 = block { # root +$B1: { # root %foo_sample_mask_Input:ptr<__in, array<u32, 1>, read> = var @builtin(sample_mask) %foo_loc0_Output:ptr<__out, f32, write> = var @location(0) %foo_sample_mask_Output:ptr<__out, array<u32, 1>, write> = var @builtin(sample_mask) } -%foo_inner = func(%mask_in:u32):Outputs -> %b2 { - %b2 = block { +%foo_inner = func(%mask_in:u32):Outputs { + $B2: { %6:Outputs = construct 0.5f, %mask_in ret %6 } } -%foo = @fragment func():void -> %b3 { - %b3 = block { +%foo = @fragment func():void { + $B3: { %8:ptr<__in, u32, read> = access %foo_sample_mask_Input, 0u %9:u32 = load %8 %10:Outputs = call %foo_inner, %9 @@ -1105,20 +1105,20 @@ color:f32 @offset(0), @location(1), @interpolate(linear, sample) } -%vert = @vertex func(%input:MyStruct, %ival:i32 [@location(1), @interpolate(flat)]):vec4<f32> [@invariant, @position] -> %b1 { - %b1 = block { +%vert = @vertex func(%input:MyStruct, %ival:i32 [@location(1), @interpolate(flat)]):vec4<f32> [@invariant, @position] { + $B1: { %4:vec4<f32> = construct 0.5f ret %4 } } -%frag1 = @fragment func():MyStruct -> %b2 { - %b2 = block { +%frag1 = @fragment func():MyStruct { + $B2: { %6:MyStruct = construct 0.5f ret %6 } } -%frag2 = @fragment func():i32 [@location(0), @interpolate(flat)] -> %b3 { - %b3 = block { +%frag2 = @fragment func():i32 [@location(0), @interpolate(flat)] { + $B3: { ret 42i } } @@ -1130,7 +1130,7 @@ color:f32 @offset(0) } -%b1 = block { # root +$B1: { # root %vert_loc1_Input:ptr<__in, f32, read> = var @location(1) %vert_loc1_Input_1:ptr<__in, i32, read> = var @location(1) # %vert_loc1_Input_1: 'vert_loc1_Input' %vert_position_Output:ptr<__out, vec4<f32>, write> = var @invariant @builtin(position) @@ -1138,25 +1138,25 @@ %frag2_loc0_Output:ptr<__out, i32, write> = var @location(0) } -%vert_inner = func(%input:MyStruct, %ival:i32):vec4<f32> -> %b2 { - %b2 = block { +%vert_inner = func(%input:MyStruct, %ival:i32):vec4<f32> { + $B2: { %9:vec4<f32> = construct 0.5f ret %9 } } -%frag1_inner = func():MyStruct -> %b3 { - %b3 = block { +%frag1_inner = func():MyStruct { + $B3: { %11:MyStruct = construct 0.5f ret %11 } } -%frag2_inner = func():i32 -> %b4 { - %b4 = block { +%frag2_inner = func():i32 { + $B4: { ret 42i } } -%vert = @vertex func():void -> %b5 { - %b5 = block { +%vert = @vertex func():void { + $B5: { %14:f32 = load %vert_loc1_Input %15:MyStruct = construct %14 %16:i32 = load %vert_loc1_Input_1 @@ -1165,16 +1165,16 @@ ret } } -%frag1 = @fragment func():void -> %b6 { - %b6 = block { +%frag1 = @fragment func():void { + $B6: { %19:MyStruct = call %frag1_inner %20:f32 = access %19, 0u store %frag1_loc1_Output, %20 ret } } -%frag2 = @fragment func():void -> %b7 { - %b7 = block { +%frag2 = @fragment func():void { + $B7: { %22:i32 = call %frag2_inner store %frag2_loc0_Output, %22 ret @@ -1231,8 +1231,8 @@ depth:f32 @offset(4), @builtin(frag_depth) } -%foo = @fragment func():Outputs -> %b1 { - %b1 = block { +%foo = @fragment func():Outputs { + $B1: { %2:Outputs = construct 0.5f, 2.0f ret %2 } @@ -1251,20 +1251,20 @@ max:f32 @offset(4) } -%b1 = block { # root +$B1: { # root %foo_loc0_Output:ptr<__out, f32, write> = var @location(0) %foo_frag_depth_Output:ptr<__out, f32, write> = var @builtin(frag_depth) %tint_frag_depth_clamp_args:ptr<push_constant, FragDepthClampArgs, read> = var } -%foo_inner = func():Outputs -> %b2 { - %b2 = block { +%foo_inner = func():Outputs { + $B2: { %5:Outputs = construct 0.5f, 2.0f ret %5 } } -%foo = @fragment func():void -> %b3 { - %b3 = block { +%foo = @fragment func():void { + $B3: { %7:Outputs = call %foo_inner %8:f32 = access %7, 0u store %foo_loc0_Output, %8 @@ -1332,20 +1332,20 @@ depth:f32 @offset(4), @builtin(frag_depth) } -%ep1 = @fragment func():Outputs -> %b1 { - %b1 = block { +%ep1 = @fragment func():Outputs { + $B1: { %2:Outputs = construct 0.5f, 2.0f ret %2 } } -%ep2 = @fragment func():Outputs -> %b2 { - %b2 = block { +%ep2 = @fragment func():Outputs { + $B2: { %4:Outputs = construct 0.5f, 2.0f ret %4 } } -%ep3 = @fragment func():Outputs -> %b3 { - %b3 = block { +%ep3 = @fragment func():Outputs { + $B3: { %6:Outputs = construct 0.5f, 2.0f ret %6 } @@ -1364,7 +1364,7 @@ max:f32 @offset(4) } -%b1 = block { # root +$B1: { # root %ep1_loc0_Output:ptr<__out, f32, write> = var @location(0) %ep1_frag_depth_Output:ptr<__out, f32, write> = var @builtin(frag_depth) %tint_frag_depth_clamp_args:ptr<push_constant, FragDepthClampArgs, read> = var @@ -1374,26 +1374,26 @@ %ep3_frag_depth_Output:ptr<__out, f32, write> = var @builtin(frag_depth) } -%ep1_inner = func():Outputs -> %b2 { - %b2 = block { +%ep1_inner = func():Outputs { + $B2: { %9:Outputs = construct 0.5f, 2.0f ret %9 } } -%ep2_inner = func():Outputs -> %b3 { - %b3 = block { +%ep2_inner = func():Outputs { + $B3: { %11:Outputs = construct 0.5f, 2.0f ret %11 } } -%ep3_inner = func():Outputs -> %b4 { - %b4 = block { +%ep3_inner = func():Outputs { + $B4: { %13:Outputs = construct 0.5f, 2.0f ret %13 } } -%ep1 = @fragment func():void -> %b5 { - %b5 = block { +%ep1 = @fragment func():void { + $B5: { %15:Outputs = call %ep1_inner %16:f32 = access %15, 0u store %ep1_loc0_Output, %16 @@ -1406,8 +1406,8 @@ ret } } -%ep2 = @fragment func():void -> %b6 { - %b6 = block { +%ep2 = @fragment func():void { + $B6: { %23:Outputs = call %ep2_inner %24:f32 = access %23, 0u store %ep2_loc0_Output, %24 @@ -1420,8 +1420,8 @@ ret } } -%ep3 = @fragment func():void -> %b7 { - %b7 = block { +%ep3 = @fragment func():void { + $B7: { %31:Outputs = call %ep3_inner %32:f32 = access %31, 0u store %ep3_loc0_Output, %32 @@ -1453,8 +1453,8 @@ }); auto* src = R"( -%foo = @vertex func():vec4<f32> [@position] -> %b1 { - %b1 = block { +%foo = @vertex func():vec4<f32> [@position] { + $B1: { %2:vec4<f32> = construct 0.5f ret %2 } @@ -1463,19 +1463,19 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %foo_position_Output:ptr<__out, vec4<f32>, write> = var @builtin(position) %foo___point_size_Output:ptr<__out, f32, write> = var @builtin(__point_size) } -%foo_inner = func():vec4<f32> -> %b2 { - %b2 = block { +%foo_inner = func():vec4<f32> { + $B2: { %4:vec4<f32> = construct 0.5f ret %4 } } -%foo = @vertex func():void -> %b3 { - %b3 = block { +%foo = @vertex func():void { + $B3: { %6:vec4<f32> = call %foo_inner store %foo_position_Output, %6 store %foo___point_size_Output, 1.0f @@ -1536,8 +1536,8 @@ out2:vec4<f16> @offset(8), @location(2) } -%main = @fragment func(%in1:f16 [@location(2)], %in2:vec4<f16>):Outputs -> %b1 { - %b1 = block { +%main = @fragment func(%in1:f16 [@location(2)], %in2:vec4<f16>):Outputs { + $B1: { %4:Outputs = construct %in1, %in2 ret %4 } @@ -1551,21 +1551,21 @@ out2:vec4<f16> @offset(8) } -%b1 = block { # root +$B1: { # root %main_loc2_Input:ptr<__in, f16, read> = var @location(2) %main_Input:ptr<__in, vec4<f16>, read> = var %main_loc1_Output:ptr<__out, f16, write> = var @location(1) %main_loc2_Output:ptr<__out, vec4<f16>, write> = var @location(2) } -%main_inner = func(%in1:f16, %in2:vec4<f16>):Outputs -> %b2 { - %b2 = block { +%main_inner = func(%in1:f16, %in2:vec4<f16>):Outputs { + $B2: { %8:Outputs = construct %in1, %in2 ret %8 } } -%main = @fragment func():void -> %b3 { - %b3 = block { +%main = @fragment func():void { + $B3: { %10:f16 = load %main_loc2_Input %11:vec4<f16> = load %main_Input %12:Outputs = call %main_inner, %10, %11 @@ -1630,8 +1630,8 @@ out2:vec4<f16> @offset(8), @location(2) } -%main = @fragment func(%in1:f16 [@location(2)], %in2:vec4<f16>):Outputs -> %b1 { - %b1 = block { +%main = @fragment func(%in1:f16 [@location(2)], %in2:vec4<f16>):Outputs { + $B1: { %4:Outputs = construct %in1, %in2 ret %4 } @@ -1645,21 +1645,21 @@ out2:vec4<f16> @offset(8) } -%b1 = block { # root +$B1: { # root %main_loc2_Input:ptr<__in, f32, read> = var @location(2) %main_Input:ptr<__in, vec4<f32>, read> = var %main_loc1_Output:ptr<__out, f32, write> = var @location(1) %main_loc2_Output:ptr<__out, vec4<f32>, write> = var @location(2) } -%main_inner = func(%in1:f16, %in2:vec4<f16>):Outputs -> %b2 { - %b2 = block { +%main_inner = func(%in1:f16, %in2:vec4<f16>):Outputs { + $B2: { %8:Outputs = construct %in1, %in2 ret %8 } } -%main = @fragment func():void -> %b3 { - %b3 = block { +%main = @fragment func():void { + $B3: { %10:f32 = load %main_loc2_Input %11:f16 = convert %10 %12:vec4<f32> = load %main_Input
diff --git a/src/tint/lang/spirv/writer/raise/var_for_dynamic_index_test.cc b/src/tint/lang/spirv/writer/raise/var_for_dynamic_index_test.cc index 657488b..59b0f27 100644 --- a/src/tint/lang/spirv/writer/raise/var_for_dynamic_index_test.cc +++ b/src/tint/lang/spirv/writer/raise/var_for_dynamic_index_test.cc
@@ -52,8 +52,8 @@ block->Append(b.Return(func, access)); auto* expect = R"( -%foo = func(%2:array<i32, 4>):i32 -> %b1 { - %b1 = block { +%foo = func(%2:array<i32, 4>):i32 { + $B1: { %3:i32 = access %2, 1i ret %3 } @@ -75,8 +75,8 @@ block->Append(b.Return(func, access)); auto* expect = R"( -%foo = func(%2:mat2x2<f32>):f32 -> %b1 { - %b1 = block { +%foo = func(%2:mat2x2<f32>):f32 { + $B1: { %3:f32 = access %2, 1i, 0i ret %3 } @@ -100,8 +100,8 @@ block->Append(b.Return(func, load)); auto* expect = R"( -%foo = func(%2:ptr<function, array<i32, 4>, read_write>, %3:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:ptr<function, array<i32, 4>, read_write>, %3:i32):i32 { + $B1: { %4:ptr<function, i32, read_write> = access %2, %3 %5:i32 = load %4 ret %5 @@ -126,8 +126,8 @@ block->Append(b.Return(func, load)); auto* expect = R"( -%foo = func(%2:ptr<function, mat2x2<f32>, read_write>, %3:i32):f32 -> %b1 { - %b1 = block { +%foo = func(%2:ptr<function, mat2x2<f32>, read_write>, %3:i32):f32 { + $B1: { %4:ptr<function, vec2<f32>, read_write> = access %2, %3 %5:f32 = load_vector_element %4, %3 ret %5 @@ -151,8 +151,8 @@ block->Append(b.Return(func, access)); auto* expect = R"( -%foo = func(%2:vec4<f32>, %3:i32):f32 -> %b1 { - %b1 = block { +%foo = func(%2:vec4<f32>, %3:i32):f32 { + $B1: { %4:f32 = access %2, %3 ret %4 } @@ -175,8 +175,8 @@ block->Append(b.Return(func, access)); auto* expect = R"( -%foo = func(%2:array<i32, 4>, %3:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:array<i32, 4>, %3:i32):i32 { + $B1: { %4:ptr<function, array<i32, 4>, read_write> = var, %2 %5:ptr<function, i32, read_write> = access %4, %3 %6:i32 = load %5 @@ -201,8 +201,8 @@ block->Append(b.Return(func, access)); auto* expect = R"( -%foo = func(%2:mat2x2<f32>, %3:i32):vec2<f32> -> %b1 { - %b1 = block { +%foo = func(%2:mat2x2<f32>, %3:i32):vec2<f32> { + $B1: { %4:ptr<function, mat2x2<f32>, read_write> = var, %2 %5:ptr<function, vec2<f32>, read_write> = access %4, %3 %6:vec2<f32> = load %5 @@ -227,8 +227,8 @@ block->Append(b.Return(func, access)); auto* expect = R"( -%foo = func(%2:mat2x2<f32>, %3:i32):f32 -> %b1 { - %b1 = block { +%foo = func(%2:mat2x2<f32>, %3:i32):f32 { + $B1: { %4:ptr<function, mat2x2<f32>, read_write> = var, %2 %5:ptr<function, vec2<f32>, read_write> = access %4, %3 %6:f32 = load_vector_element %5, %3 @@ -253,8 +253,8 @@ block->Append(b.Return(func, access)); auto* expect = R"( -%foo = func(%2:array<array<array<i32, 4>, 4>, 4>, %3:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:array<array<array<i32, 4>, 4>, 4>, %3:i32):i32 { + $B1: { %4:ptr<function, array<array<array<i32, 4>, 4>, 4>, read_write> = var, %2 %5:ptr<function, i32, read_write> = access %4, %3, 1u, %3 %6:i32 = load %5 @@ -279,8 +279,8 @@ block->Append(b.Return(func, access)); auto* expect = R"( -%foo = func(%2:array<array<array<i32, 4>, 4>, 4>, %3:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:array<array<array<i32, 4>, 4>, 4>, %3:i32):i32 { + $B1: { %4:array<i32, 4> = access %2, 1u, 2u %5:ptr<function, array<i32, 4>, read_write> = var, %4 %6:ptr<function, i32, read_write> = access %5, %3 @@ -306,8 +306,8 @@ block->Append(b.Return(func, access)); auto* expect = R"( -%foo = func(%2:array<array<array<array<i32, 4>, 4>, 4>, 4>, %3:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:array<array<array<array<i32, 4>, 4>, 4>, 4>, %3:i32):i32 { + $B1: { %4:array<array<array<i32, 4>, 4>, 4> = access %2, 1u %5:ptr<function, array<array<array<i32, 4>, 4>, 4>, read_write> = var, %4 %6:ptr<function, i32, read_write> = access %5, %3, 2u, %3 @@ -345,8 +345,8 @@ arr2:array<f32, 1024> @offset(4160) } -%foo = func(%2:MyStruct, %3:i32):f32 -> %b1 { - %b1 = block { +%foo = func(%2:MyStruct, %3:i32):f32 { + $B1: { %4:mat4x4<f32> = access %2, 1u %5:ptr<function, mat4x4<f32>, read_write> = var, %4 %6:ptr<function, vec4<f32>, read_write> = access %5, %3 @@ -376,8 +376,8 @@ block->Append(b.Return(func, access_c)); auto* expect = R"( -%foo = func(%2:array<i32, 4>, %3:i32, %4:i32, %5:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:array<i32, 4>, %3:i32, %4:i32, %5:i32):i32 { + $B1: { %6:ptr<function, array<i32, 4>, read_write> = var, %2 %7:ptr<function, i32, read_write> = access %6, %3 %8:i32 = load %7 @@ -410,8 +410,8 @@ block->Append(b.Return(func, access_c)); auto* expect = R"( -%foo = func(%2:array<array<array<i32, 4>, 4>, 4>, %3:i32, %4:i32, %5:i32):i32 -> %b1 { - %b1 = block { +%foo = func(%2:array<array<array<i32, 4>, 4>, 4>, %3:i32, %4:i32, %5:i32):i32 { + $B1: { %6:array<i32, 4> = access %2, 1u, 2u %7:ptr<function, array<i32, 4>, read_write> = var, %6 %8:ptr<function, i32, read_write> = access %7, %3 @@ -449,14 +449,14 @@ }); auto* src = R"( -%func = func(%2:array<i32, 4>, %3:bool, %4:i32, %5:i32):i32 -> %b1 { - %b1 = block { - if %3 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%func = func(%2:array<i32, 4>, %3:bool, %4:i32, %5:i32):i32 { + $B1: { + if %3 [t: $B2, f: $B3] { # if_1 + $B2: { # true %6:i32 = access %2, %4 ret %6 } - %b3 = block { # false + $B3: { # false %7:i32 = access %2, %5 ret %7 } @@ -468,16 +468,16 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%func = func(%2:array<i32, 4>, %3:bool, %4:i32, %5:i32):i32 -> %b1 { - %b1 = block { +%func = func(%2:array<i32, 4>, %3:bool, %4:i32, %5:i32):i32 { + $B1: { %6:ptr<function, array<i32, 4>, read_write> = var, %2 - if %3 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true + if %3 [t: $B2, f: $B3] { # if_1 + $B2: { # true %7:ptr<function, i32, read_write> = access %6, %4 %8:i32 = load %7 ret %8 } - %b3 = block { # false + $B3: { # false %9:ptr<function, i32, read_write> = access %6, %5 %10:i32 = load %9 ret %10 @@ -513,14 +513,14 @@ }); auto* src = R"( -%func = func(%2:array<array<i32, 4>, 4>, %3:bool, %4:i32, %5:i32):i32 -> %b1 { - %b1 = block { - if %3 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true +%func = func(%2:array<array<i32, 4>, 4>, %3:bool, %4:i32, %5:i32):i32 { + $B1: { + if %3 [t: $B2, f: $B3] { # if_1 + $B2: { # true %6:i32 = access %2, 0u, %4 ret %6 } - %b3 = block { # false + $B3: { # false %7:i32 = access %2, 0u, %5 ret %7 } @@ -532,17 +532,17 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%func = func(%2:array<array<i32, 4>, 4>, %3:bool, %4:i32, %5:i32):i32 -> %b1 { - %b1 = block { +%func = func(%2:array<array<i32, 4>, 4>, %3:bool, %4:i32, %5:i32):i32 { + $B1: { %6:array<i32, 4> = access %2, 0u %7:ptr<function, array<i32, 4>, read_write> = var, %6 - if %3 [t: %b2, f: %b3] { # if_1 - %b2 = block { # true + if %3 [t: $B2, f: $B3] { # if_1 + $B2: { # true %8:ptr<function, i32, read_write> = access %7, %4 %9:i32 = load %8 ret %9 } - %b3 = block { # false + $B3: { # false %10:ptr<function, i32, read_write> = access %7, %5 %11:i32 = load %10 ret %11 @@ -581,16 +581,16 @@ }); auto* src = R"( -%func = func(%2:bool, %3:i32, %4:i32):i32 -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block (%5:array<i32, 4>) { # body - if %2 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true +%func = func(%2:bool, %3:i32, %4:i32):i32 { + $B1: { + loop [b: $B2] { # loop_1 + $B2 (%5:array<i32, 4>): { # body + if %2 [t: $B3, f: $B4] { # if_1 + $B3: { # true %6:i32 = access %5:array<i32, 4>, %3 ret %6 } - %b4 = block { # false + $B4: { # false %7:i32 = access %5:array<i32, 4>, %4 ret %7 } @@ -605,18 +605,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%func = func(%2:bool, %3:i32, %4:i32):i32 -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block (%5:array<i32, 4>) { # body +%func = func(%2:bool, %3:i32, %4:i32):i32 { + $B1: { + loop [b: $B2] { # loop_1 + $B2 (%5:array<i32, 4>): { # body %6:ptr<function, array<i32, 4>, read_write> = var, %5:array<i32, 4> - if %2 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + if %2 [t: $B3, f: $B4] { # if_1 + $B3: { # true %7:ptr<function, i32, read_write> = access %6, %3 %8:i32 = load %7 ret %8 } - %b4 = block { # false + $B4: { # false %9:ptr<function, i32, read_write> = access %6, %4 %10:i32 = load %9 ret %10 @@ -660,16 +660,16 @@ }); auto* src = R"( -%func = func(%2:bool, %3:i32, %4:i32):i32 -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block (%5:array<array<i32, 4>, 4>) { # body - if %2 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true +%func = func(%2:bool, %3:i32, %4:i32):i32 { + $B1: { + loop [b: $B2] { # loop_1 + $B2 (%5:array<array<i32, 4>, 4>): { # body + if %2 [t: $B3, f: $B4] { # if_1 + $B3: { # true %6:i32 = access %5:array<array<i32, 4>, 4>, 0u, %3 ret %6 } - %b4 = block { # false + $B4: { # false %7:i32 = access %5:array<array<i32, 4>, 4>, 0u, %4 ret %7 } @@ -684,19 +684,19 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%func = func(%2:bool, %3:i32, %4:i32):i32 -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block (%5:array<array<i32, 4>, 4>) { # body +%func = func(%2:bool, %3:i32, %4:i32):i32 { + $B1: { + loop [b: $B2] { # loop_1 + $B2 (%5:array<array<i32, 4>, 4>): { # body %6:array<i32, 4> = access %5:array<array<i32, 4>, 4>, 0u %7:ptr<function, array<i32, 4>, read_write> = var, %6 - if %2 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + if %2 [t: $B3, f: $B4] { # if_1 + $B3: { # true %8:ptr<function, i32, read_write> = access %7, %3 %9:i32 = load %8 ret %9 } - %b4 = block { # false + $B4: { # false %10:ptr<function, i32, read_write> = access %7, %4 %11:i32 = load %10 ret %11 @@ -740,20 +740,20 @@ }); auto* src = R"( -%func_a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%func_a = func(%2:i32):i32 { + $B1: { %3:i32 = access array<i32, 4>(0i), %2 ret %3 } } -%func_b = func(%5:i32):i32 -> %b2 { - %b2 = block { +%func_b = func(%5:i32):i32 { + $B2: { %6:i32 = access array<i32, 4>(0i), %5 ret %6 } } -%func_c = func(%8:i32):i32 -> %b3 { - %b3 = block { +%func_c = func(%8:i32):i32 { + $B3: { %9:i32 = access array<i32, 4>(0i), %8 ret %9 } @@ -762,26 +762,26 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, array<i32, 4>, read_write> = var, array<i32, 4>(0i) } -%func_a = func(%3:i32):i32 -> %b2 { - %b2 = block { +%func_a = func(%3:i32):i32 { + $B2: { %4:ptr<private, i32, read_write> = access %1, %3 %5:i32 = load %4 ret %5 } } -%func_b = func(%7:i32):i32 -> %b3 { - %b3 = block { +%func_b = func(%7:i32):i32 { + $B3: { %8:ptr<private, i32, read_write> = access %1, %7 %9:i32 = load %8 ret %9 } } -%func_c = func(%11:i32):i32 -> %b4 { - %b4 = block { +%func_c = func(%11:i32):i32 { + $B4: { %12:ptr<private, i32, read_write> = access %1, %11 %13:i32 = load %12 ret %13 @@ -820,20 +820,20 @@ }); auto* src = R"( -%func_a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%func_a = func(%2:i32):i32 { + $B1: { %3:i32 = access array<array<i32, 4>, 4>(array<i32, 4>(0i)), 0u, %2 ret %3 } } -%func_b = func(%5:i32):i32 -> %b2 { - %b2 = block { +%func_b = func(%5:i32):i32 { + $B2: { %6:i32 = access array<array<i32, 4>, 4>(array<i32, 4>(0i)), 0u, %5 ret %6 } } -%func_c = func(%8:i32):i32 -> %b3 { - %b3 = block { +%func_c = func(%8:i32):i32 { + $B3: { %9:i32 = access array<array<i32, 4>, 4>(array<i32, 4>(0i)), 0u, %8 ret %9 } @@ -842,26 +842,26 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, array<i32, 4>, read_write> = var, array<i32, 4>(0i) } -%func_a = func(%3:i32):i32 -> %b2 { - %b2 = block { +%func_a = func(%3:i32):i32 { + $B2: { %4:ptr<private, i32, read_write> = access %1, %3 %5:i32 = load %4 ret %5 } } -%func_b = func(%7:i32):i32 -> %b3 { - %b3 = block { +%func_b = func(%7:i32):i32 { + $B3: { %8:ptr<private, i32, read_write> = access %1, %7 %9:i32 = load %8 ret %9 } } -%func_c = func(%11:i32):i32 -> %b4 { - %b4 = block { +%func_c = func(%11:i32):i32 { + $B4: { %12:ptr<private, i32, read_write> = access %1, %11 %13:i32 = load %12 ret %13
diff --git a/src/tint/lang/wgsl/ast/transform/BUILD.cmake b/src/tint/lang/wgsl/ast/transform/BUILD.cmake index 13dc91b..9f17000 100644 --- a/src/tint/lang/wgsl/ast/transform/BUILD.cmake +++ b/src/tint/lang/wgsl/ast/transform/BUILD.cmake
@@ -251,11 +251,23 @@ lang/wgsl/ast/transform/add_block_attribute_fuzz.cc lang/wgsl/ast/transform/add_empty_entry_point_fuzz.cc lang/wgsl/ast/transform/array_length_from_uniform_fuzz.cc + lang/wgsl/ast/transform/binding_remapper_fuzz.cc + lang/wgsl/ast/transform/builtin_polyfill_fuzz.cc + lang/wgsl/ast/transform/canonicalize_entry_point_io_fuzz.cc + lang/wgsl/ast/transform/clamp_frag_depth_fuzz.cc + lang/wgsl/ast/transform/demote_to_helper_fuzz.cc + lang/wgsl/ast/transform/direct_variable_access_fuzz.cc + lang/wgsl/ast/transform/disable_uniformity_analysis_fuzz.cc + lang/wgsl/ast/transform/expand_compound_assignment_fuzz.cc + lang/wgsl/ast/transform/first_index_offset_fuzz.cc + lang/wgsl/ast/transform/fold_constants_fuzz.cc + lang/wgsl/ast/transform/multiplanar_external_texture_fuzz.cc lang/wgsl/ast/transform/zero_init_workgroup_memory_fuzz.cc ) tint_target_add_dependencies(tint_lang_wgsl_ast_transform_fuzz fuzz tint_api_common + tint_api_options tint_lang_core tint_lang_core_constant tint_lang_core_type
diff --git a/src/tint/lang/wgsl/ast/transform/BUILD.gn b/src/tint/lang/wgsl/ast/transform/BUILD.gn index 63bcb03..76bcf95 100644 --- a/src/tint/lang/wgsl/ast/transform/BUILD.gn +++ b/src/tint/lang/wgsl/ast/transform/BUILD.gn
@@ -241,10 +241,22 @@ "add_block_attribute_fuzz.cc", "add_empty_entry_point_fuzz.cc", "array_length_from_uniform_fuzz.cc", + "binding_remapper_fuzz.cc", + "builtin_polyfill_fuzz.cc", + "canonicalize_entry_point_io_fuzz.cc", + "clamp_frag_depth_fuzz.cc", + "demote_to_helper_fuzz.cc", + "direct_variable_access_fuzz.cc", + "disable_uniformity_analysis_fuzz.cc", + "expand_compound_assignment_fuzz.cc", + "first_index_offset_fuzz.cc", + "fold_constants_fuzz.cc", + "multiplanar_external_texture_fuzz.cc", "zero_init_workgroup_memory_fuzz.cc", ] deps = [ "${tint_src_dir}/api/common", + "${tint_src_dir}/api/options", "${tint_src_dir}/lang/core", "${tint_src_dir}/lang/core/constant", "${tint_src_dir}/lang/core/type",
diff --git a/src/tint/lang/wgsl/ast/transform/binding_remapper.cc b/src/tint/lang/wgsl/ast/transform/binding_remapper.cc index 31ef518..5501dd5 100644 --- a/src/tint/lang/wgsl/ast/transform/binding_remapper.cc +++ b/src/tint/lang/wgsl/ast/transform/binding_remapper.cc
@@ -47,6 +47,7 @@ namespace tint::ast::transform { +BindingRemapper::Remappings::Remappings() = default; BindingRemapper::Remappings::Remappings(BindingPoints bp, AccessControls ac, bool may_collide) : binding_points(std::move(bp)), access_controls(std::move(ac)),
diff --git a/src/tint/lang/wgsl/ast/transform/binding_remapper.h b/src/tint/lang/wgsl/ast/transform/binding_remapper.h index a21a090..ff8785d 100644 --- a/src/tint/lang/wgsl/ast/transform/binding_remapper.h +++ b/src/tint/lang/wgsl/ast/transform/binding_remapper.h
@@ -33,6 +33,7 @@ #include "src/tint/api/common/binding_point.h" #include "src/tint/lang/core/access.h" #include "src/tint/lang/wgsl/ast/transform/transform.h" +#include "src/tint/utils/reflection/reflection.h" namespace tint::ast::transform { @@ -53,6 +54,9 @@ /// Data holds information about shader usage and constant buffer offsets. struct Remappings final : public Castable<Remappings, Data> { /// Constructor + Remappings(); + + /// Constructor /// @param bp a map of new binding points /// @param ac a map of new access controls /// @param may_collide If true, then validation will be disabled for @@ -66,14 +70,17 @@ ~Remappings() override; /// A map of old binding point to new binding point - const BindingPoints binding_points; + BindingPoints binding_points; /// A map of old binding point to new access controls - const AccessControls access_controls; + AccessControls access_controls; /// If true, then validation will be disabled for binding point collisions /// generated by this transform - const bool allow_collisions; + bool allow_collisions = false; + + /// Reflection for this class + TINT_REFLECT(Remappings, binding_points, access_controls, allow_collisions); }; /// Constructor
diff --git a/src/tint/lang/wgsl/ast/transform/binding_remapper_fuzz.cc b/src/tint/lang/wgsl/ast/transform/binding_remapper_fuzz.cc new file mode 100644 index 0000000..2f27549 --- /dev/null +++ b/src/tint/lang/wgsl/ast/transform/binding_remapper_fuzz.cc
@@ -0,0 +1,89 @@ +// Copyright 2024 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/api/common/binding_point.h" +#include "src/tint/cmd/fuzz/wgsl/fuzz.h" +#include "src/tint/lang/core/access.h" +#include "src/tint/lang/wgsl/ast/module.h" +#include "src/tint/lang/wgsl/ast/transform/binding_remapper.h" +#include "src/tint/lang/wgsl/sem/variable.h" + +namespace tint::ast::transform { +namespace { + +bool CanRun(const Program& program, const BindingRemapper::Remappings& remappings) { + if (!remappings.access_controls.empty()) { + // Changing access is likely to cause WGSL validation failures. Just skip these for now. + return false; + } + + if (!remappings.allow_collisions) { + Hashset<BindingPoint, 8> binding_points; + for (auto* global : program.AST().GlobalVariables()) { + if (auto* sem = program.Sem().Get<sem::GlobalVariable>(global)) { + if (auto binding_point = sem->Attributes().binding_point) { + binding_points.Add(binding_point.value()); + } + } + } + Hashset<BindingPoint, 8> new_binding_points; + for (auto& remapping : remappings.binding_points) { + if (binding_points.Remove(remapping.first)) { + if (!new_binding_points.Add(remapping.second)) { + return false; // Binding collision + } + } + } + for (auto& binding_point : new_binding_points) { + if (!binding_points.Add(binding_point)) { + return false; // Binding collision + } + } + } + return true; +} + +void BindingRemapperFuzzer(const Program& program, const BindingRemapper::Remappings& remappings) { + if (!CanRun(program, remappings)) { + return; + } + + DataMap inputs; + inputs.Add<BindingRemapper::Remappings>(std::move(remappings)); + + DataMap outputs; + if (auto result = BindingRemapper{}.Apply(program, inputs, outputs)) { + if (!result->IsValid()) { + TINT_ICE() << "BindingRemapper returned invalid program:\n" << result->Diagnostics(); + } + } +} + +} // namespace +} // namespace tint::ast::transform + +TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::BindingRemapperFuzzer);
diff --git a/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc b/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc index f82fe95..640af4d 100644 --- a/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc +++ b/src/tint/lang/wgsl/ast/transform/builtin_polyfill.cc
@@ -1602,6 +1602,7 @@ return State{src, *cfg}.Run(); } +BuiltinPolyfill::Config::Config() = default; BuiltinPolyfill::Config::Config(const Builtins& b) : builtins(b) {} BuiltinPolyfill::Config::Config(const Config&) = default; BuiltinPolyfill::Config::~Config() = default;
diff --git a/src/tint/lang/wgsl/ast/transform/builtin_polyfill.h b/src/tint/lang/wgsl/ast/transform/builtin_polyfill.h index bdbe157..6f999b1 100644 --- a/src/tint/lang/wgsl/ast/transform/builtin_polyfill.h +++ b/src/tint/lang/wgsl/ast/transform/builtin_polyfill.h
@@ -29,6 +29,7 @@ #define SRC_TINT_LANG_WGSL_AST_TRANSFORM_BUILTIN_POLYFILL_H_ #include "src/tint/lang/wgsl/ast/transform/transform.h" +#include "src/tint/utils/reflection/reflection.h" namespace tint::ast::transform { @@ -108,12 +109,43 @@ /// Should `pack4xU8Clamp()` be polyfilled? /// TODO(tint:1497): remove the option once the bug in DXC is fixed. bool pack_4xu8_clamp = false; + + /// Reflection for this struct + TINT_REFLECT(Builtins, + acosh, + asinh, + atanh, + bgra8unorm, + bitshift_modulo, + clamp_int, + count_leading_zeros, + count_trailing_zeros, + conv_f32_to_iu32, + extract_bits, + first_leading_bit, + first_trailing_bit, + fwidth_fine, + insert_bits, + int_div_mod, + precise_float_mod, + reflect_vec2_f32, + saturate, + sign_int, + texture_sample_base_clamp_to_edge_2d_f32, + quantize_to_vec_f16, + workgroup_uniform_load, + dot_4x8_packed, + pack_unpack_4x8, + pack_4xu8_clamp); }; /// Config is consumed by the BuiltinPolyfill transform. /// Config specifies the builtins that should be polyfilled. struct Config final : public Castable<Config, Data> { /// Constructor + Config(); + + /// Constructor /// @param b the list of builtins to polyfill explicit Config(const Builtins& b); @@ -124,7 +156,10 @@ ~Config() override; /// The builtins to polyfill - const Builtins builtins; + Builtins builtins; + + /// Reflection for this struct + TINT_REFLECT(Config, builtins); }; /// @copydoc Transform::Apply @@ -138,4 +173,11 @@ } // namespace tint::ast::transform +namespace tint { + +/// Level reflection information +TINT_REFLECT_ENUM_RANGE(ast::transform::BuiltinPolyfill::Level, kNone, kFull); + +} // namespace tint + #endif // SRC_TINT_LANG_WGSL_AST_TRANSFORM_BUILTIN_POLYFILL_H_
diff --git a/src/tint/lang/wgsl/ast/transform/builtin_polyfill_fuzz.cc b/src/tint/lang/wgsl/ast/transform/builtin_polyfill_fuzz.cc new file mode 100644 index 0000000..adce548 --- /dev/null +++ b/src/tint/lang/wgsl/ast/transform/builtin_polyfill_fuzz.cc
@@ -0,0 +1,49 @@ +// Copyright 2024 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/cmd/fuzz/wgsl/fuzz.h" +#include "src/tint/lang/wgsl/ast/transform/builtin_polyfill.h" + +namespace tint::ast::transform { +namespace { + +void BuiltinPolyfillFuzzer(const Program& program, const BuiltinPolyfill::Config& config) { + DataMap inputs; + inputs.Add<BuiltinPolyfill::Config>(std::move(config)); + + DataMap outputs; + if (auto result = BuiltinPolyfill{}.Apply(program, inputs, outputs)) { + if (!result->IsValid()) { + TINT_ICE() << "BuiltinPolyfill returned invalid program:\n" << result->Diagnostics(); + } + } +} + +} // namespace +} // namespace tint::ast::transform + +TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::BuiltinPolyfillFuzzer);
diff --git a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc index 3e2029b..e61f615 100644 --- a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc +++ b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.cc
@@ -1011,6 +1011,8 @@ return resolver::Resolve(b); } +CanonicalizeEntryPointIO::Config::Config() = default; + CanonicalizeEntryPointIO::Config::Config(ShaderStyle style, uint32_t sample_mask, bool emit_point_size,
diff --git a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.h b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.h index ddf761d..9899e3d 100644 --- a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.h +++ b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.h
@@ -32,6 +32,7 @@ #include "src/tint/lang/wgsl/ast/internal_attribute.h" #include "src/tint/lang/wgsl/ast/transform/transform.h" +#include "src/tint/utils/reflection/reflection.h" namespace tint::ast::transform { @@ -115,6 +116,9 @@ /// Configuration options for the transform. struct Config final : public Castable<Config, Data> { /// Constructor + Config(); + + /// Constructor /// @param style the approach to use for emitting shader IO. /// @param sample_mask an optional sample mask to combine with shader masks /// @param emit_vertex_point_size `true` to generate a pointsize builtin @@ -131,17 +135,24 @@ ~Config() override; /// The approach to use for emitting shader IO. - const ShaderStyle shader_style; + ShaderStyle shader_style = ShaderStyle::kSpirv; /// A fixed sample mask to combine into masks produced by fragment shaders. - const uint32_t fixed_sample_mask; + uint32_t fixed_sample_mask = 0xffffffff; /// Set to `true` to generate a pointsize builtin and have it set to 1.0 /// from all vertex shaders in the module. - const bool emit_vertex_point_size; + bool emit_vertex_point_size = false; /// Set to `true` to replace f16 IO types with f32 types and convert them. - const bool polyfill_f16_io = false; + bool polyfill_f16_io = false; + + /// Reflection for this struct + TINT_REFLECT(Config, + shader_style, + fixed_sample_mask, + emit_vertex_point_size, + polyfill_f16_io); }; /// HLSLWaveIntrinsic is an InternalAttribute that is used to decorate a stub function so that @@ -189,4 +200,11 @@ } // namespace tint::ast::transform +namespace tint { + +/// Reflection for ShaderStyle +TINT_REFLECT_ENUM_RANGE(ast::transform::CanonicalizeEntryPointIO::ShaderStyle, kSpirv, kHlsl); + +} // namespace tint + #endif // SRC_TINT_LANG_WGSL_AST_TRANSFORM_CANONICALIZE_ENTRY_POINT_IO_H_
diff --git a/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io_fuzz.cc b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io_fuzz.cc new file mode 100644 index 0000000..136291a --- /dev/null +++ b/src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io_fuzz.cc
@@ -0,0 +1,51 @@ +// Copyright 2024 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/cmd/fuzz/wgsl/fuzz.h" +#include "src/tint/lang/wgsl/ast/transform/canonicalize_entry_point_io.h" + +namespace tint::ast::transform { +namespace { + +void CanonicalizeEntryPointIOFuzzer(const Program& program, + const CanonicalizeEntryPointIO::Config& config) { + DataMap inputs; + inputs.Add<CanonicalizeEntryPointIO::Config>(std::move(config)); + + DataMap outputs; + if (auto result = CanonicalizeEntryPointIO{}.Apply(program, inputs, outputs)) { + if (!result->IsValid()) { + TINT_ICE() << "CanonicalizeEntryPointIO returned invalid program:\n" + << result->Diagnostics(); + } + } +} + +} // namespace +} // namespace tint::ast::transform + +TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::CanonicalizeEntryPointIOFuzzer);
diff --git a/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.cc b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.cc index 66bf672..44c1118 100644 --- a/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.cc +++ b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.cc
@@ -221,6 +221,7 @@ return State{src}.Run(inputs); } +ClampFragDepth::Config::Config() = default; ClampFragDepth::Config::Config(std::optional<tint::DepthRangeOffsets> off) : offsets(off) {} ClampFragDepth::Config::~Config() = default;
diff --git a/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.h b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.h index 03972a0..39a73f8 100644 --- a/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.h +++ b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth.h
@@ -30,6 +30,7 @@ #include "src/tint/api/options/depth_range_offsets.h" #include "src/tint/lang/wgsl/ast/transform/transform.h" +#include "src/tint/utils/reflection/reflection.h" namespace tint::ast::transform { @@ -73,6 +74,9 @@ /// Transform configuration options struct Config final : public Castable<Config, ast::transform::Data> { /// Constructor + Config(); + + /// Constructor /// @param off Offsets of the min_depth and max_depth push constants explicit Config(std::optional<tint::DepthRangeOffsets> off); @@ -81,6 +85,9 @@ /// Offsets of the min_depth and max_depth push constants std::optional<tint::DepthRangeOffsets> offsets; + + /// Reflection for this struct + TINT_REFLECT(Config, offsets); }; /// @copydoc ast::transform::Transform::Apply
diff --git a/src/tint/lang/wgsl/ast/transform/clamp_frag_depth_fuzz.cc b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth_fuzz.cc new file mode 100644 index 0000000..d2ef4c8 --- /dev/null +++ b/src/tint/lang/wgsl/ast/transform/clamp_frag_depth_fuzz.cc
@@ -0,0 +1,49 @@ +// Copyright 2024 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/cmd/fuzz/wgsl/fuzz.h" +#include "src/tint/lang/wgsl/ast/transform/clamp_frag_depth.h" + +namespace tint::ast::transform { +namespace { + +void ClampFragDepthFuzzer(const Program& program, const ClampFragDepth::Config& config) { + DataMap inputs; + inputs.Add<ClampFragDepth::Config>(std::move(config)); + + DataMap outputs; + if (auto result = ClampFragDepth{}.Apply(program, inputs, outputs)) { + if (!result->IsValid()) { + TINT_ICE() << "ClampFragDepth returned invalid program:\n" << result->Diagnostics(); + } + } +} + +} // namespace +} // namespace tint::ast::transform + +TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::ClampFragDepthFuzzer);
diff --git a/src/tint/lang/wgsl/ast/transform/demote_to_helper_fuzz.cc b/src/tint/lang/wgsl/ast/transform/demote_to_helper_fuzz.cc new file mode 100644 index 0000000..180ab67 --- /dev/null +++ b/src/tint/lang/wgsl/ast/transform/demote_to_helper_fuzz.cc
@@ -0,0 +1,46 @@ +// Copyright 2024 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/cmd/fuzz/wgsl/fuzz.h" +#include "src/tint/lang/wgsl/ast/transform/demote_to_helper.h" + +namespace tint::ast::transform { +namespace { + +void DemoteToHelperFuzzer(const Program& program) { + DataMap outputs; + if (auto result = DemoteToHelper{}.Apply(program, DataMap{}, outputs)) { + if (!result->IsValid()) { + TINT_ICE() << "DemoteToHelper returned invalid program:\n" << result->Diagnostics(); + } + } +} + +} // namespace +} // namespace tint::ast::transform + +TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::DemoteToHelperFuzzer);
diff --git a/src/tint/lang/wgsl/ast/transform/direct_variable_access.cc b/src/tint/lang/wgsl/ast/transform/direct_variable_access.cc index d92bfb0..44fc79b 100644 --- a/src/tint/lang/wgsl/ast/transform/direct_variable_access.cc +++ b/src/tint/lang/wgsl/ast/transform/direct_variable_access.cc
@@ -1203,6 +1203,7 @@ } }; +DirectVariableAccess::Config::Config() = default; DirectVariableAccess::Config::Config(const Options& opt) : options(opt) {} DirectVariableAccess::Config::~Config() = default;
diff --git a/src/tint/lang/wgsl/ast/transform/direct_variable_access.h b/src/tint/lang/wgsl/ast/transform/direct_variable_access.h index d1bb9fe..16af90d 100644 --- a/src/tint/lang/wgsl/ast/transform/direct_variable_access.h +++ b/src/tint/lang/wgsl/ast/transform/direct_variable_access.h
@@ -29,6 +29,7 @@ #define SRC_TINT_LANG_WGSL_AST_TRANSFORM_DIRECT_VARIABLE_ACCESS_H_ #include "src/tint/lang/wgsl/ast/transform/transform.h" +#include "src/tint/utils/reflection/reflection.h" namespace tint::ast::transform { @@ -57,19 +58,29 @@ bool transform_private = false; /// If true, then 'function' sub-object pointer arguments will be transformed. bool transform_function = false; + + /// Reflection for this struct + TINT_REFLECT(Options, transform_private, transform_function); }; /// Config is consumed by the DirectVariableAccess transform. /// Config specifies the behavior of the transform. struct Config final : public Castable<Config, Data> { /// Constructor + Config(); + + /// Constructor /// @param options behavior of the transform explicit Config(const Options& options); + /// Destructor ~Config() override; /// The transform behavior options - const Options options; + Options options; + + /// Reflection for this struct + TINT_REFLECT(Config, options); }; /// @copydoc Transform::Apply
diff --git a/src/tint/lang/wgsl/ast/transform/direct_variable_access_fuzz.cc b/src/tint/lang/wgsl/ast/transform/direct_variable_access_fuzz.cc new file mode 100644 index 0000000..5123798 --- /dev/null +++ b/src/tint/lang/wgsl/ast/transform/direct_variable_access_fuzz.cc
@@ -0,0 +1,51 @@ +// Copyright 2024 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/cmd/fuzz/wgsl/fuzz.h" +#include "src/tint/lang/wgsl/ast/transform/direct_variable_access.h" + +namespace tint::ast::transform { +namespace { + +void DirectVariableAccessFuzzer(const Program& program, + const DirectVariableAccess::Config& config) { + DataMap inputs; + inputs.Add<DirectVariableAccess::Config>(std::move(config)); + + DataMap outputs; + if (auto result = DirectVariableAccess{}.Apply(program, inputs, outputs)) { + if (!result->IsValid()) { + TINT_ICE() << "DirectVariableAccess returned invalid program:\n" + << result->Diagnostics(); + } + } +} + +} // namespace +} // namespace tint::ast::transform + +TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::DirectVariableAccessFuzzer);
diff --git a/src/tint/lang/wgsl/ast/transform/disable_uniformity_analysis_fuzz.cc b/src/tint/lang/wgsl/ast/transform/disable_uniformity_analysis_fuzz.cc new file mode 100644 index 0000000..378eb5f --- /dev/null +++ b/src/tint/lang/wgsl/ast/transform/disable_uniformity_analysis_fuzz.cc
@@ -0,0 +1,47 @@ +// Copyright 2024 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/cmd/fuzz/wgsl/fuzz.h" +#include "src/tint/lang/wgsl/ast/transform/disable_uniformity_analysis.h" + +namespace tint::ast::transform { +namespace { + +void DisableUniformityAnalysisFuzzer(const Program& program) { + DataMap outputs; + if (auto result = DisableUniformityAnalysis{}.Apply(program, DataMap{}, outputs)) { + if (!result->IsValid()) { + TINT_ICE() << "DisableUniformityAnalysis returned invalid program:\n" + << result->Diagnostics(); + } + } +} + +} // namespace +} // namespace tint::ast::transform + +TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::DisableUniformityAnalysisFuzzer);
diff --git a/src/tint/lang/wgsl/ast/transform/expand_compound_assignment_fuzz.cc b/src/tint/lang/wgsl/ast/transform/expand_compound_assignment_fuzz.cc new file mode 100644 index 0000000..d017dbb --- /dev/null +++ b/src/tint/lang/wgsl/ast/transform/expand_compound_assignment_fuzz.cc
@@ -0,0 +1,47 @@ +// Copyright 2024 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/cmd/fuzz/wgsl/fuzz.h" +#include "src/tint/lang/wgsl/ast/transform/expand_compound_assignment.h" + +namespace tint::ast::transform { +namespace { + +void ExpandCompoundAssignmentFuzzer(const Program& program) { + DataMap outputs; + if (auto result = ExpandCompoundAssignment{}.Apply(program, DataMap{}, outputs)) { + if (!result->IsValid()) { + TINT_ICE() << "ExpandCompoundAssignment returned invalid program:\n" + << result->Diagnostics(); + } + } +} + +} // namespace +} // namespace tint::ast::transform + +TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::ExpandCompoundAssignmentFuzzer);
diff --git a/src/tint/lang/wgsl/ast/transform/first_index_offset.cc b/src/tint/lang/wgsl/ast/transform/first_index_offset.cc index 399bb2a..a7d912c 100644 --- a/src/tint/lang/wgsl/ast/transform/first_index_offset.cc +++ b/src/tint/lang/wgsl/ast/transform/first_index_offset.cc
@@ -69,6 +69,7 @@ FirstIndexOffset::BindingPoint::BindingPoint(uint32_t b, uint32_t g) : binding(b), group(g) {} FirstIndexOffset::BindingPoint::~BindingPoint() = default; +FirstIndexOffset::Data::Data() = default; FirstIndexOffset::Data::Data(bool has_vtx_index, bool has_inst_index) : has_vertex_index(has_vtx_index), has_instance_index(has_inst_index) {} FirstIndexOffset::Data::Data(const Data&) = default;
diff --git a/src/tint/lang/wgsl/ast/transform/first_index_offset.h b/src/tint/lang/wgsl/ast/transform/first_index_offset.h index c943d8b..c414485 100644 --- a/src/tint/lang/wgsl/ast/transform/first_index_offset.h +++ b/src/tint/lang/wgsl/ast/transform/first_index_offset.h
@@ -28,7 +28,9 @@ #ifndef SRC_TINT_LANG_WGSL_AST_TRANSFORM_FIRST_INDEX_OFFSET_H_ #define SRC_TINT_LANG_WGSL_AST_TRANSFORM_FIRST_INDEX_OFFSET_H_ +#include "src/tint/lang/wgsl/ast/transform/binding_remapper.h" #include "src/tint/lang/wgsl/ast/transform/transform.h" +#include "src/tint/utils/reflection/reflection.h" namespace tint::ast::transform { @@ -91,12 +93,18 @@ uint32_t binding = 0; /// `@group()` for the first vertex / first instance uniform buffer uint32_t group = 0; + + /// Reflection for this struct + TINT_REFLECT(BindingPoint, binding, group); }; /// Data is outputted by the FirstIndexOffset transform. /// Data holds information about shader usage and constant buffer offsets. struct Data final : public Castable<Data, transform::Data> { /// Constructor + Data(); + + /// Constructor /// @param has_vtx_index True if the shader uses vertex_index /// @param has_inst_index True if the shader uses instance_index Data(bool has_vtx_index, bool has_inst_index); @@ -108,9 +116,12 @@ ~Data() override; /// True if the shader uses vertex_index - const bool has_vertex_index; + bool has_vertex_index = false; /// True if the shader uses instance_index - const bool has_instance_index; + bool has_instance_index = false; + + /// Reflection for this struct + TINT_REFLECT(Data, has_vertex_index, has_instance_index); }; /// Constructor
diff --git a/src/tint/lang/wgsl/ast/transform/first_index_offset_fuzz.cc b/src/tint/lang/wgsl/ast/transform/first_index_offset_fuzz.cc new file mode 100644 index 0000000..b7ed12e --- /dev/null +++ b/src/tint/lang/wgsl/ast/transform/first_index_offset_fuzz.cc
@@ -0,0 +1,70 @@ +// Copyright 2024 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/api/common/binding_point.h" +#include "src/tint/cmd/fuzz/wgsl/fuzz.h" +#include "src/tint/lang/wgsl/ast/module.h" +#include "src/tint/lang/wgsl/ast/transform/first_index_offset.h" +#include "src/tint/lang/wgsl/sem/variable.h" + +namespace tint::ast::transform { +namespace { + +bool CanRun(const Program& program, const FirstIndexOffset::BindingPoint& binding_point) { + for (auto& global : program.AST().GlobalVariables()) { + if (auto* sem = program.Sem().Get<sem::GlobalVariable>(global)) { + if (sem->Attributes().binding_point == + BindingPoint{binding_point.group, binding_point.binding}) { + // Might cause binding point collision + return false; + } + } + } + return true; +} + +void FirstIndexOffsetFuzzer(const Program& program, + const FirstIndexOffset::BindingPoint& binding_point) { + if (!CanRun(program, binding_point)) { + return; + } + + DataMap inputs; + inputs.Add<FirstIndexOffset::BindingPoint>(std::move(binding_point)); + + DataMap outputs; + if (auto result = FirstIndexOffset{}.Apply(program, inputs, outputs)) { + if (!result->IsValid()) { + TINT_ICE() << "FirstIndexOffset returned invalid program:\n" << result->Diagnostics(); + } + } +} + +} // namespace +} // namespace tint::ast::transform + +TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::FirstIndexOffsetFuzzer);
diff --git a/src/tint/lang/wgsl/ast/transform/fold_constants_fuzz.cc b/src/tint/lang/wgsl/ast/transform/fold_constants_fuzz.cc new file mode 100644 index 0000000..4c48a90 --- /dev/null +++ b/src/tint/lang/wgsl/ast/transform/fold_constants_fuzz.cc
@@ -0,0 +1,46 @@ +// Copyright 2024 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/cmd/fuzz/wgsl/fuzz.h" +#include "src/tint/lang/wgsl/ast/transform/fold_constants.h" + +namespace tint::ast::transform { +namespace { + +void FoldConstantsFuzzer(const Program& program) { + DataMap outputs; + if (auto result = FoldConstants{}.Apply(program, DataMap{}, outputs)) { + if (!result->IsValid()) { + TINT_ICE() << "FoldConstants returned invalid program:\n" << result->Diagnostics(); + } + } +} + +} // namespace +} // namespace tint::ast::transform + +TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::FoldConstantsFuzzer);
diff --git a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc index f1bd0c3..3d7450b 100644 --- a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc +++ b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.cc
@@ -531,6 +531,7 @@ } }; +MultiplanarExternalTexture::NewBindingPoints::NewBindingPoints() = default; MultiplanarExternalTexture::NewBindingPoints::NewBindingPoints(BindingsMap inputBindingsMap, bool may_collide) : bindings_map(std::move(inputBindingsMap)), allow_collisions(may_collide) {}
diff --git a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.h b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.h index 3395047..d9ed67a 100644 --- a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.h +++ b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.h
@@ -36,6 +36,7 @@ #include "src/tint/lang/core/builtin_fn.h" #include "src/tint/lang/wgsl/ast/struct_member.h" #include "src/tint/lang/wgsl/ast/transform/transform.h" +#include "src/tint/utils/reflection/reflection.h" namespace tint::ast::transform { @@ -66,8 +67,11 @@ /// which binding slots it should expand into. struct NewBindingPoints final : public Castable<NewBindingPoints, Data> { /// Constructor + NewBindingPoints(); + + /// Constructor /// @param bm a map to the new binding slots to use. - /// /// @param may_collide if true, then validation will be disabled for binding point + /// @param may_collide if true, then validation will be disabled for binding point /// collisions generated by this transform explicit NewBindingPoints(BindingsMap bm, bool may_collide = false); @@ -75,11 +79,14 @@ ~NewBindingPoints() override; /// A map of new binding points to use. - const BindingsMap bindings_map; + BindingsMap bindings_map; /// If true, then validation will be disabled for bindign poitn collisions generated by this /// transform. - const bool allow_collisions = false; + bool allow_collisions = false; + + /// Reflection for this struct + TINT_REFLECT(NewBindingPoints, bindings_map, allow_collisions); }; /// Constructor
diff --git a/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture_fuzz.cc b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture_fuzz.cc new file mode 100644 index 0000000..caddb35 --- /dev/null +++ b/src/tint/lang/wgsl/ast/transform/multiplanar_external_texture_fuzz.cc
@@ -0,0 +1,106 @@ +// Copyright 2024 The Dawn & Tint Authors +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "src/tint/api/common/binding_point.h" +#include "src/tint/cmd/fuzz/wgsl/fuzz.h" +#include "src/tint/lang/core/type/external_texture.h" +#include "src/tint/lang/wgsl/ast/module.h" +#include "src/tint/lang/wgsl/ast/transform/multiplanar_external_texture.h" +#include "src/tint/lang/wgsl/sem/variable.h" + +namespace tint::ast::transform { +namespace { + +bool CanRun(const Program& program, + const MultiplanarExternalTexture::NewBindingPoints& remappings) { + Hashset<BindingPoint, 8> all_binding_points; + for (auto* global : program.AST().GlobalVariables()) { + if (auto* sem = program.Sem().Get<sem::GlobalVariable>(global)) { + if (auto binding_point = sem->Attributes().binding_point) { + if (sem->Type()->UnwrapPtrOrRef()->Is<core::type::ExternalTexture>() && + remappings.bindings_map.find(binding_point.value()) == + remappings.bindings_map.end()) { + // Missing entry for external texture + return false; + } + + all_binding_points.Add(binding_point.value()); + } + } + } + + if (!remappings.allow_collisions) { + for (auto* global : program.AST().GlobalVariables()) { + if (auto* sem = program.Sem().Get<sem::GlobalVariable>(global)) { + if (auto binding_point = sem->Attributes().binding_point) { + all_binding_points.Add(binding_point.value()); + } + } + } + Hashset<BindingPoint, 8> new_binding_points; + for (auto& remapping : remappings.bindings_map) { + if (all_binding_points.Remove(remapping.first)) { + if (!new_binding_points.Add(remapping.second.params)) { + return false; // Binding collision + } + if (!new_binding_points.Add(remapping.second.plane_1)) { + return false; // Binding collision + } + } + } + for (auto& binding_point : new_binding_points) { + if (!all_binding_points.Add(binding_point)) { + return false; // Binding collision + } + } + } + return true; +} + +void MultiplanarExternalTextureFuzzer( + const Program& program, + const MultiplanarExternalTexture::NewBindingPoints& binding_points) { + if (!CanRun(program, binding_points)) { + return; + } + + DataMap inputs; + inputs.Add<MultiplanarExternalTexture::NewBindingPoints>(std::move(binding_points)); + + DataMap outputs; + if (auto result = MultiplanarExternalTexture{}.Apply(program, inputs, outputs)) { + if (!result->IsValid()) { + TINT_ICE() << "MultiplanarExternalTexture returned invalid program:\n" + << result->Diagnostics(); + } + } +} + +} // namespace +} // namespace tint::ast::transform + +TINT_WGSL_PROGRAM_FUZZER(tint::ast::transform::MultiplanarExternalTextureFuzzer);
diff --git a/src/tint/lang/wgsl/reader/lower/lower_test.cc b/src/tint/lang/wgsl/reader/lower/lower_test.cc index ba73688..4a0c91c 100644 --- a/src/tint/lang/wgsl/reader/lower/lower_test.cc +++ b/src/tint/lang/wgsl/reader/lower/lower_test.cc
@@ -55,8 +55,8 @@ }); auto* src = R"( -%f = func():void -> %b1 { - %b1 = block { +%f = func():void { + $B1: { %2:i32 = wgsl.max 1i, 2i ret } @@ -65,8 +65,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():void -> %b1 { - %b1 = block { +%f = func():void { + $B1: { %2:i32 = max 1i, 2i ret } @@ -91,12 +91,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:i32 = wgsl.workgroupUniformLoad %wgvar ret %3 } @@ -105,12 +105,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %wgvar:ptr<workgroup, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:void = workgroupBarrier %4:i32 = load %wgvar %5:void = workgroupBarrier
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/accessor_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/accessor_test.cc index b763ef9..cb5294e 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/accessor_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/accessor_test.cc
@@ -54,8 +54,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, array<u32, 3>, read_write> = var %3:ptr<function, u32, read_write> = access %a, 2u %4:u32 = load %3 @@ -80,8 +80,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, array<u32, 3>, read_write> = var %p:ptr<function, array<u32, 3>, read_write> = let %a %4:ptr<function, u32, read_write> = access %p, 2u @@ -107,8 +107,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, array<u32, 3>, read_write> = var %p:ptr<function, array<u32, 3>, read_write> = let %a %4:ptr<function, u32, read_write> = access %p, 2u @@ -135,8 +135,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:vec3<u32> = let vec3<u32>(0u) %3:u32 = access %a, 2u %b:u32 = let %3 @@ -160,8 +160,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, vec3<u32>, read_write> = var %3:u32 = load_vector_element %a, 2u %b:u32 = let %3 @@ -185,8 +185,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, vec3<u32>, read_write> = var %p:ptr<function, vec3<u32>, read_write> = let %a %4:u32 = load_vector_element %p, 2u @@ -211,8 +211,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, vec3<u32>, read_write> = var %p:ptr<function, vec3<u32>, read_write> = let %a %4:u32 = load_vector_element %p, 2u @@ -235,8 +235,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, array<array<f32, 4>, 3>, read_write> = var %3:ptr<function, f32, read_write> = access %a, 2u, 3u %4:f32 = load %3 @@ -261,8 +261,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, array<array<f32, 4>, 3>, read_write> = var %p:ptr<function, array<array<f32, 4>, 3>, read_write> = let %a %4:ptr<function, f32, read_write> = access %p, 2u, 3u @@ -288,8 +288,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, array<array<f32, 4>, 3>, read_write> = var %p:ptr<function, array<array<f32, 4>, 3>, read_write> = let %a %4:ptr<function, f32, read_write> = access %p, 2u, 3u @@ -313,8 +313,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, mat3x4<f32>, read_write> = var %3:ptr<function, vec4<f32>, read_write> = access %a, 2u %4:f32 = load_vector_element %3, 3u @@ -345,8 +345,8 @@ foo:i32 @offset(0) } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, MyStruct, read_write> = var %3:ptr<function, i32, read_write> = access %a, 0u %4:i32 = load %3 @@ -379,8 +379,8 @@ foo:i32 @offset(0) } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, MyStruct, read_write> = var %p:ptr<function, MyStruct, read_write> = let %a %4:ptr<function, i32, read_write> = access %p, 0u @@ -414,8 +414,8 @@ foo:i32 @offset(0) } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, MyStruct, read_write> = var %p:ptr<function, MyStruct, read_write> = let %a %4:ptr<function, i32, read_write> = access %p, 0u @@ -457,8 +457,8 @@ foo:Inner @offset(4) } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, Outer, read_write> = var %3:ptr<function, f32, read_write> = access %a, 1u, 0u %4:f32 = load %3 @@ -505,8 +505,8 @@ foo:array<Inner, 4> @offset(16) } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, array<Outer, 4>, read_write> = var %3:ptr<function, vec4<f32>, read_write> = access %a, 0u, 1u, 1u, 2u %4:vec4<f32> = load %3 @@ -529,8 +529,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, array<u32, 4>, read_write> = var %3:ptr<function, u32, read_write> = access %a, 2u store %3, 0u @@ -552,8 +552,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, vec2<f32>, read_write> = var %3:f32 = load_vector_element %a, 1u %b:f32 = let %3 @@ -577,8 +577,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, vec2<f32>, read_write> = var %p:ptr<function, vec2<f32>, read_write> = let %a %4:f32 = load_vector_element %p, 1u @@ -603,8 +603,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, vec2<f32>, read_write> = var %p:ptr<function, vec2<f32>, read_write> = let %a %4:f32 = load_vector_element %p, 1u @@ -627,8 +627,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, vec3<f32>, read_write> = var %3:vec3<f32> = load %a %4:vec4<f32> = swizzle %3, zyxz @@ -651,8 +651,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, vec3<f32>, read_write> = var %3:vec3<f32> = load %a %4:vec3<f32> = swizzle %3, zyx @@ -688,8 +688,8 @@ foo:vec4<f32> @offset(16) } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, MyStruct, read_write> = var %3:ptr<function, vec4<f32>, read_write> = access %a, 1u %4:vec4<f32> = load %3 @@ -714,8 +714,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:vec3<u32> = let vec3<u32>(0u) %3:u32 = access %a, 2u %b:u32 = let %3 @@ -737,8 +737,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:mat3x4<f32> = let mat3x4<f32>(vec4<f32>(0.0f)) %3:f32 = access %a, 2u, 3u %b:f32 = let %3 @@ -768,8 +768,8 @@ foo:i32 @offset(0) } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:MyStruct = let MyStruct(0i) %3:i32 = access %a, 0u %b:i32 = let %3 @@ -809,8 +809,8 @@ foo:Inner @offset(4) } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:Outer = let Outer(0i, Inner(0.0f)) %3:f32 = access %a, 1u, 0u %b:f32 = let %3 @@ -856,8 +856,8 @@ foo:array<Inner, 4> @offset(16) } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:array<Outer, 4> = let array<Outer, 4>(Outer(0i, array<Inner, 4>(Inner(0i, 0.0f, vec4<f32>(0.0f))))) %3:vec4<f32> = access %a, 0u, 1u, 1u, 2u %b:vec4<f32> = let %3 @@ -879,8 +879,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:vec2<f32> = let vec2<f32>(0.0f) %3:f32 = access %a, 1u %b:f32 = let %3 @@ -902,8 +902,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:vec3<f32> = let vec3<f32>(0.0f) %3:vec4<f32> = swizzle %a, zyxz %b:vec4<f32> = let %3 @@ -925,8 +925,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:vec3<f32> = let vec3<f32>(0.0f) %3:vec3<f32> = swizzle %a, zyx %4:vec2<f32> = swizzle %3, yy @@ -961,8 +961,8 @@ foo:vec4<f32> @offset(16) } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:MyStruct = let MyStruct(0i, vec4<f32>(0.0f)) %3:vec4<f32> = access %a, 1u %4:vec3<f32> = swizzle %3, zyx @@ -989,8 +989,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %i:i32 = let 1i %3:i32 = access vec3<i32>(1i, 2i, 3i), %i %b:ptr<function, i32, read_write> = var, %3 @@ -1014,8 +1014,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %i:i32 = let 1i %3:i32 = access vec2<i32>(1i, 2i), %i %b:ptr<function, i32, read_write> = var, %3 @@ -1039,8 +1039,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %i:i32 = let 1i %3:i32 = add %i, 2i %4:i32 = sub %3, 3i
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/binary_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/binary_test.cc index 9903836..79b7366 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/binary_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/binary_test.cc
@@ -46,13 +46,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:u32 = add %3, 4u %tint_symbol:u32 = let %4 @@ -70,12 +70,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, u32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = load %v1 %4:u32 = add %3, 1u store %v1, %4 @@ -93,12 +93,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, u32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = load %v1 %4:u32 = add %3, 1u store %v1, %4 @@ -116,13 +116,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:u32 = sub %3, 4u %tint_symbol:u32 = let %4 @@ -140,12 +140,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, i32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:i32 = load %v1 %4:i32 = sub %3, 1i store %v1, %4 @@ -163,12 +163,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, u32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = load %v1 %4:u32 = sub %3, 1u store %v1, %4 @@ -186,13 +186,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:u32 = mul %3, 4u %tint_symbol:u32 = let %4 @@ -210,12 +210,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, u32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = load %v1 %4:u32 = mul %3, 1u store %v1, %4 @@ -233,13 +233,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:u32 = div %3, 4u %tint_symbol:u32 = let %4 @@ -257,12 +257,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, u32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = load %v1 %4:u32 = div %3, 1u store %v1, %4 @@ -280,13 +280,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:u32 = mod %3, 4u %tint_symbol:u32 = let %4 @@ -304,12 +304,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, u32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = load %v1 %4:u32 = mod %3, 1u store %v1, %4 @@ -327,13 +327,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:u32 = and %3, 4u %tint_symbol:u32 = let %4 @@ -351,12 +351,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, bool, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:bool = load %v1 %4:bool = and %3, false store %v1, %4 @@ -374,13 +374,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:u32 = or %3, 4u %tint_symbol:u32 = let %4 @@ -398,12 +398,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, bool, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:bool = load %v1 %4:bool = or %3, false store %v1, %4 @@ -421,13 +421,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:u32 = xor %3, 4u %tint_symbol:u32 = let %4 @@ -445,12 +445,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, u32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = load %v1 %4:u32 = xor %3, 1u store %v1, %4 @@ -469,25 +469,25 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool { + $B1: { ret true } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:bool = call %my_func - %4:bool = if %3 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + %4:bool = if %3 [t: $B3, f: $B4] { # if_1 + $B3: { # true exit_if false # if_1 } - %b4 = block { # false + $B4: { # false exit_if false # if_1 } } %logical_and:bool = let %4 - if %logical_and [t: %b5] { # if_2 - %b5 = block { # true + if %logical_and [t: $B5] { # if_2 + $B5: { # true exit_if # if_2 } } @@ -506,25 +506,25 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool { + $B1: { ret true } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:bool = call %my_func - %4:bool = if %3 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + %4:bool = if %3 [t: $B3, f: $B4] { # if_1 + $B3: { # true exit_if true # if_1 } - %b4 = block { # false + $B4: { # false exit_if true # if_1 } } %logical_or:bool = let %4 - if %logical_or [t: %b5] { # if_2 - %b5 = block { # true + if %logical_or [t: $B5] { # if_2 + $B5: { # true exit_if # if_2 } } @@ -542,13 +542,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:bool = eq %3, 4u %tint_symbol:bool = let %4 @@ -566,13 +566,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:bool = neq %3, 4u %tint_symbol:bool = let %4 @@ -590,13 +590,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:bool = lt %3, 4u %tint_symbol:bool = let %4 @@ -614,13 +614,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:bool = gt %3, 4u %tint_symbol:bool = let %4 @@ -638,13 +638,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:bool = lte %3, 4u %tint_symbol:bool = let %4 @@ -662,13 +662,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:bool = gte %3, 4u %tint_symbol:bool = let %4 @@ -686,13 +686,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:u32 = shl %3, 4u %tint_symbol:u32 = let %4 @@ -710,12 +710,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, u32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = load %v1 %4:u32 = shl %3, 1u store %v1, %4 @@ -733,13 +733,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 0u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:u32 = shr %3, 4u %tint_symbol:u32 = let %4 @@ -757,12 +757,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, u32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = load %v1 %4:u32 = shr %3, 1u store %v1, %4 @@ -782,17 +782,17 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():f32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():f32 { + $B1: { ret 0.0f } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:f32 = call %my_func %4:bool = lt %3, 2.0f - %5:bool = if %4 [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + %5:bool = if %4 [t: $B3, f: $B4] { # if_1 + $B3: { # true %6:f32 = call %my_func %7:f32 = call %my_func %8:f32 = mul 2.29999995231628417969f, %7 @@ -800,7 +800,7 @@ %10:bool = gt 2.5f, %9 exit_if %10 # if_1 } - %b4 = block { # false + $B4: { # false exit_if false # if_1 } } @@ -820,13 +820,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func(%p:bool):bool -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func(%p:bool):bool { + $B1: { ret true } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %4:bool = call %my_func, false %tint_symbol:bool = let %4 ret
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/builtin_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/builtin_test.cc index fecb029..7423f12 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/builtin_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/builtin_test.cc
@@ -46,12 +46,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %i:ptr<private, f32, read_write> = var, 1.0f } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:f32 = load %i %4:f32 = asin %3 %tint_symbol:f32 = let %4
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/call_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/call_test.cc index a024c57..eb3dac7 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/call_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/call_test.cc
@@ -48,13 +48,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():f32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():f32 { + $B1: { ret 0.0f } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:f32 = call %my_func %4:f32 = bitcast %3 %tint_symbol:f32 = let %4 @@ -74,8 +74,8 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%test_function = @fragment func():void -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%test_function = @fragment func():void { + $B1: { discard ret } @@ -91,13 +91,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func(%p:f32):void -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func(%p:f32):void { + $B1: { ret } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %4:void = call %my_func, 6.0f ret } @@ -113,12 +113,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %i:ptr<private, i32, read_write> = var, 1i } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:i32 = load %i %4:f32 = convert %3 %tint_symbol:f32 = let %4 @@ -135,7 +135,7 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %i:ptr<private, vec3<f32>, read_write> = var, vec3<f32>(0.0f) } @@ -150,12 +150,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %i:ptr<private, f32, read_write> = var, 1.0f } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:f32 = load %i %4:vec3<f32> = construct 2.0f, 3.0f, %3 %tint_symbol:vec3<f32> = let %4
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/function_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/function_test.cc index da4dd6b..1af67b1 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/function_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/function_test.cc
@@ -47,8 +47,8 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%test = @vertex func():vec4<f32> [@position] -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%test = @vertex func():vec4<f32> [@position] { + $B1: { ret vec4<f32>(0.0f) } } @@ -62,8 +62,8 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%test = @fragment func():void -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%test = @fragment func():void { + $B1: { ret } } @@ -78,8 +78,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test = @compute @workgroup_size(8, 4, 2) func():void -> %b1 { - %b1 = block { + R"(%test = @compute @workgroup_size(8, 4, 2) func():void { + $B1: { ret } } @@ -93,8 +93,8 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():vec3<f32> -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():vec3<f32> { + $B1: { ret vec3<f32>(0.0f) } } @@ -108,13 +108,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():f32 -> %b1 { - %b1 = block { - if true [t: %b2, f: %b3] { # if_1 - %b2 = block { # true + EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():f32 { + $B1: { + if true [t: $B2, f: $B3] { # if_1 + $B2: { # true ret 0.0f } - %b3 = block { # false + $B3: { # false ret 1.0f } } @@ -132,8 +132,8 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%test = @vertex func():vec4<f32> [@position] -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%test = @vertex func():vec4<f32> [@position] { + $B1: { ret vec4<f32>(1.0f, 2.0f, 3.0f, 4.0f) } } @@ -149,8 +149,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test = @vertex func():vec4<f32> [@invariant, @position] -> %b1 { - %b1 = block { + R"(%test = @vertex func():vec4<f32> [@invariant, @position] { + $B1: { ret vec4<f32>(1.0f, 2.0f, 3.0f, 4.0f) } } @@ -165,8 +165,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test = @fragment func():vec4<f32> [@location(1)] -> %b1 { - %b1 = block { + R"(%test = @fragment func():vec4<f32> [@location(1)] { + $B1: { ret vec4<f32>(1.0f, 2.0f, 3.0f, 4.0f) } } @@ -182,10 +182,9 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ( - Disassemble(m.Get()), - R"(%test = @fragment func():vec4<f32> [@location(1), @interpolate(linear, centroid)] -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), + R"(%test = @fragment func():vec4<f32> [@location(1), @interpolate(linear, centroid)] { + $B1: { ret vec4<f32>(1.0f, 2.0f, 3.0f, 4.0f) } } @@ -200,8 +199,8 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%test = @fragment func():f32 [@frag_depth] -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%test = @fragment func():f32 [@frag_depth] { + $B1: { ret 1.0f } } @@ -216,8 +215,8 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%test = @fragment func():u32 [@sample_mask] -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%test = @fragment func():u32 [@sample_mask] { + $B1: { ret 1u } }
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/let_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/let_test.cc index bfce845..8b67280 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/let_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/let_test.cc
@@ -45,8 +45,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:i32 = let 42i ret } @@ -61,8 +61,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:i32 = let 3i ret } @@ -79,8 +79,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:i32 = let 1i %b:i32 = let %a %c:i32 = let %b
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/materialize_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/materialize_test.cc index 6891335..7b1b1e6 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/materialize_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/materialize_test.cc
@@ -46,8 +46,8 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%test_function = func():f32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%test_function = func():f32 { + $B1: { ret 2.0f } }
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir_test.cc index f8f2d0a..466498e 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/program_to_ir_test.cc
@@ -83,8 +83,8 @@ EXPECT_EQ(m->functions[0]->Stage(), core::ir::Function::PipelineStage::kUndefined); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():void -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():void { + $B1: { ret } } @@ -104,8 +104,8 @@ EXPECT_EQ(m->functions[0]->Stage(), core::ir::Function::PipelineStage::kUndefined); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func(%a:u32):u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func(%a:u32):u32 { + $B1: { ret %a } } @@ -126,8 +126,8 @@ EXPECT_EQ(m->functions[0]->Stage(), core::ir::Function::PipelineStage::kUndefined); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func(%a:u32, %b:i32, %c:bool):void -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func(%a:u32, %b:i32, %c:bool):void { + $B1: { ret } } @@ -155,13 +155,13 @@ ASSERT_EQ(1u, m.functions.Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - if true [t: %b2, f: %b3] { # if_1 - %b2 = block { # true + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + if true [t: $B2, f: $B3] { # if_1 + $B2: { # true exit_if # if_1 } - %b3 = block { # false + $B3: { # false exit_if # if_1 } } @@ -183,10 +183,10 @@ ASSERT_EQ(1u, m.functions.Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - if true [t: %b2] { # if_1 - %b2 = block { # true + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + if true [t: $B2] { # if_1 + $B2: { # true ret } } @@ -208,13 +208,13 @@ ASSERT_EQ(1u, m.functions.Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - if true [t: %b2, f: %b3] { # if_1 - %b2 = block { # true + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + if true [t: $B2, f: $B3] { # if_1 + $B2: { # true exit_if # if_1 } - %b3 = block { # false + $B3: { # false ret } } @@ -236,13 +236,13 @@ ASSERT_EQ(1u, m.functions.Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - if true [t: %b2, f: %b3] { # if_1 - %b2 = block { # true + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + if true [t: $B2, f: $B3] { # if_1 + $B2: { # true ret } - %b3 = block { # false + $B3: { # false ret } } @@ -263,12 +263,12 @@ auto m = res.Move(); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - if true [t: %b2] { # if_1 - %b2 = block { # true - loop [b: %b3] { # loop_1 - %b3 = block { # body + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + if true [t: $B2] { # if_1 + $B2: { # true + loop [b: $B3] { # loop_1 + $B3: { # body exit_loop # loop_1 } } @@ -297,10 +297,10 @@ EXPECT_EQ(0u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block { # body + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2] { # loop_1 + $B2: { # body exit_loop # loop_1 } } @@ -327,19 +327,19 @@ EXPECT_EQ(1u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - if true [t: %b4] { # if_1 - %b4 = block { # true + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + if true [t: $B4] { # if_1 + $B4: { # true exit_loop # loop_1 } } - continue %b3 + continue # -> $B3 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } ret @@ -365,14 +365,14 @@ EXPECT_EQ(1u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - continue %b3 + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + continue # -> $B3 } - %b3 = block { # continuing - break_if true %b2 + $B3: { # continuing + break_if true # -> [t: exit_loop loop_1, f: $B2] } } ret @@ -392,15 +392,15 @@ auto m = res.Move(); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body %a:bool = let true - continue %b3 + continue # -> $B3 } - %b3 = block { # continuing - break_if %a %b2 + $B3: { # continuing + break_if %a # -> [t: exit_loop loop_1, f: $B2] } } ret @@ -426,19 +426,19 @@ EXPECT_EQ(1u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - if true [t: %b4] { # if_1 - %b4 = block { # true + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + if true [t: $B4] { # if_1 + $B4: { # true ret } } - continue %b3 + continue # -> $B3 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } unreachable @@ -463,10 +463,10 @@ EXPECT_EQ(0u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block { # body + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2] { # loop_1 + $B2: { # body ret } } @@ -501,15 +501,15 @@ EXPECT_EQ(0u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block { # body + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2] { # loop_1 + $B2: { # body ret } } - if true [t: %b3] { # if_1 - %b3 = block { # true + if true [t: $B3] { # if_1 + $B3: { # true ret } } @@ -536,15 +536,15 @@ EXPECT_EQ(0u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block { # body - if true [t: %b3, f: %b4] { # if_1 - %b3 = block { # true + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2] { # loop_1 + $B2: { # body + if true [t: $B3, f: $B4] { # if_1 + $B3: { # true exit_loop # loop_1 } - %b4 = block { # false + $B4: { # false exit_loop # loop_1 } } @@ -575,50 +575,50 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - loop [b: %b4, c: %b5] { # loop_2 - %b4 = block { # body - if true [t: %b6] { # if_1 - %b6 = block { # true + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + loop [b: $B4, c: $B5] { # loop_2 + $B4: { # body + if true [t: $B6] { # if_1 + $B6: { # true exit_loop # loop_2 } } - if true [t: %b7] { # if_2 - %b7 = block { # true - continue %b5 + if true [t: $B7] { # if_2 + $B7: { # true + continue # -> $B5 } } - continue %b5 + continue # -> $B5 } - %b5 = block { # continuing - loop [b: %b8] { # loop_3 - %b8 = block { # body + $B5: { # continuing + loop [b: $B8] { # loop_3 + $B8: { # body exit_loop # loop_3 } } - loop [b: %b9, c: %b10] { # loop_4 - %b9 = block { # body - continue %b10 + loop [b: $B9, c: $B10] { # loop_4 + $B9: { # body + continue # -> $B10 } - %b10 = block { # continuing - break_if true %b9 + $B10: { # continuing + break_if true # -> [t: exit_loop loop_4, f: $B9] } } - next_iteration %b4 + next_iteration # -> $B4 } } - if true [t: %b11] { # if_3 - %b11 = block { # true + if true [t: $B11] { # if_3 + $B11: { # true exit_loop # loop_1 } } - continue %b3 + continue # -> $B3 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } ret @@ -643,22 +643,22 @@ EXPECT_EQ(1u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - if false [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + if false [t: $B4, f: $B5] { # if_1 + $B4: { # true exit_if # if_1 } - %b5 = block { # false + $B5: { # false exit_loop # loop_1 } } - continue %b3 + continue # -> $B3 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } ret @@ -683,22 +683,22 @@ EXPECT_EQ(0u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - if true [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + if true [t: $B4, f: $B5] { # if_1 + $B4: { # true exit_if # if_1 } - %b5 = block { # false + $B5: { # false exit_loop # loop_1 } } ret } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } ret @@ -723,31 +723,31 @@ EXPECT_EQ(1u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [i: %b2, b: %b3, c: %b4] { # loop_1 - %b2 = block { # initializer + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [i: $B2, b: $B3, c: $B4] { # loop_1 + $B2: { # initializer %i:ptr<function, i32, read_write> = var - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %3:i32 = load %i %4:bool = lt %3, 10i - if %4 [t: %b5, f: %b6] { # if_1 - %b5 = block { # true + if %4 [t: $B5, f: $B6] { # if_1 + $B5: { # true exit_if # if_1 } - %b6 = block { # false + $B6: { # false exit_loop # loop_1 } } - continue %b4 + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %5:i32 = load %i %6:i32 = add %5, 1i store %i, %6 - next_iteration %b3 + next_iteration # -> $B3 } } ret @@ -772,14 +772,14 @@ EXPECT_EQ(0u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer %i:ptr<function, i32, read_write> = var - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body exit_loop # loop_1 } } @@ -805,10 +805,10 @@ EXPECT_EQ(0u, loop->Continuing()->InboundSiblingBranches().Length()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - loop [b: %b2] { # loop_1 - %b2 = block { # body + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + loop [b: $B2] { # loop_1 + $B2: { # body exit_loop # loop_1 } } @@ -850,16 +850,16 @@ EXPECT_TRUE(cases[2].selectors[0].IsDefault()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - switch 1i [c: (0i, %b2), c: (1i, %b3), c: (default, %b4)] { # switch_1 - %b2 = block { # case + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + switch 1i [c: (0i, $B2), c: (1i, $B3), c: (default, $B4)] { # switch_1 + $B2: { # case exit_switch # switch_1 } - %b3 = block { # case + $B3: { # case exit_switch # switch_1 } - %b4 = block { # case + $B4: { # case exit_switch # switch_1 } } @@ -898,10 +898,10 @@ EXPECT_TRUE(cases[0].selectors[2].IsDefault()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - switch 1i [c: (0i 1i default, %b2)] { # switch_1 - %b2 = block { # case + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + switch 1i [c: (0i 1i default, $B2)] { # switch_1 + $B2: { # case exit_switch # switch_1 } } @@ -929,10 +929,10 @@ EXPECT_TRUE(cases[0].selectors[0].IsDefault()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - switch 1i [c: (default, %b2)] { # switch_1 - %b2 = block { # case + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + switch 1i [c: (default, $B2)] { # switch_1 + $B2: { # case exit_switch # switch_1 } } @@ -969,13 +969,13 @@ // This is 1 because the if is dead-code eliminated and the return doesn't happen. EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - switch 1i [c: (0i, %b2), c: (default, %b3)] { # switch_1 - %b2 = block { # case + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + switch 1i [c: (0i, $B2), c: (default, $B3)] { # switch_1 + $B2: { # case exit_switch # switch_1 } - %b3 = block { # case + $B3: { # case exit_switch # switch_1 } } @@ -1011,13 +1011,13 @@ EXPECT_TRUE(cases[1].selectors[0].IsDefault()); EXPECT_EQ(Disassemble(m), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { - switch 1i [c: (0i, %b2), c: (default, %b3)] { # switch_1 - %b2 = block { # case + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { + switch 1i [c: (0i, $B2), c: (default, $B3)] { # switch_1 + $B2: { # case ret } - %b3 = block { # case + $B3: { # case ret } } @@ -1035,13 +1035,13 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%b = func():i32 -> %b1 { - %b1 = block { + R"(%b = func():i32 { + $B1: { ret 1i } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:i32 = call %b ret } @@ -1060,8 +1060,8 @@ EXPECT_EQ( Disassemble(m.Get()), - R"(%f = @fragment func(%a:vec4<f32> [@invariant, @position]):vec4<f32> [@location(1)] -> %b1 { - %b1 = block { + R"(%f = @fragment func(%a:vec4<f32> [@invariant, @position]):vec4<f32> [@location(1)] { + $B1: { ret %a } } @@ -1076,8 +1076,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%f = @fragment func(%a:f32 [@location(2)]):f32 [@location(1)] -> %b1 { - %b1 = block { + R"(%f = @fragment func(%a:f32 [@location(2)]):f32 [@location(1)] { + $B1: { ret %a } } @@ -1097,8 +1097,8 @@ EXPECT_EQ( Disassemble(m.Get()), - R"(%f = @fragment func(%a:f32 [@location(2), @interpolate(linear, centroid)]):f32 [@location(1)] -> %b1 { - %b1 = block { + R"(%f = @fragment func(%a:f32 [@location(2), @interpolate(linear, centroid)]):f32 [@location(1)] { + $B1: { ret %a } } @@ -1115,10 +1115,9 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ( - Disassemble(m.Get()), - R"(%f = @fragment func(%a:f32 [@location(2), @interpolate(flat)]):f32 [@location(1)] -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), + R"(%f = @fragment func(%a:f32 [@location(2), @interpolate(flat)]):f32 [@location(1)] { + $B1: { ret %a } } @@ -1139,8 +1138,8 @@ EXPECT_EQ(m->functions[0]->Stage(), core::ir::Function::PipelineStage::kUndefined); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():void -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():void { + $B1: { ret } } @@ -1161,8 +1160,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%f = func():void -> %b1 { - %b1 = block { + R"(%f = func():void { + $B1: { ret } }
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/shadowing_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/shadowing_test.cc index f01b4da..c3251f5 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/shadowing_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/shadowing_test.cc
@@ -63,8 +63,8 @@ i:i32 @offset(0) } -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %S:ptr<function, S, read_write> = var, S(0i) %3:ptr<function, i32, read_write> = access %S, 0u %4:i32 = load %3 @@ -91,8 +91,8 @@ i:i32 @offset(0) } -%f = func(%S:S):i32 -> %b1 { - %b1 = block { +%f = func(%S:S):i32 { + $B1: { %3:i32 = access %S, 0u ret %3 } @@ -113,12 +113,12 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %i:ptr<private, i32, read_write> = var, 1i } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:i32 = load %i %4:i32 = add %3, 1i store %i, %4 @@ -145,12 +145,12 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %i:ptr<private, i32, read_write> = var, 1i } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:i32 = load %i %4:i32 = add %3, 1i store %i, %4 @@ -178,11 +178,11 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - if true [t: %b2] { # if_1 - %b2 = block { # true + if true [t: $B2] { # if_1 + $B2: { # true %3:i32 = load %i %4:i32 = add %3, 1i store %i, %4 @@ -217,11 +217,11 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - if true [t: %b2] { # if_1 - %b2 = block { # true + if true [t: $B2] { # if_1 + $B2: { # true %3:i32 = load %i %4:i32 = add %3, 1i store %i, %4 @@ -252,18 +252,18 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body %3:i32 = load %i %4:bool = lt %3, 4i - if %4 [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + if %4 [t: $B4, f: $B5] { # if_1 + $B4: { # true exit_if # if_1 } - %b5 = block { # false + $B5: { # false exit_loop # loop_1 } } @@ -273,8 +273,8 @@ %8:i32 = load %i_1 ret %8 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } %9:i32 = load %i @@ -298,18 +298,18 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body %3:i32 = load %i %4:bool = lt %3, 4i - if %4 [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + if %4 [t: $B4, f: $B5] { # if_1 + $B4: { # true exit_if # if_1 } - %b5 = block { # false + $B5: { # false exit_loop # loop_1 } } @@ -318,8 +318,8 @@ %i_1:i32 = let %6 # %i_1: 'i' ret %i_1 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } %8:i32 = load %i @@ -342,28 +342,28 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer %i_1:ptr<function, f32, read_write> = var, 0.0f # %i_1: 'i' - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %4:f32 = load %i_1 %5:bool = lt %4, 4.0f - if %5 [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + if %5 [t: $B4, f: $B5] { # if_1 + $B4: { # true exit_if # if_1 } - %b5 = block { # false + $B5: { # false exit_loop # loop_1 } } %6:f32 = load %i_1 %j:f32 = let %6 - continue %b6 + continue # -> $B6 } } %8:i32 = load %i @@ -386,26 +386,26 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer %i_1:f32 = let 0.0f # %i_1: 'i' - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %4:bool = lt %i_1, 4.0f - if %4 [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + if %4 [t: $B4, f: $B5] { # if_1 + $B4: { # true exit_if # if_1 } - %b5 = block { # false + $B5: { # false exit_loop # loop_1 } } %j:f32 = let %i_1 - continue %b6 + continue # -> $B6 } } %6:i32 = load %i @@ -429,22 +429,22 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer %x:ptr<function, i32, read_write> = var, 0i - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %4:i32 = load %i %5:bool = lt %4, 4i - if %5 [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + if %5 [t: $B4, f: $B5] { # if_1 + $B4: { # true exit_if # if_1 } - %b5 = block { # false + $B5: { # false exit_loop # loop_1 } } @@ -476,22 +476,22 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer %x:ptr<function, i32, read_write> = var, 0i - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %4:i32 = load %i %5:bool = lt %4, 4i - if %5 [t: %b4, f: %b5] { # if_1 - %b4 = block { # true + if %5 [t: $B4, f: $B5] { # if_1 + $B4: { # true exit_if # if_1 } - %b5 = block { # false + $B5: { # false exit_loop # loop_1 } } @@ -527,15 +527,15 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body %3:i32 = load %i %4:bool = eq %3, 2i - if %4 [t: %b4] { # if_1 - %b4 = block { # true + if %4 [t: $B4] { # if_1 + $B4: { # true exit_loop # loop_1 } } @@ -544,15 +544,15 @@ %i_1:ptr<function, i32, read_write> = var, %6 # %i_1: 'i' %8:i32 = load %i_1 %9:bool = eq %8, 3i - if %9 [t: %b5] { # if_2 - %b5 = block { # true + if %9 [t: $B5] { # if_2 + $B5: { # true exit_loop # loop_1 } } - continue %b3 + continue # -> $B3 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } %10:i32 = load %i @@ -581,15 +581,15 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body %3:i32 = load %i %4:bool = eq %3, 2i - if %4 [t: %b4] { # if_1 - %b4 = block { # true + if %4 [t: $B4] { # if_1 + $B4: { # true exit_loop # loop_1 } } @@ -597,15 +597,15 @@ %6:i32 = add %5, 1i %i_1:i32 = let %6 # %i_1: 'i' %8:bool = eq %i_1, 3i - if %8 [t: %b5] { # if_2 - %b5 = block { # true + if %8 [t: $B5] { # if_2 + $B5: { # true exit_loop # loop_1 } } - continue %b3 + continue # -> $B3 } - %b3 = block { # continuing - next_iteration %b2 + $B3: { # continuing + next_iteration # -> $B2 } } %9:i32 = load %i @@ -635,27 +635,27 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body %3:i32 = load %i %4:bool = eq %3, 2i - if %4 [t: %b4] { # if_1 - %b4 = block { # true + if %4 [t: $B4] { # if_1 + $B4: { # true exit_loop # loop_1 } } - continue %b3 + continue # -> $B3 } - %b3 = block { # continuing + $B3: { # continuing %5:i32 = load %i %6:i32 = add %5, 1i %i_1:ptr<function, i32, read_write> = var, %6 # %i_1: 'i' %8:i32 = load %i_1 %9:bool = gt %8, 2i - break_if %9 %b2 + break_if %9 # -> [t: exit_loop loop_1, f: $B2] } } %10:i32 = load %i @@ -685,26 +685,26 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body %3:i32 = load %i %4:bool = eq %3, 2i - if %4 [t: %b4] { # if_1 - %b4 = block { # true + if %4 [t: $B4] { # if_1 + $B4: { # true exit_loop # loop_1 } } - continue %b3 + continue # -> $B3 } - %b3 = block { # continuing + $B3: { # continuing %5:i32 = load %i %6:i32 = add %5, 1i %i_1:i32 = let %6 # %i_1: 'i' %8:bool = gt %i_1, 2i - break_if %8 %b2 + break_if %8 # -> [t: exit_loop loop_1, f: $B2] } } %9:i32 = load %i @@ -735,23 +735,23 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var %3:i32 = load %i - switch %3 [c: (0i, %b2), c: (1i, %b3), c: (default, %b4)] { # switch_1 - %b2 = block { # case + switch %3 [c: (0i, $B2), c: (1i, $B3), c: (default, $B4)] { # switch_1 + $B2: { # case %4:i32 = load %i ret %4 } - %b3 = block { # case + $B3: { # case %5:i32 = load %i %6:i32 = add %5, 1i %i_1:ptr<function, i32, read_write> = var, %6 # %i_1: 'i' %8:i32 = load %i_1 ret %8 } - %b4 = block { # case + $B4: { # case %9:i32 = load %i ret %9 } @@ -783,22 +783,22 @@ ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%f = func():i32 { + $B1: { %i:ptr<function, i32, read_write> = var %3:i32 = load %i - switch %3 [c: (0i, %b2), c: (1i, %b3), c: (default, %b4)] { # switch_1 - %b2 = block { # case + switch %3 [c: (0i, $B2), c: (1i, $B3), c: (default, $B4)] { # switch_1 + $B2: { # case %4:i32 = load %i ret %4 } - %b3 = block { # case + $B3: { # case %5:i32 = load %i %6:i32 = add %5, 1i %i_1:i32 = let %6 # %i_1: 'i' ret %i_1 } - %b4 = block { # case + $B4: { # case %8:i32 = load %i ret %8 }
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/store_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/store_test.cc index c2f9ad1..b2ac91e 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/store_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/store_test.cc
@@ -47,12 +47,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %a:ptr<private, u32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { store %a, 4u ret }
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/unary_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/unary_test.cc index 62c7e6f..8342e48 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/unary_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/unary_test.cc
@@ -46,13 +46,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool { + $B1: { ret false } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:bool = call %my_func %4:bool = eq %3, false %tint_symbol:bool = let %4 @@ -70,13 +70,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():vec4<bool> -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():vec4<bool> { + $B1: { ret vec4<bool>(false) } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:vec4<bool> = call %my_func %4:vec4<bool> = eq %3, vec4<bool>(false) %tint_symbol:vec4<bool> = let %4 @@ -94,13 +94,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 { + $B1: { ret 1u } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:u32 = call %my_func %4:u32 = complement %3 %tint_symbol:u32 = let %4 @@ -118,13 +118,13 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():i32 -> %b1 { - %b1 = block { + EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():i32 { + $B1: { ret 1i } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %3:i32 = call %my_func %4:i32 = negation %3 %tint_symbol:i32 = let %4 @@ -143,12 +143,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, i32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %v2:ptr<private, i32, read_write> = let %v1 ret } @@ -167,12 +167,12 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %v1:ptr<private, i32, read_write> = var } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %v3:ptr<private, i32, read_write> = let %v1 store %v3, 42i ret
diff --git a/src/tint/lang/wgsl/reader/program_to_ir/var_test.cc b/src/tint/lang/wgsl/reader/program_to_ir/var_test.cc index b846045..c683285 100644 --- a/src/tint/lang/wgsl/reader/program_to_ir/var_test.cc +++ b/src/tint/lang/wgsl/reader/program_to_ir/var_test.cc
@@ -45,7 +45,7 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %a:ptr<private, u32, read_write> = var } @@ -59,7 +59,7 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %a:ptr<private, u32, read_write> = var, 2u } @@ -72,7 +72,7 @@ auto m = Build(); ASSERT_EQ(m, Success); - EXPECT_EQ(Disassemble(m.Get()), R"(%b1 = block { # root + EXPECT_EQ(Disassemble(m.Get()), R"($B1: { # root %a:ptr<storage, u32, read> = var @binding_point(2, 3) } @@ -87,8 +87,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, u32, read_write> = var ret } @@ -105,8 +105,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, u32, read_write> = var, 2u ret } @@ -123,8 +123,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, u32, read_write> = var %3:u32 = load %a %4:u32 = add %3, 2u @@ -143,8 +143,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, i32, read_write> = var store %a, 42i ret @@ -180,13 +180,13 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%f = func(%p:i32):i32 -> %b1 { - %b1 = block { + R"(%f = func(%p:i32):i32 { + $B1: { ret %p } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %a:ptr<function, array<array<array<i32, 5>, 5>, 5>, read_write> = var %5:i32 = call %f, 1i %6:i32 = call %f, 2i @@ -226,13 +226,13 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%f = func(%p:i32):i32 -> %b1 { - %b1 = block { + R"(%f = func(%p:i32):i32 { + $B1: { ret %p } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %a:ptr<function, array<vec4<f32>, 5>, read_write> = var %5:i32 = call %f, 1i %6:ptr<function, vec4<f32>, read_write> = access %a, %5 @@ -274,13 +274,13 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%f = func(%p:i32):i32 -> %b1 { - %b1 = block { + R"(%f = func(%p:i32):i32 { + $B1: { ret %p } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %a:ptr<function, array<mat3x4<f32>, 5>, read_write> = var %5:i32 = call %f, 1i %6:i32 = call %f, 2i @@ -306,8 +306,8 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b1 { - %b1 = block { + R"(%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B1: { %a:ptr<function, i32, read_write> = var %3:i32 = load %a %4:i32 = add %3, 42i @@ -345,13 +345,13 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%f = func(%p:i32):i32 -> %b1 { - %b1 = block { + R"(%f = func(%p:i32):i32 { + $B1: { ret %p } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %a:ptr<function, array<array<array<i32, 5>, 5>, 5>, read_write> = var %5:i32 = call %f, 1i %6:i32 = call %f, 2i @@ -397,13 +397,13 @@ ASSERT_EQ(m, Success); EXPECT_EQ(Disassemble(m.Get()), - R"(%f = func(%p:i32):i32 -> %b1 { - %b1 = block { + R"(%f = func(%p:i32):i32 { + $B1: { ret %p } } -%test_function = @compute @workgroup_size(1, 1, 1) func():void -> %b2 { - %b2 = block { +%test_function = @compute @workgroup_size(1, 1, 1) func():void { + $B2: { %a:ptr<function, array<mat3x4<f32>, 5>, read_write> = var %5:i32 = call %f, 1i %6:i32 = call %f, 2i
diff --git a/src/tint/lang/wgsl/writer/raise/ptr_to_ref_test.cc b/src/tint/lang/wgsl/writer/raise/ptr_to_ref_test.cc index 851f9bb..b663af0 100644 --- a/src/tint/lang/wgsl/writer/raise/ptr_to_ref_test.cc +++ b/src/tint/lang/wgsl/writer/raise/ptr_to_ref_test.cc
@@ -85,8 +85,8 @@ b.Append(fn->Block(), [&] { b.Return(fn); }); auto* src = R"( -%1 = func(%2:ptr<function, i32, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, i32, read_write>):void { + $B1: { ret } } @@ -104,7 +104,7 @@ b.Append(mod.root_block, [&] { b.Var(ty.ptr<private_, i32>()); }); auto* src = R"( -%b1 = block { # root +$B1: { # root %1:ptr<private, i32, read_write> = var } @@ -112,7 +112,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %1:ref<private, i32, read_write> = var } @@ -131,8 +131,8 @@ }); auto* src = R"( -%1 = func():i32 -> %b1 { - %b1 = block { +%1 = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var %3:i32 = load %2 ret %3 @@ -142,8 +142,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func():i32 -> %b1 { - %b1 = block { +%1 = func():i32 { + $B1: { %2:ref<function, i32, read_write> = var %3:i32 = load %2 ret %3 @@ -165,8 +165,8 @@ }); auto* src = R"( -%1 = func():void -> %b1 { - %b1 = block { +%1 = func():void { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 42i ret @@ -176,8 +176,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func():void -> %b1 { - %b1 = block { +%1 = func():void { + $B1: { %2:ref<function, i32, read_write> = var store %2, 42i ret @@ -197,8 +197,8 @@ b.Append(fn->Block(), [&] { b.Return(fn, b.Load(ptr)); }); auto* src = R"( -%1 = func(%2:ptr<function, i32, read_write>):i32 -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, i32, read_write>):i32 { + $B1: { %3:i32 = load %2 ret %3 } @@ -207,8 +207,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func(%2:ptr<function, i32, read_write>):i32 -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, i32, read_write>):i32 { + $B1: { %3:ref<function, i32, read_write> = ptr-to-ref %2 %4:i32 = load %3 ret %4 @@ -231,8 +231,8 @@ }); auto* src = R"( -%1 = func(%2:ptr<function, i32, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, i32, read_write>):void { + $B1: { store %2, 42i ret } @@ -241,8 +241,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func(%2:ptr<function, i32, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, i32, read_write>):void { + $B1: { %3:ref<function, i32, read_write> = ptr-to-ref %2 store %3, 42i ret @@ -267,13 +267,13 @@ }); auto* src = R"( -%1 = func(%p:ptr<function, i32, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%p:ptr<function, i32, read_write>):void { + $B1: { ret } } -%3 = func():void -> %b2 { - %b2 = block { +%3 = func():void { + $B2: { %4:ptr<function, i32, read_write> = var %5:void = call %1, %4 ret @@ -283,13 +283,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func(%p:ptr<function, i32, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%p:ptr<function, i32, read_write>):void { + $B1: { ret } } -%3 = func():void -> %b2 { - %b2 = block { +%3 = func():void { + $B2: { %4:ref<function, i32, read_write> = var %5:ptr<function, i32, read_write> = ref-to-ptr %4 %6:void = call %1, %5 @@ -313,8 +313,8 @@ }); auto* src = R"( -%1 = func(%2:ptr<function, i32, read_write>):i32 -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, i32, read_write>):i32 { + $B1: { %l:ptr<function, i32, read_write> = let %2 %4:i32 = load %l ret %4 @@ -324,8 +324,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func(%2:ptr<function, i32, read_write>):i32 -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, i32, read_write>):i32 { + $B1: { %l:ptr<function, i32, read_write> = let %2 %4:ref<function, i32, read_write> = ptr-to-ref %l %5:i32 = load %4 @@ -350,8 +350,8 @@ }); auto* src = R"( -%1 = func(%2:ptr<function, i32, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, i32, read_write>):void { + $B1: { %l:ptr<function, i32, read_write> = let %2 store %l, 42i ret @@ -361,8 +361,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func(%2:ptr<function, i32, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, i32, read_write>):void { + $B1: { %l:ptr<function, i32, read_write> = let %2 %4:ref<function, i32, read_write> = ptr-to-ref %l store %4, 42i @@ -386,8 +386,8 @@ }); auto* src = R"( -%1 = func(%2:ptr<function, array<i32, 4>, read_write>):i32 -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, array<i32, 4>, read_write>):i32 { + $B1: { %3:ptr<function, i32, read_write> = access %2, 2i %4:i32 = load %3 ret %4 @@ -397,8 +397,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func(%2:ptr<function, array<i32, 4>, read_write>):i32 -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, array<i32, 4>, read_write>):i32 { + $B1: { %3:ref<function, array<i32, 4>, read_write> = ptr-to-ref %2 %4:ref<function, i32, read_write> = access %3, 2i %5:i32 = load %4 @@ -423,8 +423,8 @@ }); auto* src = R"( -%1 = func(%2:ptr<function, array<i32, 4>, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, array<i32, 4>, read_write>):void { + $B1: { %3:ptr<function, i32, read_write> = access %2, 2i store %3, 42i ret @@ -434,8 +434,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func(%2:ptr<function, array<i32, 4>, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, array<i32, 4>, read_write>):void { + $B1: { %3:ref<function, array<i32, 4>, read_write> = ptr-to-ref %2 %4:ref<function, i32, read_write> = access %3, 2i store %4, 42i @@ -460,8 +460,8 @@ }); auto* src = R"( -%1 = func(%2:ptr<function, array<i32, 4>, read_write>):i32 -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, array<i32, 4>, read_write>):i32 { + $B1: { %3:ptr<function, i32, read_write> = access %2, 2i %l:ptr<function, i32, read_write> = let %3 %5:i32 = load %l @@ -472,8 +472,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func(%2:ptr<function, array<i32, 4>, read_write>):i32 -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, array<i32, 4>, read_write>):i32 { + $B1: { %3:ref<function, array<i32, 4>, read_write> = ptr-to-ref %2 %4:ref<function, i32, read_write> = access %3, 2i %5:ptr<function, i32, read_write> = ref-to-ptr %4 @@ -502,8 +502,8 @@ }); auto* src = R"( -%1 = func(%2:ptr<function, array<i32, 4>, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, array<i32, 4>, read_write>):void { + $B1: { %3:ptr<function, i32, read_write> = access %2, 2i %l:ptr<function, i32, read_write> = let %3 store %l, 42i @@ -514,8 +514,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func(%2:ptr<function, array<i32, 4>, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, array<i32, 4>, read_write>):void { + $B1: { %3:ref<function, array<i32, 4>, read_write> = ptr-to-ref %2 %4:ref<function, i32, read_write> = access %3, 2i %5:ptr<function, i32, read_write> = ref-to-ptr %4 @@ -539,8 +539,8 @@ b.Append(fn->Block(), [&] { b.Return(fn, b.LoadVectorElement(param, 2_i)); }); auto* src = R"( -%1 = func(%2:ptr<function, vec3<i32>, read_write>):i32 -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, vec3<i32>, read_write>):i32 { + $B1: { %3:i32 = load_vector_element %2, 2i ret %3 } @@ -549,8 +549,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func(%2:ptr<function, vec3<i32>, read_write>):i32 -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, vec3<i32>, read_write>):i32 { + $B1: { %3:ref<function, vec3<i32>, read_write> = ptr-to-ref %2 %4:i32 = load_vector_element %3, 2i ret %4 @@ -573,8 +573,8 @@ }); auto* src = R"( -%1 = func(%2:ptr<function, vec3<i32>, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, vec3<i32>, read_write>):void { + $B1: { store_vector_element %2, 2i, 42i ret } @@ -583,8 +583,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%1 = func(%2:ptr<function, vec3<i32>, read_write>):void -> %b1 { - %b1 = block { +%1 = func(%2:ptr<function, vec3<i32>, read_write>):void { + $B1: { %3:ref<function, vec3<i32>, read_write> = ptr-to-ref %2 store_vector_element %3, 2i, 42i ret
diff --git a/src/tint/lang/wgsl/writer/raise/raise_test.cc b/src/tint/lang/wgsl/writer/raise/raise_test.cc index 0e5cae6..645361c 100644 --- a/src/tint/lang/wgsl/writer/raise/raise_test.cc +++ b/src/tint/lang/wgsl/writer/raise/raise_test.cc
@@ -51,8 +51,8 @@ }); auto* src = R"( -%f = func():void -> %b1 { - %b1 = block { +%f = func():void { + $B1: { %2:i32 = max 1i, 2i ret } @@ -61,8 +61,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():void -> %b1 { - %b1 = block { +%f = func():void { + $B1: { %2:i32 = wgsl.max 1i, 2i %3:i32 = let %2 ret @@ -87,12 +87,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %W:ptr<workgroup, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:void = workgroupBarrier %4:i32 = load %W %5:void = workgroupBarrier @@ -103,12 +103,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %W:ref<workgroup, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:ptr<workgroup, i32, read_write> = ref-to-ptr %W %4:i32 = wgsl.workgroupUniformLoad %3 ret %4 @@ -134,12 +134,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %W:ptr<workgroup, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:void = workgroupBarrier store %W, 42i %4:i32 = load %W @@ -151,12 +151,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %W:ref<workgroup, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:void = wgsl.workgroupBarrier store %W, 42i %4:i32 = load %W
diff --git a/src/tint/lang/wgsl/writer/raise/rename_conflicts_test.cc b/src/tint/lang/wgsl/writer/raise/rename_conflicts_test.cc index b2823db..1c805b1 100644 --- a/src/tint/lang/wgsl/writer/raise/rename_conflicts_test.cc +++ b/src/tint/lang/wgsl/writer/raise/rename_conflicts_test.cc
@@ -83,7 +83,7 @@ b.Append(mod.root_block, [&] { b.ir.SetName(b.Var(ty.ptr<private_, i32>()), "v"); }); auto* src = R"( -%b1 = block { # root +$B1: { # root %v:ptr<private, i32, read_write> = var } @@ -104,7 +104,7 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %v:ptr<private, i32, read_write> = var %v_1:ptr<private, u32, read_write> = var # %v_1: 'v' } @@ -113,7 +113,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %v:ptr<private, i32, read_write> = var %v_1:ptr<private, u32, read_write> = var } @@ -134,7 +134,7 @@ x:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %v:ptr<function, v, read_write> = var } @@ -146,7 +146,7 @@ x:i32 @offset(0) } -%b1 = block { # root +$B1: { # root %v_1:ptr<function, v, read_write> = var } @@ -164,12 +164,12 @@ b.Append(fn->Block(), [&] { b.Return(fn); }); auto* src = R"( -%b1 = block { # root +$B1: { # root %v:ptr<private, i32, read_write> = var } -%v_1 = func():void -> %b2 { # %v_1: 'v' - %b2 = block { +%v_1 = func():void { # %v_1: 'v' + $B2: { ret } } @@ -177,12 +177,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %v:ptr<private, i32, read_write> = var } -%v_1 = func():void -> %b2 { - %b2 = block { +%v_1 = func():void { + $B2: { ret } } @@ -211,12 +211,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %v:ptr<private, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:i32 = load %v %v_1:ptr<function, i32, read_write> = var # %v_1: 'v' %5:i32 = load %v_1 @@ -251,12 +251,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %v:ptr<private, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %v_1:ptr<function, i32, read_write> = var # %v_1: 'v' %4:i32 = load %v %5:i32 = load %v_1 @@ -268,12 +268,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %v:ptr<private, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %v_1:ptr<function, i32, read_write> = var %4:i32 = load %v %5:i32 = load %v_1 @@ -309,11 +309,11 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %v:ptr<function, i32, read_write> = var - if true [t: %b2] { # if_1 - %b2 = block { # true + if true [t: $B2] { # if_1 + $B2: { # true %3:i32 = load %v %v_1:ptr<function, i32, read_write> = var # %v_1: 'v' %5:i32 = load %v_1 @@ -354,11 +354,11 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %v:ptr<function, i32, read_write> = var - if true [t: %b2] { # if_1 - %b2 = block { # true + if true [t: $B2] { # if_1 + $B2: { # true %v_1:ptr<function, i32, read_write> = var # %v_1: 'v' %4:i32 = load %v %5:i32 = load %v_1 @@ -373,11 +373,11 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %v:ptr<function, i32, read_write> = var - if true [t: %b2] { # if_1 - %b2 = block { # true + if true [t: $B2] { # if_1 + $B2: { # true %v_1:ptr<function, i32, read_write> = var %4:i32 = load %v %5:i32 = load %v_1 @@ -419,14 +419,14 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer +%f = func():i32 { + $B1: { + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer %v:ptr<function, i32, read_write> = var - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %3:i32 = load %v %v_1:ptr<function, i32, read_write> = var # %v_1: 'v' %5:i32 = load %v_1 @@ -470,14 +470,14 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer +%f = func():i32 { + $B1: { + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer %v:ptr<function, i32, read_write> = var - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %v_1:ptr<function, i32, read_write> = var # %v_1: 'v' %4:i32 = load %v %5:i32 = load %v_1 @@ -492,14 +492,14 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer +%f = func():i32 { + $B1: { + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer %v:ptr<function, i32, read_write> = var - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %v_1:ptr<function, i32, read_write> = var %4:i32 = load %v %5:i32 = load %v_1 @@ -542,17 +542,17 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { - loop [i: %b2, b: %b3, c: %b4] { # loop_1 - %b2 = block { # initializer - next_iteration %b3 +%f = func():i32 { + $B1: { + loop [i: $B2, b: $B3, c: $B4] { # loop_1 + $B2: { # initializer + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %v:ptr<function, i32, read_write> = var - continue %b4 + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %3:i32 = load %v %v_1:ptr<function, i32, read_write> = var # %v_1: 'v' %5:i32 = load %v_1 @@ -597,17 +597,17 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { - loop [i: %b2, b: %b3, c: %b4] { # loop_1 - %b2 = block { # initializer - next_iteration %b3 +%f = func():i32 { + $B1: { + loop [i: $B2, b: $B3, c: $B4] { # loop_1 + $B2: { # initializer + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %v:ptr<function, i32, read_write> = var - continue %b4 + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %v_1:ptr<function, i32, read_write> = var # %v_1: 'v' %4:i32 = load %v %5:i32 = load %v_1 @@ -622,17 +622,17 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { - loop [i: %b2, b: %b3, c: %b4] { # loop_1 - %b2 = block { # initializer - next_iteration %b3 +%f = func():i32 { + $B1: { + loop [i: $B2, b: $B3, c: $B4] { # loop_1 + $B2: { # initializer + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %v:ptr<function, i32, read_write> = var - continue %b4 + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %v_1:ptr<function, i32, read_write> = var %4:i32 = load %v %5:i32 = load %v_1 @@ -662,8 +662,8 @@ }); auto* src = R"( -%f = func(%i32:i32):void -> %b1 { - %b1 = block { +%f = func(%i32:i32):void { + $B1: { %3:ptr<function, i32, read_write> = var ret } @@ -672,8 +672,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func(%i32_1:i32):void -> %b1 { - %b1 = block { +%f = func(%i32_1:i32):void { + $B1: { %3:ptr<function, i32, read_write> = var ret } @@ -697,8 +697,8 @@ }); auto* src = R"( -%f = func(%vec2:i32):void -> %b1 { - %b1 = block { +%f = func(%vec2:i32):void { + $B1: { %3:ptr<function, vec3<i32>, read_write> = var ret } @@ -725,8 +725,8 @@ }); auto* src = R"( -%f = func(%vec3:i32):void -> %b1 { - %b1 = block { +%f = func(%vec3:i32):void { + $B1: { %3:ptr<function, vec3<i32>, read_write> = var ret } @@ -735,8 +735,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func(%vec3_1:i32):void -> %b1 { - %b1 = block { +%f = func(%vec3_1:i32):void { + $B1: { %3:ptr<function, vec3<i32>, read_write> = var ret } @@ -760,8 +760,8 @@ }); auto* src = R"( -%f = func(%mat3x2:i32):void -> %b1 { - %b1 = block { +%f = func(%mat3x2:i32):void { + $B1: { %3:ptr<function, mat2x4<f32>, read_write> = var ret } @@ -788,8 +788,8 @@ }); auto* src = R"( -%f = func(%mat2x4:i32):void -> %b1 { - %b1 = block { +%f = func(%mat2x4:i32):void { + $B1: { %3:ptr<function, mat2x4<f32>, read_write> = var ret } @@ -798,8 +798,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func(%mat2x4_1:i32):void -> %b1 { - %b1 = block { +%f = func(%mat2x4_1:i32):void { + $B1: { %3:ptr<function, mat2x4<f32>, read_write> = var ret } @@ -821,8 +821,8 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %f32:ptr<function, i32, read_write> = var %3:i32 = construct ret %3 @@ -848,8 +848,8 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %i32:ptr<function, i32, read_write> = var %3:i32 = construct ret %3 @@ -859,8 +859,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %i32_1:ptr<function, i32, read_write> = var %3:i32 = construct ret %3 @@ -883,8 +883,8 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %i32:i32 = add 1i, 2i ret %i32 } @@ -909,8 +909,8 @@ }); auto* src = R"( -%f = func():f32 -> %b1 { - %b1 = block { +%f = func():f32 { + $B1: { %f32:i32 = add 1i, 2i %3:f32 = construct %f32 ret %3 @@ -920,8 +920,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():f32 -> %b1 { - %b1 = block { +%f = func():f32 { + $B1: { %f32_1:i32 = add 1i, 2i %3:f32 = construct %f32_1 ret %3 @@ -940,7 +940,7 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %function:ptr<private, i32, read_write> = var } @@ -960,7 +960,7 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %private:ptr<private, i32, read_write> = var } @@ -968,7 +968,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %private_1:ptr<private, i32, read_write> = var } @@ -985,7 +985,7 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %read:ptr<private, i32, read_write> = var } @@ -1005,7 +1005,7 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %read_write:ptr<private, i32, read_write> = var } @@ -1013,7 +1013,7 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %read_write_1:ptr<private, i32, read_write> = var } @@ -1037,12 +1037,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %min:ptr<private, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:i32 = max 1i, 2i ret %3 } @@ -1070,12 +1070,12 @@ }); auto* src = R"( -%b1 = block { # root +$B1: { # root %max:ptr<private, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:i32 = max 1i, 2i ret %3 } @@ -1084,12 +1084,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%b1 = block { # root +$B1: { # root %max_1:ptr<private, i32, read_write> = var } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:i32 = max 1i, 2i ret %3 } @@ -1118,12 +1118,12 @@ f:f32 @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<private, s, read_write> = var } -%f32 = func():void -> %b2 { - %b2 = block { +%f32 = func():void { + $B2: { ret } } @@ -1135,12 +1135,12 @@ f:f32 @offset(0) } -%b1 = block { # root +$B1: { # root %1:ptr<private, s, read_write> = var } -%f32_1 = func():void -> %b2 { - %b2 = block { +%f32_1 = func():void { + $B2: { ret } }
diff --git a/src/tint/lang/wgsl/writer/raise/value_to_let_test.cc b/src/tint/lang/wgsl/writer/raise/value_to_let_test.cc index d9ac335..4449bd8 100644 --- a/src/tint/lang/wgsl/writer/raise/value_to_let_test.cc +++ b/src/tint/lang/wgsl/writer/raise/value_to_let_test.cc
@@ -62,8 +62,8 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 @@ -76,8 +76,8 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 @@ -110,13 +110,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func():i32 -> %b2 { - %b2 = block { +%b = func():i32 { + $B2: { %4:i32 = add 1i, 2i %5:i32 = add 3i, 4i %6:i32 = add %4, %5 @@ -148,13 +148,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func():i32 -> %b2 { - %b2 = block { +%b = func():i32 { + $B2: { %4:i32 = call %a, 1i %5:i32 = add 2i, 3i %6:i32 = add %4, %5 @@ -186,13 +186,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func():i32 -> %b2 { - %b2 = block { +%b = func():i32 { + $B2: { %4:i32 = add 1i, 2i %5:i32 = call %a, 3i %6:i32 = add %4, %5 @@ -224,13 +224,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func():i32 -> %b2 { - %b2 = block { +%b = func():i32 { + $B2: { %4:i32 = call %a, 1i %5:i32 = call %a, 2i %6:i32 = add %4, %5 @@ -262,13 +262,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func():i32 -> %b2 { - %b2 = block { +%b = func():i32 { + $B2: { %4:i32 = add 3i, 4i %5:i32 = add 1i, 2i %6:i32 = add %5, %4 @@ -300,13 +300,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func():i32 -> %b2 { - %b2 = block { +%b = func():i32 { + $B2: { %4:i32 = add 2i, 3i %5:i32 = call %a, 1i %6:i32 = add %5, %4 @@ -338,13 +338,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func():i32 -> %b2 { - %b2 = block { +%b = func():i32 { + $B2: { %4:i32 = call %a, 3i %5:i32 = add 1i, 2i %6:i32 = add %5, %4 @@ -376,13 +376,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func():i32 -> %b2 { - %b2 = block { +%b = func():i32 { + $B2: { %4:i32 = call %a, 2i %5:i32 = call %a, 1i %6:i32 = add %5, %4 @@ -394,13 +394,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func():i32 -> %b2 { - %b2 = block { +%b = func():i32 { + $B2: { %4:i32 = call %a, 2i %5:i32 = let %4 %6:i32 = call %a, 1i @@ -438,18 +438,18 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func(%4:i32, %5:i32, %6:i32):i32 -> %b2 { - %b2 = block { +%b = func(%4:i32, %5:i32, %6:i32):i32 { + $B2: { ret 0i } } -%c = func():i32 -> %b3 { - %b3 = block { +%c = func():i32 { + $B3: { %8:i32 = call %a, 1i %9:i32 = call %a, 2i %10:i32 = call %a, 3i @@ -488,18 +488,18 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func(%4:i32, %5:i32, %6:i32):i32 -> %b2 { - %b2 = block { +%b = func(%4:i32, %5:i32, %6:i32):i32 { + $B2: { ret 0i } } -%c = func():i32 -> %b3 { - %b3 = block { +%c = func():i32 { + $B3: { %8:i32 = call %a, 2i %9:i32 = call %a, 1i %10:i32 = call %a, 3i @@ -512,18 +512,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func(%4:i32, %5:i32, %6:i32):i32 -> %b2 { - %b2 = block { +%b = func(%4:i32, %5:i32, %6:i32):i32 { + $B2: { ret 0i } } -%c = func():i32 -> %b3 { - %b3 = block { +%c = func():i32 { + $B3: { %8:i32 = call %a, 2i %9:i32 = let %8 %10:i32 = call %a, 1i @@ -559,18 +559,18 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func(%4:i32, %5:i32, %6:i32):i32 -> %b2 { - %b2 = block { +%b = func(%4:i32, %5:i32, %6:i32):i32 { + $B2: { ret 0i } } -%c = func():i32 -> %b3 { - %b3 = block { +%c = func():i32 { + $B3: { %8:i32 = call %a, 1i %9:i32 = call %a, 3i %10:i32 = call %a, 2i @@ -583,18 +583,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func(%4:i32, %5:i32, %6:i32):i32 -> %b2 { - %b2 = block { +%b = func(%4:i32, %5:i32, %6:i32):i32 { + $B2: { ret 0i } } -%c = func():i32 -> %b3 { - %b3 = block { +%c = func():i32 { + $B3: { %8:i32 = call %a, 1i %9:i32 = let %8 %10:i32 = call %a, 3i @@ -631,18 +631,18 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func(%4:i32, %5:i32, %6:i32):i32 -> %b2 { - %b2 = block { +%b = func(%4:i32, %5:i32, %6:i32):i32 { + $B2: { ret 0i } } -%c = func():i32 -> %b3 { - %b3 = block { +%c = func():i32 { + $B3: { %8:i32 = call %a, 3i %9:i32 = call %a, 1i %10:i32 = call %a, 2i @@ -655,18 +655,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func(%4:i32, %5:i32, %6:i32):i32 -> %b2 { - %b2 = block { +%b = func(%4:i32, %5:i32, %6:i32):i32 { + $B2: { ret 0i } } -%c = func():i32 -> %b3 { - %b3 = block { +%c = func():i32 { + $B3: { %8:i32 = call %a, 3i %9:i32 = let %8 %10:i32 = call %a, 1i @@ -702,18 +702,18 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func(%4:i32, %5:i32, %6:i32):i32 -> %b2 { - %b2 = block { +%b = func(%4:i32, %5:i32, %6:i32):i32 { + $B2: { ret 0i } } -%c = func():i32 -> %b3 { - %b3 = block { +%c = func():i32 { + $B3: { %8:i32 = call %a, 2i %9:i32 = call %a, 3i %10:i32 = call %a, 1i @@ -726,18 +726,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func(%4:i32, %5:i32, %6:i32):i32 -> %b2 { - %b2 = block { +%b = func(%4:i32, %5:i32, %6:i32):i32 { + $B2: { ret 0i } } -%c = func():i32 -> %b3 { - %b3 = block { +%c = func():i32 { + $B3: { %8:i32 = call %a, 2i %9:i32 = let %8 %10:i32 = call %a, 3i @@ -774,18 +774,18 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func(%4:i32, %5:i32, %6:i32):i32 -> %b2 { - %b2 = block { +%b = func(%4:i32, %5:i32, %6:i32):i32 { + $B2: { ret 0i } } -%c = func():i32 -> %b3 { - %b3 = block { +%c = func():i32 { + $B3: { %8:i32 = call %a, 3i %9:i32 = call %a, 2i %10:i32 = call %a, 1i @@ -798,18 +798,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 0i } } -%b = func(%4:i32, %5:i32, %6:i32):i32 -> %b2 { - %b2 = block { +%b = func(%4:i32, %5:i32, %6:i32):i32 { + $B2: { ret 0i } } -%c = func():i32 -> %b3 { - %b3 = block { +%c = func():i32 { + $B3: { %8:i32 = call %a, 3i %9:i32 = let %8 %10:i32 = call %a, 2i @@ -840,13 +840,13 @@ }); auto* src = R"( -%a = func():void -> %b1 { - %b1 = block { +%a = func():void { + $B1: { ret } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:ptr<function, i32, read_write> = var store %3, 1i %4:i32 = load %3 @@ -859,13 +859,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func():void -> %b1 { - %b1 = block { +%a = func():void { + $B1: { ret } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:ptr<function, i32, read_write> = var store %3, 1i %4:i32 = load %3 @@ -895,13 +895,13 @@ }); auto* src = R"( -%a = func():i32 -> %b1 { - %b1 = block { +%a = func():i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:ptr<function, i32, read_write> = var store %3, 1i %4:i32 = load %3 @@ -914,13 +914,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func():i32 -> %b1 { - %b1 = block { +%a = func():i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:ptr<function, i32, read_write> = var store %3, 1i %4:i32 = load %3 @@ -950,13 +950,13 @@ }); auto* src = R"( -%a = func():i32 -> %b1 { - %b1 = block { +%a = func():i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:ptr<function, i32, read_write> = var store %3, 1i %4:i32 = load %3 @@ -970,13 +970,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func():i32 -> %b1 { - %b1 = block { +%a = func():i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:ptr<function, i32, read_write> = var store %3, 1i %4:i32 = load %3 @@ -1006,13 +1006,13 @@ }); auto* src = R"( -%a = func():i32 -> %b1 { - %b1 = block { +%a = func():i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:ptr<function, i32, read_write> = var store %3, 1i %4:i32 = load %3 @@ -1026,13 +1026,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func():i32 -> %b1 { - %b1 = block { +%a = func():i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %3:ptr<function, i32, read_write> = var store %3, 1i %4:i32 = load %3 @@ -1068,13 +1068,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %4:ptr<function, array<array<array<i32, 3>, 4>, 5>, read_write> = var %5:i32 = call %a, 1i %6:i32 = call %a, 2i @@ -1089,13 +1089,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %4:ptr<function, array<array<array<i32, 3>, 4>, 5>, read_write> = var %5:i32 = call %a, 1i %6:i32 = call %a, 2i @@ -1128,13 +1128,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %4:ptr<function, array<array<array<i32, 3>, 4>, 5>, read_write> = var %5:i32 = call %a, 2i %6:i32 = call %a, 1i @@ -1149,13 +1149,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %4:ptr<function, array<array<array<i32, 3>, 4>, 5>, read_write> = var %5:i32 = call %a, 2i %6:i32 = let %5 @@ -1189,13 +1189,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %4:ptr<function, array<array<array<i32, 3>, 4>, 5>, read_write> = var %5:i32 = call %a, 3i %6:i32 = call %a, 1i @@ -1210,13 +1210,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %4:ptr<function, array<array<array<i32, 3>, 4>, 5>, read_write> = var %5:i32 = call %a, 3i %6:i32 = let %5 @@ -1250,13 +1250,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %4:ptr<function, array<array<array<i32, 3>, 4>, 5>, read_write> = var %5:i32 = call %a, 3i %6:i32 = call %a, 2i @@ -1271,13 +1271,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():i32 -> %b2 { - %b2 = block { +%f = func():i32 { + $B2: { %4:ptr<function, array<array<array<i32, 3>, 4>, 5>, read_write> = var %5:i32 = call %a, 3i %6:i32 = let %5 @@ -1312,13 +1312,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():f32 -> %b2 { - %b2 = block { +%f = func():f32 { + $B2: { %4:array<mat3x4<f32>, 5> = construct %5:i32 = call %a, 1i %6:i32 = call %a, 2i @@ -1332,13 +1332,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():f32 -> %b2 { - %b2 = block { +%f = func():f32 { + $B2: { %4:array<mat3x4<f32>, 5> = construct %5:i32 = call %a, 1i %6:i32 = call %a, 2i @@ -1370,13 +1370,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():f32 -> %b2 { - %b2 = block { +%f = func():f32 { + $B2: { %4:array<mat3x4<f32>, 5> = construct %5:i32 = call %a, 2i %6:i32 = call %a, 1i @@ -1390,13 +1390,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():f32 -> %b2 { - %b2 = block { +%f = func():f32 { + $B2: { %4:array<mat3x4<f32>, 5> = construct %5:i32 = call %a, 2i %6:i32 = let %5 @@ -1429,13 +1429,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():f32 -> %b2 { - %b2 = block { +%f = func():f32 { + $B2: { %4:array<mat3x4<f32>, 5> = construct %5:i32 = call %a, 3i %6:i32 = call %a, 1i @@ -1449,13 +1449,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():f32 -> %b2 { - %b2 = block { +%f = func():f32 { + $B2: { %4:array<mat3x4<f32>, 5> = construct %5:i32 = call %a, 3i %6:i32 = let %5 @@ -1488,13 +1488,13 @@ }); auto* src = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():f32 -> %b2 { - %b2 = block { +%f = func():f32 { + $B2: { %4:array<mat3x4<f32>, 5> = construct %5:i32 = call %a, 3i %6:i32 = call %a, 2i @@ -1508,13 +1508,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%a = func(%2:i32):i32 -> %b1 { - %b1 = block { +%a = func(%2:i32):i32 { + $B1: { ret 1i } } -%f = func():f32 -> %b2 { - %b2 = block { +%f = func():f32 { + $B2: { %4:array<mat3x4<f32>, 5> = construct %5:i32 = call %a, 3i %6:i32 = let %5 @@ -1545,11 +1545,11 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:i32 = add 1i, 2i - if true [t: %b2] { # if_1 - %b2 = block { # true + if true [t: $B2] { # if_1 + $B2: { # true ret %2 } } @@ -1580,13 +1580,13 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var, 1i %3:i32 = load %2 %4:i32 = add %3, 2i - if true [t: %b2] { # if_1 - %b2 = block { # true + if true [t: $B2] { # if_1 + $B2: { # true ret %4 } } @@ -1598,14 +1598,14 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var, 1i %3:i32 = load %2 %4:i32 = add %3, 2i %5:i32 = let %4 - if true [t: %b2] { # if_1 - %b2 = block { # true + if true [t: $B2] { # if_1 + $B2: { # true ret %5 } } @@ -1629,11 +1629,11 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:bool = eq 1i, 2i - if %2 [t: %b2] { # if_1 - %b2 = block { # true + if %2 [t: $B2] { # if_1 + $B2: { # true ret 3i } } @@ -1645,11 +1645,11 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:bool = eq 1i, 2i - if %2 [t: %b2] { # if_1 - %b2 = block { # true + if %2 [t: $B2] { # if_1 + $B2: { # true ret 3i } } @@ -1676,13 +1676,13 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var, 1i %3:i32 = load %2 %4:bool = eq %3, 2i - if %4 [t: %b2] { # if_1 - %b2 = block { # true + if %4 [t: $B2] { # if_1 + $B2: { # true ret 3i } } @@ -1694,13 +1694,13 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var, 1i %3:i32 = load %2 %4:bool = eq %3, 2i - if %4 [t: %b2] { # if_1 - %b2 = block { # true + if %4 [t: $B2] { # if_1 + $B2: { # true ret 3i } } @@ -1729,13 +1729,13 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 - if true [t: %b2] { # if_1 - %b2 = block { # true + if true [t: $B2] { # if_1 + $B2: { # true store %2, 2i exit_if # if_1 } @@ -1748,14 +1748,14 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 %4:i32 = let %3 - if true [t: %b2] { # if_1 - %b2 = block { # true + if true [t: $B2] { # if_1 + $B2: { # true store %2, 2i exit_if # if_1 } @@ -1784,11 +1784,11 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:i32 = add 1i, 2i - switch 3i [c: (default, %b2)] { # switch_1 - %b2 = block { # case + switch 3i [c: (default, $B2)] { # switch_1 + $B2: { # case ret %2 } } @@ -1820,13 +1820,13 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var, 1i %3:i32 = load %2 %4:i32 = add %3, 2i - switch 3i [c: (default, %b2)] { # switch_1 - %b2 = block { # case + switch 3i [c: (default, $B2)] { # switch_1 + $B2: { # case ret %4 } } @@ -1838,14 +1838,14 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var, 1i %3:i32 = load %2 %4:i32 = add %3, 2i %5:i32 = let %4 - switch 3i [c: (default, %b2)] { # switch_1 - %b2 = block { # case + switch 3i [c: (default, $B2)] { # switch_1 + $B2: { # case ret %5 } } @@ -1870,11 +1870,11 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:i32 = add 1i, 2i - switch %2 [c: (default, %b2)] { # switch_1 - %b2 = block { # case + switch %2 [c: (default, $B2)] { # switch_1 + $B2: { # case ret 3i } } @@ -1886,11 +1886,11 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:i32 = add 1i, 2i - switch %2 [c: (default, %b2)] { # switch_1 - %b2 = block { # case + switch %2 [c: (default, $B2)] { # switch_1 + $B2: { # case ret 3i } } @@ -1917,12 +1917,12 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var, 1i %3:i32 = load %2 - switch %3 [c: (default, %b2)] { # switch_1 - %b2 = block { # case + switch %3 [c: (default, $B2)] { # switch_1 + $B2: { # case ret 3i } } @@ -1934,12 +1934,12 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var, 1i %3:i32 = load %2 - switch %3 [c: (default, %b2)] { # switch_1 - %b2 = block { # case + switch %3 [c: (default, $B2)] { # switch_1 + $B2: { # case ret 3i } } @@ -1969,13 +1969,13 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 - switch 1i [c: (default, %b2)] { # switch_1 - %b2 = block { # case + switch 1i [c: (default, $B2)] { # switch_1 + $B2: { # case store %2, 2i exit_switch # switch_1 } @@ -1988,14 +1988,14 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 %4:i32 = let %3 - switch 1i [c: (default, %b2)] { # switch_1 - %b2 = block { # case + switch 1i [c: (default, $B2)] { # switch_1 + $B2: { # case store %2, 2i exit_switch # switch_1 } @@ -2028,16 +2028,16 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var %3:i32 = add 1i, 2i - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer store %2, %3 - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body exit_loop # loop_1 } } @@ -2071,17 +2071,17 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var %3:i32 = load %2 %4:i32 = add %3, 2i - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer store %2, %4 - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body exit_loop # loop_1 } } @@ -2093,18 +2093,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var %3:i32 = load %2 %4:i32 = add %3, 2i %5:i32 = let %4 - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer store %2, %5 - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body exit_loop # loop_1 } } @@ -2134,17 +2134,17 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer store %2, 2i - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body exit_loop # loop_1 } } @@ -2156,18 +2156,18 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 %4:i32 = let %3 - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer store %2, 2i - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body exit_loop # loop_1 } } @@ -2191,11 +2191,11 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:i32 = add 1i, 2i - loop [b: %b2] { # loop_1 - %b2 = block { # body + loop [b: $B2] { # loop_1 + $B2: { # body ret %2 } } @@ -2225,13 +2225,13 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var %3:i32 = load %2 %4:i32 = add %3, 2i - loop [b: %b2] { # loop_1 - %b2 = block { # body + loop [b: $B2] { # loop_1 + $B2: { # body ret %4 } } @@ -2243,14 +2243,14 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var %3:i32 = load %2 %4:i32 = add %3, 2i %5:i32 = let %4 - loop [b: %b2] { # loop_1 - %b2 = block { # body + loop [b: $B2] { # loop_1 + $B2: { # body ret %5 } } @@ -2279,13 +2279,13 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 - loop [b: %b2] { # loop_1 - %b2 = block { # body + loop [b: $B2] { # loop_1 + $B2: { # body store %2, 2i exit_loop # loop_1 } @@ -2298,14 +2298,14 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 %4:i32 = let %3 - loop [b: %b2] { # loop_1 - %b2 = block { # body + loop [b: $B2] { # loop_1 + $B2: { # body store %2, 2i exit_loop # loop_1 } @@ -2331,16 +2331,16 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:i32 = add 1i, 2i - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - continue %b3 + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + continue # -> $B3 } - %b3 = block { # continuing + $B3: { # continuing %3:bool = eq %2, 3i - break_if %3 %b2 + break_if %3 # -> [t: exit_loop loop_1, f: $B2] } } ret 0i @@ -2370,18 +2370,18 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var %3:i32 = load %2 %4:i32 = add %3, 2i - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - continue %b3 + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + continue # -> $B3 } - %b3 = block { # continuing + $B3: { # continuing %5:bool = eq %4, 3i - break_if %5 %b2 + break_if %5 # -> [t: exit_loop loop_1, f: $B2] } } ret 0i @@ -2394,19 +2394,19 @@ Run(ValueToLet); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var %3:i32 = load %2 %4:i32 = add %3, 2i %5:i32 = let %4 - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - continue %b3 + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + continue # -> $B3 } - %b3 = block { # continuing + $B3: { # continuing %6:bool = eq %5, 3i - break_if %6 %b2 + break_if %6 # -> [t: exit_loop loop_1, f: $B2] } } ret 0i @@ -2433,18 +2433,18 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - continue %b3 + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + continue # -> $B3 } - %b3 = block { # continuing + $B3: { # continuing store %2, 2i - break_if true %b2 + break_if true # -> [t: exit_loop loop_1, f: $B2] } } ret %3 @@ -2455,19 +2455,19 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i %3:i32 = load %2 %4:i32 = let %3 - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body - continue %b3 + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body + continue # -> $B3 } - %b3 = block { # continuing + $B3: { # continuing store %2, 2i - break_if true %b2 + break_if true # -> [t: exit_loop loop_1, f: $B2] } } ret %4 @@ -2498,16 +2498,16 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer %3:i32 = load %2 - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %4:i32 = add %3, 1i store %2, %4 exit_loop # loop_1 @@ -2521,17 +2521,17 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i - loop [i: %b2, b: %b3] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3] { # loop_1 + $B2: { # initializer %3:i32 = load %2 %4:i32 = let %3 - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body + $B3: { # body %5:i32 = add %4, 1i store %2, %5 exit_loop # loop_1 @@ -2566,22 +2566,22 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i - loop [i: %b2, b: %b3, c: %b4] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3, c: $B4] { # loop_1 + $B2: { # initializer %3:i32 = load %2 - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body - continue %b4 + $B3: { # body + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %4:i32 = add %3, 1i store %2, %4 - break_if true %b3 + break_if true # -> [t: exit_loop loop_1, f: $B3] } } ret 3i @@ -2592,23 +2592,23 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i - loop [i: %b2, b: %b3, c: %b4] { # loop_1 - %b2 = block { # initializer + loop [i: $B2, b: $B3, c: $B4] { # loop_1 + $B2: { # initializer %3:i32 = load %2 %4:i32 = let %3 - next_iteration %b3 + next_iteration # -> $B3 } - %b3 = block { # body - continue %b4 + $B3: { # body + continue # -> $B4 } - %b4 = block { # continuing + $B4: { # continuing %5:i32 = add %4, 1i store %2, %5 - break_if true %b3 + break_if true # -> [t: exit_loop loop_1, f: $B3] } } ret 3i @@ -2640,19 +2640,19 @@ }); auto* src = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body %3:i32 = load %2 - continue %b3 + continue # -> $B3 } - %b3 = block { # continuing + $B3: { # continuing %4:i32 = add %3, 1i store %2, %4 - break_if true %b2 + break_if true # -> [t: exit_loop loop_1, f: $B2] } } ret 3i @@ -2663,20 +2663,20 @@ EXPECT_EQ(src, str()); auto* expect = R"( -%f = func():i32 -> %b1 { - %b1 = block { +%f = func():i32 { + $B1: { %2:ptr<function, i32, read_write> = var store %2, 1i - loop [b: %b2, c: %b3] { # loop_1 - %b2 = block { # body + loop [b: $B2, c: $B3] { # loop_1 + $B2: { # body %3:i32 = load %2 %4:i32 = let %3 - continue %b3 + continue # -> $B3 } - %b3 = block { # continuing + $B3: { # continuing %5:i32 = add %4, 1i store %2, %5 - break_if true %b2 + break_if true # -> [t: exit_loop loop_1, f: $B2] } } ret 3i
diff --git a/src/tint/utils/macros/foreach.h b/src/tint/utils/macros/foreach.h index 9ec27cc..f234a38 100644 --- a/src/tint/utils/macros/foreach.h +++ b/src/tint/utils/macros/foreach.h
@@ -39,13 +39,15 @@ /// TINT_COUNT_ARGUMENTS_NTH_ARG is used by TINT_COUNT_ARGUMENTS to get the number of arguments in a /// variadic macro call. #define TINT_COUNT_ARGUMENTS_NTH_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, \ - _15, _16, N, ...) \ + _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, \ + _27, _28, _29, _30, _31, _32, N, ...) \ N /// TINT_COUNT_ARGUMENTS evaluates to the number of arguments passed to the macro -#define TINT_COUNT_ARGUMENTS(...) \ - TINT_MSVC_EXPAND_BUG(TINT_COUNT_ARGUMENTS_NTH_ARG(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, \ - 8, 7, 6, 5, 4, 3, 2, 1, 0)) +#define TINT_COUNT_ARGUMENTS(...) \ + TINT_MSVC_EXPAND_BUG(TINT_COUNT_ARGUMENTS_NTH_ARG( \ + __VA_ARGS__, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, \ + 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)) // Correctness checks. static_assert(1 == TINT_COUNT_ARGUMENTS(a), "TINT_COUNT_ARGUMENTS broken"); @@ -100,5 +102,88 @@ #define TINT_FOREACH_15(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ TINT_FOREACH_14(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ CB(_15) +#define TINT_FOREACH_16(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + TINT_FOREACH_15(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + CB(_16) +#define TINT_FOREACH_17(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17) \ + TINT_FOREACH_16(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + CB(_17) +#define TINT_FOREACH_18(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18) \ + TINT_FOREACH_17(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17) \ + CB(_18) +#define TINT_FOREACH_19(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19) \ + TINT_FOREACH_18(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18) \ + CB(_19) +#define TINT_FOREACH_20(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20) \ + TINT_FOREACH_19(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19) \ + CB(_20) +#define TINT_FOREACH_21(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21) \ + TINT_FOREACH_20(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20) \ + CB(_21) +#define TINT_FOREACH_22(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22) \ + TINT_FOREACH_21(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21) \ + CB(_22) +#define TINT_FOREACH_23(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23) \ + TINT_FOREACH_22(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22) \ + CB(_23) +#define TINT_FOREACH_24(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24) \ + TINT_FOREACH_23(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23) \ + CB(_24) +#define TINT_FOREACH_25(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25) \ + TINT_FOREACH_24(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24) \ + CB(_25) +#define TINT_FOREACH_26(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26) \ + TINT_FOREACH_25(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25) \ + CB(_26) +#define TINT_FOREACH_27(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27) \ + TINT_FOREACH_26(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26) \ + CB(_27) +#define TINT_FOREACH_28(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28) \ + TINT_FOREACH_27(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27) \ + CB(_28) +#define TINT_FOREACH_29(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29) \ + TINT_FOREACH_28(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28) \ + CB(_29) +#define TINT_FOREACH_30(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30) \ + TINT_FOREACH_29(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29) \ + CB(_30) +#define TINT_FOREACH_31(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31) \ + TINT_FOREACH_30(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30) \ + CB(_31) +#define TINT_FOREACH_32(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, \ + _32) \ + TINT_FOREACH_31(CB, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, \ + _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31) \ + CB(_32) #endif // SRC_TINT_UTILS_MACROS_FOREACH_H_