[ir] Update disassembly output.
This CL updates the disassembly output to make it clearer when instructions are flow node traversals, and when they're actual instructions in a block. Bug: tint:1718 Change-Id: I95e103a5672b5579081b73e9633bf07b31e51187 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/133161 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
7ddaaf23cf
commit
0df7f8bccd
|
@ -138,13 +138,14 @@ void Disassembler::Walk(const FlowNode* node) {
|
|||
|
||||
out_ << "]";
|
||||
}
|
||||
out_ << std::endl;
|
||||
out_ << " {" << std::endl;
|
||||
|
||||
{
|
||||
ScopedIndent func_indent(indent_size_);
|
||||
ScopedStopNode scope(stop_nodes_, f->end_target);
|
||||
Walk(f->start_target);
|
||||
}
|
||||
out_ << "} ";
|
||||
Walk(f->end_target);
|
||||
},
|
||||
[&](const ir::Block* b) {
|
||||
|
@ -153,16 +154,23 @@ void Disassembler::Walk(const FlowNode* node) {
|
|||
return;
|
||||
}
|
||||
|
||||
Indent() << "%fn" << IdOf(b) << " = block" << std::endl;
|
||||
EmitBlockInstructions(b);
|
||||
Indent() << "%fn" << IdOf(b) << " = block {" << std::endl;
|
||||
{
|
||||
ScopedIndent si(indent_size_);
|
||||
EmitBlockInstructions(b);
|
||||
}
|
||||
Indent() << "}";
|
||||
|
||||
std::string suffix = "";
|
||||
if (b->branch.target->Is<FunctionTerminator>()) {
|
||||
Indent() << "ret";
|
||||
out_ << " -> %func_end";
|
||||
suffix = "return";
|
||||
} else if (b->branch.target->Is<RootTerminator>()) {
|
||||
// Nothing to do
|
||||
} else {
|
||||
Indent() << "branch "
|
||||
<< "%fn" << IdOf(b->branch.target);
|
||||
out_ << " -> "
|
||||
<< "%fn" << IdOf(b->branch.target);
|
||||
suffix = "branch";
|
||||
}
|
||||
if (!b->branch.args.IsEmpty()) {
|
||||
out_ << " ";
|
||||
|
@ -173,6 +181,9 @@ void Disassembler::Walk(const FlowNode* node) {
|
|||
EmitValue(v);
|
||||
}
|
||||
}
|
||||
if (!suffix.empty()) {
|
||||
out_ << " # " << suffix;
|
||||
}
|
||||
out_ << std::endl;
|
||||
|
||||
if (!b->branch.target->Is<FunctionTerminator>()) {
|
||||
|
@ -294,7 +305,7 @@ void Disassembler::Walk(const FlowNode* node) {
|
|||
},
|
||||
[&](const ir::FunctionTerminator*) {
|
||||
TINT_ASSERT(IR, in_function_);
|
||||
Indent() << "func_end" << std::endl << std::endl;
|
||||
Indent() << "%func_end" << std::endl << std::endl;
|
||||
},
|
||||
[&](const ir::RootTerminator*) {
|
||||
TINT_ASSERT(IR, !in_function_);
|
||||
|
|
|
@ -34,17 +34,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Add) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = add %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = add %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -57,17 +57,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundAdd) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%2:ref<private, u32, read_write> = add %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%2:ref<private, u32, read_write> = add %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -80,17 +80,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Subtract) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = sub %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = sub %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -103,17 +103,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundSubtract) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%2:ref<private, u32, read_write> = sub %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%2:ref<private, u32, read_write> = sub %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -126,17 +126,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Multiply) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = mul %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = mul %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -149,17 +149,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundMultiply) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%2:ref<private, u32, read_write> = mul %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%2:ref<private, u32, read_write> = mul %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -172,17 +172,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Div) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = div %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = div %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -195,17 +195,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundDiv) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%2:ref<private, u32, read_write> = div %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%2:ref<private, u32, read_write> = div %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -218,17 +218,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Modulo) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = mod %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = mod %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -241,17 +241,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundModulo) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%2:ref<private, u32, read_write> = mod %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%2:ref<private, u32, read_write> = mod %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -264,17 +264,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_And) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = and %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = and %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -287,17 +287,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundAnd) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, bool, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, bool, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%2:ref<private, bool, read_write> = and %v1:ref<private, bool, read_write>, false
|
||||
store %v1:ref<private, bool, read_write>, %2:ref<private, bool, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%2:ref<private, bool, read_write> = and %v1:ref<private, bool, read_write>, false
|
||||
store %v1:ref<private, bool, read_write>, %2:ref<private, bool, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -310,17 +310,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Or) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = or %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = or %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -333,17 +333,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundOr) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, bool, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, bool, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%2:ref<private, bool, read_write> = or %v1:ref<private, bool, read_write>, false
|
||||
store %v1:ref<private, bool, read_write>, %2:ref<private, bool, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%2:ref<private, bool, read_write> = or %v1:ref<private, bool, read_write>, false
|
||||
store %v1:ref<private, bool, read_write>, %2:ref<private, bool, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -356,17 +356,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Xor) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = xor %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = xor %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -379,17 +379,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundXor) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%2:ref<private, u32, read_write> = xor %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%2:ref<private, u32, read_write> = xor %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -402,28 +402,28 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_LogicalAnd) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():bool
|
||||
%fn2 = block
|
||||
ret true
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():bool {
|
||||
%fn2 = block {
|
||||
} -> %func_end true # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:bool = call my_func
|
||||
%tint_symbol:bool = var function, read_write
|
||||
store %tint_symbol:bool, %1:bool
|
||||
branch %fn5
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:bool = call my_func
|
||||
%tint_symbol:bool = var function, read_write
|
||||
store %tint_symbol:bool, %1:bool
|
||||
} -> %fn5 # branch
|
||||
|
||||
%fn5 = if %1:bool [t: %fn6, f: %fn7, m: %fn8]
|
||||
# true branch
|
||||
%fn6 = block
|
||||
store %tint_symbol:bool, false
|
||||
branch %fn8
|
||||
%fn6 = block {
|
||||
store %tint_symbol:bool, false
|
||||
} -> %fn8 # branch
|
||||
|
||||
# if merge
|
||||
%fn8 = block
|
||||
ret
|
||||
func_end
|
||||
%fn8 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -436,29 +436,29 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_LogicalOr) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():bool
|
||||
%fn2 = block
|
||||
ret true
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():bool {
|
||||
%fn2 = block {
|
||||
} -> %func_end true # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:bool = call my_func
|
||||
%tint_symbol:bool = var function, read_write
|
||||
store %tint_symbol:bool, %1:bool
|
||||
branch %fn5
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:bool = call my_func
|
||||
%tint_symbol:bool = var function, read_write
|
||||
store %tint_symbol:bool, %1:bool
|
||||
} -> %fn5 # branch
|
||||
|
||||
%fn5 = if %1:bool [t: %fn6, f: %fn7, m: %fn8]
|
||||
# true branch
|
||||
# false branch
|
||||
%fn7 = block
|
||||
store %tint_symbol:bool, true
|
||||
branch %fn8
|
||||
%fn7 = block {
|
||||
store %tint_symbol:bool, true
|
||||
} -> %fn8 # branch
|
||||
|
||||
# if merge
|
||||
%fn8 = block
|
||||
ret
|
||||
func_end
|
||||
%fn8 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -471,17 +471,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Equal) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = eq %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = eq %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -494,17 +494,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_NotEqual) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = neq %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = neq %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -517,17 +517,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_LessThan) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = lt %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = lt %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -540,17 +540,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_GreaterThan) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = gt %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = gt %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -563,17 +563,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_LessThanEqual) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = lte %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = lte %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -586,17 +586,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_GreaterThanEqual) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = gte %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:bool = gte %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -609,17 +609,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_ShiftLeft) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = shiftl %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = shiftl %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -632,17 +632,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundShiftLeft) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%2:ref<private, u32, read_write> = shiftl %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%2:ref<private, u32, read_write> = shiftl %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -655,17 +655,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_ShiftRight) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 0u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = shiftr %1:u32, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = shiftr %1:u32, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -678,17 +678,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundShiftRight) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, u32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%2:ref<private, u32, read_write> = shiftr %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%2:ref<private, u32, read_write> = shiftr %v1:ref<private, u32, read_write>, 1u
|
||||
store %v1:ref<private, u32, read_write>, %2:ref<private, u32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -703,34 +703,34 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Compound) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():f32
|
||||
%fn2 = block
|
||||
ret 0.0f
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():f32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0.0f # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:f32 = call my_func
|
||||
%2:bool = lt %1:f32, 2.0f
|
||||
%tint_symbol:bool = var function, read_write
|
||||
store %tint_symbol:bool, %2:bool
|
||||
branch %fn5
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:f32 = call my_func
|
||||
%2:bool = lt %1:f32, 2.0f
|
||||
%tint_symbol:bool = var function, read_write
|
||||
store %tint_symbol:bool, %2:bool
|
||||
} -> %fn5 # branch
|
||||
|
||||
%fn5 = if %2:bool [t: %fn6, f: %fn7, m: %fn8]
|
||||
# true branch
|
||||
%fn6 = block
|
||||
%4:f32 = call my_func
|
||||
%5:f32 = call my_func
|
||||
%6:f32 = mul 2.29999995231628417969f, %5:f32
|
||||
%7:f32 = div %4:f32, %6:f32
|
||||
%8:bool = gt 2.5f, %7:f32
|
||||
store %tint_symbol:bool, %8:bool
|
||||
branch %fn8
|
||||
%fn6 = block {
|
||||
%4:f32 = call my_func
|
||||
%5:f32 = call my_func
|
||||
%6:f32 = mul 2.29999995231628417969f, %5:f32
|
||||
%7:f32 = div %4:f32, %6:f32
|
||||
%8:bool = gt 2.5f, %7:f32
|
||||
store %tint_symbol:bool, %8:bool
|
||||
} -> %fn8 # branch
|
||||
|
||||
# if merge
|
||||
%fn8 = block
|
||||
ret
|
||||
func_end
|
||||
%fn8 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -744,16 +744,16 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Compound_WithConstEval) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():bool
|
||||
%fn2 = block
|
||||
ret true
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():bool {
|
||||
%fn2 = block {
|
||||
} -> %func_end true # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%tint_symbol:bool = call my_func, false
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%tint_symbol:bool = call my_func, false
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
|
|
@ -35,17 +35,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Bitcast) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():f32
|
||||
%fn2 = block
|
||||
ret 0.0f
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():f32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 0.0f # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:f32 = call my_func
|
||||
%tint_symbol:f32 = bitcast %1:f32
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:f32 = call my_func
|
||||
%tint_symbol:f32 = bitcast %1:f32
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -60,11 +60,11 @@ TEST_F(IR_BuilderImplTest, EmitStatement_Discard) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func test_function():void [@fragment]
|
||||
%fn2 = block
|
||||
discard
|
||||
ret
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func test_function():void [@fragment] {
|
||||
%fn2 = block {
|
||||
discard
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -77,16 +77,16 @@ TEST_F(IR_BuilderImplTest, EmitStatement_UserFunction) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():void
|
||||
%fn2 = block
|
||||
ret
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():void {
|
||||
%fn2 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:void = call my_func, 6.0f
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:void = call my_func, 6.0f
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -99,16 +99,16 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Convert) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%i:ref<private, i32, read_write> = var private, read_write, 1i
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%i:ref<private, i32, read_write> = var private, read_write, 1i
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%tint_symbol:f32 = convert i32, %i:ref<private, i32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%tint_symbol:f32 = convert i32, %i:ref<private, i32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -120,9 +120,9 @@ TEST_F(IR_BuilderImplTest, EmitExpression_ConstructEmpty) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%i:ref<private, vec3<f32>, read_write> = var private, read_write, vec3<f32> 0.0f
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%i:ref<private, vec3<f32>, read_write> = var private, read_write, vec3<f32> 0.0f
|
||||
}
|
||||
|
||||
|
||||
)");
|
||||
|
@ -136,16 +136,16 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Construct) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%i:ref<private, f32, read_write> = var private, read_write, 1.0f
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%i:ref<private, f32, read_write> = var private, read_write, 1.0f
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%tint_symbol:vec3<f32> = construct 2.0f, 3.0f, %i:ref<private, f32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%tint_symbol:vec3<f32> = construct 2.0f, 3.0f, %i:ref<private, f32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
|
|
@ -34,10 +34,10 @@ TEST_F(IR_BuilderImplTest, EmitExpression_MaterializedCall) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func test_function():f32
|
||||
%fn2 = block
|
||||
ret 2.0f
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func test_function():f32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 2.0f # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
|
|
@ -35,16 +35,16 @@ TEST_F(IR_BuilderImplTest, EmitStatement_Assign) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%a:ref<private, u32, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%a:ref<private, u32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
store %a:ref<private, u32, read_write>, 4u
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
store %a:ref<private, u32, read_write>, 4u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
|
|
@ -71,10 +71,10 @@ TEST_F(IR_BuilderImplTest, Func) {
|
|||
|
||||
EXPECT_EQ(m->functions[0]->pipeline_stage, Function::PipelineStage::kUndefined);
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func f():void
|
||||
%fn2 = block
|
||||
ret
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func f():void {
|
||||
%fn2 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -112,23 +112,23 @@ TEST_F(IR_BuilderImplTest, IfStatement) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = if true [t: %fn4, f: %fn5, m: %fn6]
|
||||
# true branch
|
||||
%fn4 = block
|
||||
branch %fn6
|
||||
%fn4 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# false branch
|
||||
%fn5 = block
|
||||
branch %fn6
|
||||
%fn5 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# if merge
|
||||
%fn6 = block
|
||||
ret
|
||||
func_end
|
||||
%fn6 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -156,22 +156,22 @@ TEST_F(IR_BuilderImplTest, IfStatement_TrueReturns) {
|
|||
EXPECT_EQ(2u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = if true [t: %fn4, f: %fn5, m: %fn6]
|
||||
# true branch
|
||||
%fn4 = block
|
||||
ret
|
||||
%fn4 = block {
|
||||
} -> %func_end # return
|
||||
# false branch
|
||||
%fn5 = block
|
||||
branch %fn6
|
||||
%fn5 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# if merge
|
||||
%fn6 = block
|
||||
ret
|
||||
func_end
|
||||
%fn6 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -199,22 +199,22 @@ TEST_F(IR_BuilderImplTest, IfStatement_FalseReturns) {
|
|||
EXPECT_EQ(2u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = if true [t: %fn4, f: %fn5, m: %fn6]
|
||||
# true branch
|
||||
%fn4 = block
|
||||
branch %fn6
|
||||
%fn4 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# false branch
|
||||
%fn5 = block
|
||||
ret
|
||||
%fn5 = block {
|
||||
} -> %func_end # return
|
||||
# if merge
|
||||
%fn6 = block
|
||||
ret
|
||||
func_end
|
||||
%fn6 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -242,18 +242,18 @@ TEST_F(IR_BuilderImplTest, IfStatement_BothReturn) {
|
|||
EXPECT_EQ(2u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = if true [t: %fn4, f: %fn5]
|
||||
# true branch
|
||||
%fn4 = block
|
||||
ret
|
||||
%fn4 = block {
|
||||
} -> %func_end # return
|
||||
# false branch
|
||||
%fn5 = block
|
||||
ret
|
||||
func_end
|
||||
%fn5 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -278,32 +278,32 @@ TEST_F(IR_BuilderImplTest, IfStatement_JumpChainToMerge) {
|
|||
ASSERT_NE(loop_flow->merge.target, nullptr);
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = if true [t: %fn4, f: %fn5, m: %fn6]
|
||||
# true branch
|
||||
%fn4 = block
|
||||
branch %fn7
|
||||
%fn4 = block {
|
||||
} -> %fn7 # branch
|
||||
|
||||
%fn7 = loop [s: %fn8, m: %fn9]
|
||||
# loop start
|
||||
%fn8 = block
|
||||
branch %fn9
|
||||
%fn8 = block {
|
||||
} -> %fn9 # branch
|
||||
|
||||
# loop merge
|
||||
%fn9 = block
|
||||
branch %fn6
|
||||
%fn9 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# false branch
|
||||
%fn5 = block
|
||||
branch %fn6
|
||||
%fn5 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# if merge
|
||||
%fn6 = block
|
||||
ret
|
||||
func_end
|
||||
%fn6 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -331,19 +331,19 @@ TEST_F(IR_BuilderImplTest, Loop_WithBreak) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4, m: %fn5]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
branch %fn5
|
||||
%fn4 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# loop merge
|
||||
%fn5 = block
|
||||
ret
|
||||
func_end
|
||||
%fn5 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -381,36 +381,36 @@ TEST_F(IR_BuilderImplTest, Loop_WithContinue) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4, c: %fn5, m: %fn6]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
branch %fn7
|
||||
%fn4 = block {
|
||||
} -> %fn7 # branch
|
||||
|
||||
%fn7 = if true [t: %fn8, f: %fn9, m: %fn10]
|
||||
# true branch
|
||||
%fn8 = block
|
||||
branch %fn6
|
||||
%fn8 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# false branch
|
||||
%fn9 = block
|
||||
branch %fn10
|
||||
%fn9 = block {
|
||||
} -> %fn10 # branch
|
||||
|
||||
# if merge
|
||||
%fn10 = block
|
||||
branch %fn5
|
||||
%fn10 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# loop continuing
|
||||
%fn5 = block
|
||||
branch %fn4
|
||||
%fn5 = block {
|
||||
} -> %fn4 # branch
|
||||
|
||||
# loop merge
|
||||
%fn6 = block
|
||||
ret
|
||||
func_end
|
||||
%fn6 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -448,36 +448,36 @@ TEST_F(IR_BuilderImplTest, Loop_WithContinuing_BreakIf) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4, c: %fn5, m: %fn6]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
branch %fn5
|
||||
%fn4 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# loop continuing
|
||||
%fn5 = block
|
||||
branch %fn7
|
||||
%fn5 = block {
|
||||
} -> %fn7 # branch
|
||||
|
||||
%fn7 = if true [t: %fn8, f: %fn9, m: %fn10]
|
||||
# true branch
|
||||
%fn8 = block
|
||||
branch %fn6
|
||||
%fn8 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# false branch
|
||||
%fn9 = block
|
||||
branch %fn10
|
||||
%fn9 = block {
|
||||
} -> %fn10 # branch
|
||||
|
||||
# if merge
|
||||
%fn10 = block
|
||||
branch %fn4
|
||||
%fn10 = block {
|
||||
} -> %fn4 # branch
|
||||
|
||||
# loop merge
|
||||
%fn6 = block
|
||||
ret
|
||||
func_end
|
||||
%fn6 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -492,36 +492,36 @@ TEST_F(IR_BuilderImplTest, Loop_Continuing_Body_Scope) {
|
|||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4, c: %fn5, m: %fn6]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
branch %fn5
|
||||
%fn4 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# loop continuing
|
||||
%fn5 = block
|
||||
branch %fn7
|
||||
%fn5 = block {
|
||||
} -> %fn7 # branch
|
||||
|
||||
%fn7 = if true [t: %fn8, f: %fn9, m: %fn10]
|
||||
# true branch
|
||||
%fn8 = block
|
||||
branch %fn6
|
||||
%fn8 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# false branch
|
||||
%fn9 = block
|
||||
branch %fn10
|
||||
%fn9 = block {
|
||||
} -> %fn10 # branch
|
||||
|
||||
# if merge
|
||||
%fn10 = block
|
||||
branch %fn4
|
||||
%fn10 = block {
|
||||
} -> %fn4 # branch
|
||||
|
||||
# loop merge
|
||||
%fn6 = block
|
||||
ret
|
||||
func_end
|
||||
%fn6 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -559,32 +559,32 @@ TEST_F(IR_BuilderImplTest, Loop_WithReturn) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4, c: %fn5]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
branch %fn6
|
||||
%fn4 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
%fn6 = if true [t: %fn7, f: %fn8, m: %fn9]
|
||||
# true branch
|
||||
%fn7 = block
|
||||
ret
|
||||
%fn7 = block {
|
||||
} -> %func_end # return
|
||||
# false branch
|
||||
%fn8 = block
|
||||
branch %fn9
|
||||
%fn8 = block {
|
||||
} -> %fn9 # branch
|
||||
|
||||
# if merge
|
||||
%fn9 = block
|
||||
branch %fn5
|
||||
%fn9 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# loop continuing
|
||||
%fn5 = block
|
||||
branch %fn4
|
||||
%fn5 = block {
|
||||
} -> %fn4 # branch
|
||||
|
||||
func_end
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -612,15 +612,15 @@ TEST_F(IR_BuilderImplTest, Loop_WithOnlyReturn) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
ret
|
||||
func_end
|
||||
%fn4 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -663,15 +663,15 @@ TEST_F(IR_BuilderImplTest, Loop_WithOnlyReturn_ContinuingBreakIf) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
ret
|
||||
func_end
|
||||
%fn4 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -709,28 +709,28 @@ TEST_F(IR_BuilderImplTest, Loop_WithIf_BothBranchesBreak) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4, m: %fn5]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
branch %fn6
|
||||
%fn4 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
%fn6 = if true [t: %fn7, f: %fn8]
|
||||
# true branch
|
||||
%fn7 = block
|
||||
branch %fn5
|
||||
%fn7 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# false branch
|
||||
%fn8 = block
|
||||
branch %fn5
|
||||
%fn8 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# loop merge
|
||||
%fn5 = block
|
||||
ret
|
||||
func_end
|
||||
%fn5 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -848,110 +848,110 @@ TEST_F(IR_BuilderImplTest, Loop_Nested) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4, c: %fn5, m: %fn6]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
branch %fn7
|
||||
%fn4 = block {
|
||||
} -> %fn7 # branch
|
||||
|
||||
%fn7 = loop [s: %fn8, c: %fn9, m: %fn10]
|
||||
# loop start
|
||||
%fn8 = block
|
||||
branch %fn11
|
||||
%fn8 = block {
|
||||
} -> %fn11 # branch
|
||||
|
||||
%fn11 = if true [t: %fn12, f: %fn13, m: %fn14]
|
||||
# true branch
|
||||
%fn12 = block
|
||||
branch %fn10
|
||||
%fn12 = block {
|
||||
} -> %fn10 # branch
|
||||
|
||||
# false branch
|
||||
%fn13 = block
|
||||
branch %fn14
|
||||
%fn13 = block {
|
||||
} -> %fn14 # branch
|
||||
|
||||
# if merge
|
||||
%fn14 = block
|
||||
branch %fn15
|
||||
%fn14 = block {
|
||||
} -> %fn15 # branch
|
||||
|
||||
%fn15 = if true [t: %fn16, f: %fn17, m: %fn18]
|
||||
# true branch
|
||||
%fn16 = block
|
||||
branch %fn9
|
||||
%fn16 = block {
|
||||
} -> %fn9 # branch
|
||||
|
||||
# false branch
|
||||
%fn17 = block
|
||||
branch %fn18
|
||||
%fn17 = block {
|
||||
} -> %fn18 # branch
|
||||
|
||||
# if merge
|
||||
%fn18 = block
|
||||
branch %fn9
|
||||
%fn18 = block {
|
||||
} -> %fn9 # branch
|
||||
|
||||
# loop continuing
|
||||
%fn9 = block
|
||||
branch %fn19
|
||||
%fn9 = block {
|
||||
} -> %fn19 # branch
|
||||
|
||||
%fn19 = loop [s: %fn20, m: %fn21]
|
||||
# loop start
|
||||
%fn20 = block
|
||||
branch %fn21
|
||||
%fn20 = block {
|
||||
} -> %fn21 # branch
|
||||
|
||||
# loop merge
|
||||
%fn21 = block
|
||||
branch %fn22
|
||||
%fn21 = block {
|
||||
} -> %fn22 # branch
|
||||
|
||||
%fn22 = loop [s: %fn23, c: %fn24, m: %fn25]
|
||||
# loop start
|
||||
%fn23 = block
|
||||
branch %fn24
|
||||
%fn23 = block {
|
||||
} -> %fn24 # branch
|
||||
|
||||
# loop continuing
|
||||
%fn24 = block
|
||||
branch %fn26
|
||||
%fn24 = block {
|
||||
} -> %fn26 # branch
|
||||
|
||||
%fn26 = if true [t: %fn27, f: %fn28, m: %fn29]
|
||||
# true branch
|
||||
%fn27 = block
|
||||
branch %fn25
|
||||
%fn27 = block {
|
||||
} -> %fn25 # branch
|
||||
|
||||
# false branch
|
||||
%fn28 = block
|
||||
branch %fn29
|
||||
%fn28 = block {
|
||||
} -> %fn29 # branch
|
||||
|
||||
# if merge
|
||||
%fn29 = block
|
||||
branch %fn23
|
||||
%fn29 = block {
|
||||
} -> %fn23 # branch
|
||||
|
||||
# loop merge
|
||||
%fn25 = block
|
||||
branch %fn8
|
||||
%fn25 = block {
|
||||
} -> %fn8 # branch
|
||||
|
||||
# loop merge
|
||||
%fn10 = block
|
||||
branch %fn30
|
||||
%fn10 = block {
|
||||
} -> %fn30 # branch
|
||||
|
||||
%fn30 = if true [t: %fn31, f: %fn32, m: %fn33]
|
||||
# true branch
|
||||
%fn31 = block
|
||||
branch %fn6
|
||||
%fn31 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# false branch
|
||||
%fn32 = block
|
||||
branch %fn33
|
||||
%fn32 = block {
|
||||
} -> %fn33 # branch
|
||||
|
||||
# if merge
|
||||
%fn33 = block
|
||||
branch %fn5
|
||||
%fn33 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# loop continuing
|
||||
%fn5 = block
|
||||
branch %fn4
|
||||
%fn5 = block {
|
||||
} -> %fn4 # branch
|
||||
|
||||
# loop merge
|
||||
%fn6 = block
|
||||
ret
|
||||
func_end
|
||||
%fn6 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -988,36 +988,36 @@ TEST_F(IR_BuilderImplTest, While) {
|
|||
EXPECT_EQ(1u, if_flow->merge.target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4, c: %fn5, m: %fn6]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
branch %fn7
|
||||
%fn4 = block {
|
||||
} -> %fn7 # branch
|
||||
|
||||
%fn7 = if false [t: %fn8, f: %fn9, m: %fn10]
|
||||
# true branch
|
||||
%fn8 = block
|
||||
branch %fn10
|
||||
%fn8 = block {
|
||||
} -> %fn10 # branch
|
||||
|
||||
# false branch
|
||||
%fn9 = block
|
||||
branch %fn6
|
||||
%fn9 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# if merge
|
||||
%fn10 = block
|
||||
branch %fn5
|
||||
%fn10 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# loop continuing
|
||||
%fn5 = block
|
||||
branch %fn4
|
||||
%fn5 = block {
|
||||
} -> %fn4 # branch
|
||||
|
||||
# loop merge
|
||||
%fn6 = block
|
||||
ret
|
||||
func_end
|
||||
%fn6 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -1054,31 +1054,31 @@ TEST_F(IR_BuilderImplTest, While_Return) {
|
|||
EXPECT_EQ(1u, if_flow->merge.target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4, m: %fn5]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
branch %fn6
|
||||
%fn4 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
%fn6 = if true [t: %fn7, f: %fn8, m: %fn9]
|
||||
# true branch
|
||||
%fn7 = block
|
||||
branch %fn9
|
||||
%fn7 = block {
|
||||
} -> %fn9 # branch
|
||||
|
||||
# false branch
|
||||
%fn8 = block
|
||||
branch %fn5
|
||||
%fn8 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# if merge
|
||||
%fn9 = block
|
||||
ret
|
||||
%fn9 = block {
|
||||
} -> %func_end # return
|
||||
# loop merge
|
||||
%fn5 = block
|
||||
ret
|
||||
func_end
|
||||
%fn5 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -1152,19 +1152,19 @@ TEST_F(IR_BuilderImplTest, For_NoInitCondOrContinuing) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = loop [s: %fn4, m: %fn5]
|
||||
# loop start
|
||||
%fn4 = block
|
||||
branch %fn5
|
||||
%fn4 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# loop merge
|
||||
%fn5 = block
|
||||
ret
|
||||
func_end
|
||||
%fn5 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -1207,27 +1207,27 @@ TEST_F(IR_BuilderImplTest, Switch) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = switch 1i [c: (0i, %fn4), c: (1i, %fn5), c: (default, %fn6), m: %fn7]
|
||||
# case 0i
|
||||
%fn4 = block
|
||||
branch %fn7
|
||||
%fn4 = block {
|
||||
} -> %fn7 # branch
|
||||
|
||||
# case 1i
|
||||
%fn5 = block
|
||||
branch %fn7
|
||||
%fn5 = block {
|
||||
} -> %fn7 # branch
|
||||
|
||||
# case default
|
||||
%fn6 = block
|
||||
branch %fn7
|
||||
%fn6 = block {
|
||||
} -> %fn7 # branch
|
||||
|
||||
# switch merge
|
||||
%fn7 = block
|
||||
ret
|
||||
func_end
|
||||
%fn7 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -1267,19 +1267,19 @@ TEST_F(IR_BuilderImplTest, Switch_MultiSelector) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = switch 1i [c: (0i 1i default, %fn4), m: %fn5]
|
||||
# case 0i 1i default
|
||||
%fn4 = block
|
||||
branch %fn5
|
||||
%fn4 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# switch merge
|
||||
%fn5 = block
|
||||
ret
|
||||
func_end
|
||||
%fn5 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -1307,19 +1307,19 @@ TEST_F(IR_BuilderImplTest, Switch_OnlyDefault) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = switch 1i [c: (default, %fn4), m: %fn5]
|
||||
# case default
|
||||
%fn4 = block
|
||||
branch %fn5
|
||||
%fn4 = block {
|
||||
} -> %fn5 # branch
|
||||
|
||||
# switch merge
|
||||
%fn5 = block
|
||||
ret
|
||||
func_end
|
||||
%fn5 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -1356,23 +1356,23 @@ TEST_F(IR_BuilderImplTest, Switch_WithBreak) {
|
|||
EXPECT_EQ(1u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = switch 1i [c: (0i, %fn4), c: (default, %fn5), m: %fn6]
|
||||
# case 0i
|
||||
%fn4 = block
|
||||
branch %fn6
|
||||
%fn4 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# case default
|
||||
%fn5 = block
|
||||
branch %fn6
|
||||
%fn5 = block {
|
||||
} -> %fn6 # branch
|
||||
|
||||
# switch merge
|
||||
%fn6 = block
|
||||
ret
|
||||
func_end
|
||||
%fn6 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -1411,18 +1411,18 @@ TEST_F(IR_BuilderImplTest, Switch_AllReturn) {
|
|||
EXPECT_EQ(2u, func->end_target->inbound_branches.Length());
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
branch %fn3
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
} -> %fn3 # branch
|
||||
|
||||
%fn3 = switch 1i [c: (0i, %fn4), c: (default, %fn5)]
|
||||
# case 0i
|
||||
%fn4 = block
|
||||
ret
|
||||
%fn4 = block {
|
||||
} -> %func_end # return
|
||||
# case default
|
||||
%fn5 = block
|
||||
ret
|
||||
func_end
|
||||
%fn5 = block {
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
|
|
@ -34,17 +34,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Unary_Not) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():bool
|
||||
%fn2 = block
|
||||
ret false
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():bool {
|
||||
%fn2 = block {
|
||||
} -> %func_end false # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:bool = call my_func
|
||||
%tint_symbol:bool = eq %1:bool, false
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:bool = call my_func
|
||||
%tint_symbol:bool = eq %1:bool, false
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -57,17 +57,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Unary_Complement) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32
|
||||
%fn2 = block
|
||||
ret 1u
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():u32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 1u # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = complement %1:u32
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:u32 = call my_func
|
||||
%tint_symbol:u32 = complement %1:u32
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -80,17 +80,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Unary_Negation) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():i32
|
||||
%fn2 = block
|
||||
ret 1i
|
||||
func_end
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = func my_func():i32 {
|
||||
%fn2 = block {
|
||||
} -> %func_end 1i # return
|
||||
} %func_end
|
||||
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn4 = block
|
||||
%1:i32 = call my_func
|
||||
%tint_symbol:i32 = negation %1:i32
|
||||
ret
|
||||
func_end
|
||||
%fn3 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn4 = block {
|
||||
%1:i32 = call my_func
|
||||
%tint_symbol:i32 = negation %1:i32
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -104,16 +104,16 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Unary_AddressOf) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, i32, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, i32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%v2:ptr<private, i32, read_write> = addr_of %v1:ref<private, i32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%v2:ptr<private, i32, read_write> = addr_of %v1:ref<private, i32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -129,17 +129,17 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Unary_Indirection) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%v1:ref<private, i32, read_write> = var private, read_write
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%v1:ref<private, i32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn3 = block
|
||||
%v3:ptr<private, i32, read_write> = addr_of %v1:ref<private, i32, read_write>
|
||||
%v2:i32 = indirection %v3:ptr<private, i32, read_write>
|
||||
ret
|
||||
func_end
|
||||
%fn2 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn3 = block {
|
||||
%v3:ptr<private, i32, read_write> = addr_of %v1:ref<private, i32, read_write>
|
||||
%v2:i32 = indirection %v3:ptr<private, i32, read_write>
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
|
|
@ -32,9 +32,9 @@ TEST_F(IR_BuilderImplTest, Emit_GlobalVar_NoInit) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%a:ref<private, u32, read_write> = var private, read_write
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%a:ref<private, u32, read_write> = var private, read_write
|
||||
}
|
||||
|
||||
|
||||
)");
|
||||
|
@ -47,9 +47,9 @@ TEST_F(IR_BuilderImplTest, Emit_GlobalVar_Init) {
|
|||
auto m = Build();
|
||||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block
|
||||
%a:ref<private, u32, read_write> = var private, read_write, 2u
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()), R"(%fn1 = block {
|
||||
%a:ref<private, u32, read_write> = var private, read_write, 2u
|
||||
}
|
||||
|
||||
|
||||
)");
|
||||
|
@ -63,11 +63,11 @@ TEST_F(IR_BuilderImplTest, Emit_Var_NoInit) {
|
|||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
%a:ref<function, u32, read_write> = var function, read_write
|
||||
ret
|
||||
func_end
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
%a:ref<function, u32, read_write> = var function, read_write
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
@ -81,11 +81,11 @@ TEST_F(IR_BuilderImplTest, Emit_Var_Init) {
|
|||
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
|
||||
|
||||
EXPECT_EQ(Disassemble(m.Get()),
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)]
|
||||
%fn2 = block
|
||||
%a:ref<function, u32, read_write> = var function, read_write, 2u
|
||||
ret
|
||||
func_end
|
||||
R"(%fn1 = func test_function():void [@compute @workgroup_size(1, 1, 1)] {
|
||||
%fn2 = block {
|
||||
%a:ref<function, u32, read_write> = var function, read_write, 2u
|
||||
} -> %func_end # return
|
||||
} %func_end
|
||||
|
||||
)");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue