[ir] Rename %fn to %b.

The FlowNode concept is gone, rename the symbol in the disassembly.

Bug: tint:1718
Change-Id: I8a7b5d8113a033592de5ca013cf8839330a7686c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134460
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2023-05-25 14:12:52 +00:00 committed by Dawn LUCI CQ
parent 686d2e2d4d
commit 32b6746cd9
11 changed files with 768 additions and 768 deletions

View File

@ -110,12 +110,12 @@ void Disassembler::Walk(const Block* blk) {
blk,
[&](const ir::FunctionTerminator* t) {
TINT_ASSERT(IR, in_function_);
Indent() << "%fn" << IdOf(t) << " = func_terminator" << std::endl;
Indent() << "%b" << IdOf(t) << " = func_terminator" << std::endl;
in_function_ = false;
},
[&](const ir::RootTerminator* t) {
TINT_ASSERT(IR, !in_function_);
Indent() << "%fn" << IdOf(t) << " = root_terminator" << std::endl << std::endl;
Indent() << "%b" << IdOf(t) << " = root_terminator" << std::endl << std::endl;
},
[&](const ir::Block* b) {
// If this block is dead, nothing to do
@ -123,7 +123,7 @@ void Disassembler::Walk(const Block* blk) {
return;
}
Indent() << "%fn" << IdOf(b) << " = block";
Indent() << "%b" << IdOf(b) << " = block";
if (!b->Params().IsEmpty()) {
out_ << " (";
for (auto* p : b->Params()) {
@ -181,7 +181,7 @@ void Disassembler::EmitFunction(const Function* func) {
out_ << "]";
}
out_ << " -> %fn" << IdOf(func->StartTarget()) << " {" << std::endl;
out_ << " -> %b" << IdOf(func->StartTarget()) << " {" << std::endl;
{
ScopedIndent si(indent_size_);
@ -319,16 +319,16 @@ void Disassembler::EmitIf(const If* i) {
out_ << " [";
if (has_true) {
out_ << "t: %fn" << IdOf(i->True());
out_ << "t: %b" << IdOf(i->True());
}
if (has_false) {
if (has_true) {
out_ << ", ";
}
out_ << "f: %fn" << IdOf(i->False());
out_ << "f: %b" << IdOf(i->False());
}
if (i->Merge()->HasBranchTarget()) {
out_ << ", m: %fn" << IdOf(i->Merge());
out_ << ", m: %b" << IdOf(i->Merge());
}
out_ << "]" << std::endl;
@ -349,13 +349,13 @@ void Disassembler::EmitIf(const If* i) {
}
void Disassembler::EmitLoop(const Loop* l) {
out_ << "loop [s: %fn" << IdOf(l->Start());
out_ << "loop [s: %b" << IdOf(l->Start());
if (l->Continuing()->HasBranchTarget()) {
out_ << ", c: %fn" << IdOf(l->Continuing());
out_ << ", c: %b" << IdOf(l->Continuing());
}
if (l->Merge()->HasBranchTarget()) {
out_ << ", m: %fn" << IdOf(l->Merge());
out_ << ", m: %b" << IdOf(l->Merge());
}
out_ << "]" << std::endl;
@ -395,10 +395,10 @@ void Disassembler::EmitSwitch(const Switch* s) {
EmitValue(selector.val);
}
}
out_ << ", %fn" << IdOf(c.Start()) << ")";
out_ << ", %b" << IdOf(c.Start()) << ")";
}
if (s->Merge()->HasBranchTarget()) {
out_ << ", m: %fn" << IdOf(s->Merge());
out_ << ", m: %b" << IdOf(s->Merge());
}
out_ << "]" << std::endl;
@ -415,7 +415,7 @@ void Disassembler::EmitSwitch(const Switch* s) {
void Disassembler::EmitBranch(const Branch* b) {
std::string suffix = "";
out_ << "br %fn" << IdOf(b->To());
out_ << "br %b" << IdOf(b->To());
if (b->To()->Is<FunctionTerminator>()) {
suffix = "return";
} else if (b->To()->Is<RootTerminator>()) {

View File

@ -34,19 +34,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Add) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:u32 = add %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -60,21 +60,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Increment) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, u32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = load %v1
%4:u32 = add %3, 1u
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -88,21 +88,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundAdd) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, u32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = load %v1
%4:u32 = add %3, 1u
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -115,19 +115,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Subtract) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:u32 = sub %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -141,21 +141,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Decrement) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, i32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:i32 = load %v1
%4:i32 = sub %3, 1i
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -169,21 +169,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundSubtract) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, u32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = load %v1
%4:u32 = sub %3, 1u
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -196,19 +196,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Multiply) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:u32 = mul %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -222,21 +222,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundMultiply) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, u32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = load %v1
%4:u32 = mul %3, 1u
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -249,19 +249,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Div) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:u32 = div %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -275,21 +275,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundDiv) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, u32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = load %v1
%4:u32 = div %3, 1u
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -302,19 +302,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Modulo) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:u32 = mod %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -328,21 +328,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundModulo) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, u32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = load %v1
%4:u32 = mod %3, 1u
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -355,19 +355,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_And) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:u32 = and %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -381,21 +381,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundAnd) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, bool, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:bool = load %v1
%4:bool = and %3, false
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -408,19 +408,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Or) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:u32 = or %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -434,21 +434,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundOr) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, bool, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:bool = load %v1
%4:bool = or %3, false
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -461,19 +461,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Xor) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:u32 = xor %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -487,21 +487,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundXor) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, u32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = load %v1
%4:u32 = xor %3, 1u
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -514,42 +514,42 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_LogicalAnd) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool -> %fn1 {
%fn1 = block {
br %fn2 true # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool -> %b1 {
%b1 = block {
br %b2 true # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:bool = call %my_func
if %3 [t: %fn4, f: %fn5, m: %fn6]
if %3 [t: %b4, f: %b5, m: %b6]
# True block
%fn4 = block {
br %fn6 false
%b4 = block {
br %b6 false
}
# False block
%fn5 = block {
br %fn6 %3
%b5 = block {
br %b6 %3
}
# Merge block
%fn6 = block (%4:bool) {
if %4:bool [t: %fn7, f: %fn8, m: %fn9]
%b6 = block (%4:bool) {
if %4:bool [t: %b7, f: %b8, m: %b9]
# True block
%fn7 = block {
br %fn9
%b7 = block {
br %b9
}
# False block
%fn8 = block {
br %fn9
%b8 = block {
br %b9
}
# Merge block
%fn9 = block {
br %fn10 # return
%b9 = block {
br %b10 # return
}
}
@ -557,7 +557,7 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_LogicalAnd) {
}
%fn10 = func_terminator
%b10 = func_terminator
}
)");
}
@ -570,42 +570,42 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_LogicalOr) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool -> %fn1 {
%fn1 = block {
br %fn2 true # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool -> %b1 {
%b1 = block {
br %b2 true # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:bool = call %my_func
if %3 [t: %fn4, f: %fn5, m: %fn6]
if %3 [t: %b4, f: %b5, m: %b6]
# True block
%fn4 = block {
br %fn6 %3
%b4 = block {
br %b6 %3
}
# False block
%fn5 = block {
br %fn6 true
%b5 = block {
br %b6 true
}
# Merge block
%fn6 = block (%4:bool) {
if %4:bool [t: %fn7, f: %fn8, m: %fn9]
%b6 = block (%4:bool) {
if %4:bool [t: %b7, f: %b8, m: %b9]
# True block
%fn7 = block {
br %fn9
%b7 = block {
br %b9
}
# False block
%fn8 = block {
br %fn9
%b8 = block {
br %b9
}
# Merge block
%fn9 = block {
br %fn10 # return
%b9 = block {
br %b10 # return
}
}
@ -613,7 +613,7 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_LogicalOr) {
}
%fn10 = func_terminator
%b10 = func_terminator
}
)");
}
@ -626,19 +626,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Equal) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:bool = eq %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -651,19 +651,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_NotEqual) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:bool = neq %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -676,19 +676,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_LessThan) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:bool = lt %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -701,19 +701,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_GreaterThan) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:bool = gt %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -726,19 +726,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_LessThanEqual) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:bool = lte %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -751,19 +751,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_GreaterThanEqual) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:bool = gte %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -776,19 +776,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_ShiftLeft) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:u32 = shiftl %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -802,21 +802,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundShiftLeft) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, u32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = load %v1
%4:u32 = shiftl %3, 1u
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -829,19 +829,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_ShiftRight) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 0u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 0u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:u32 = shiftr %3, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -855,21 +855,21 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_CompoundShiftRight) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v1:ptr<private, u32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = load %v1
%4:u32 = shiftr %3, 1u
store %v1, %4
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -884,40 +884,40 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Compound) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():f32 -> %fn1 {
%fn1 = block {
br %fn2 0.0f # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():f32 -> %b1 {
%b1 = block {
br %b2 0.0f # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:f32 = call %my_func
%4:bool = lt %3, 2.0f
if %4 [t: %fn4, f: %fn5, m: %fn6]
if %4 [t: %b4, f: %b5, m: %b6]
# True block
%fn4 = block {
%b4 = block {
%5:f32 = call %my_func
%6:f32 = call %my_func
%7:f32 = mul 2.29999995231628417969f, %6
%8:f32 = div %5, %7
%9:bool = gt 2.5f, %8
br %fn6 %9
br %b6 %9
}
# False block
%fn5 = block {
br %fn6 %4
%b5 = block {
br %b6 %4
}
# Merge block
%fn6 = block (%tint_symbol:bool) {
br %fn7 # return
%b6 = block (%tint_symbol:bool) {
br %b7 # return
}
}
%fn7 = func_terminator
%b7 = func_terminator
}
)");
}
@ -931,18 +931,18 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Binary_Compound_WithConstEval) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func(%p:bool):bool -> %fn1 {
%fn1 = block {
br %fn2 true # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func(%p:bool):bool -> %b1 {
%b1 = block {
br %b2 true # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%tint_symbol:bool = call %my_func, false
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}

View File

@ -35,20 +35,20 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Builtin) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%i:ptr<private, f32, read_write> = var, 1.0f
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:f32 = load %i
%tint_symbol:f32 = asin %3
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}

View File

@ -35,19 +35,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Bitcast) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():f32 -> %fn1 {
%fn1 = block {
br %fn2 0.0f # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():f32 -> %b1 {
%b1 = block {
br %b2 0.0f # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:f32 = call %my_func
%tint_symbol:f32 = bitcast %3
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -62,12 +62,12 @@ TEST_F(IR_BuilderImplTest, EmitStatement_Discard) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%test_function = func():void [@fragment] -> %fn1 {
%fn1 = block {
EXPECT_EQ(Disassemble(m.Get()), R"(%test_function = func():void [@fragment] -> %b1 {
%b1 = block {
discard
br %fn2 # return
br %b2 # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}
@ -80,18 +80,18 @@ TEST_F(IR_BuilderImplTest, EmitStatement_UserFunction) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func(%p:f32):void -> %fn1 {
%fn1 = block {
br %fn2 # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func(%p:f32):void -> %b1 {
%b1 = block {
br %b2 # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%4:void = call %my_func, 6.0f
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -105,20 +105,20 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Convert) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%i:ptr<private, i32, read_write> = var, 1i
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:i32 = load %i
%tint_symbol:f32 = convert i32, %3
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -131,12 +131,12 @@ TEST_F(IR_BuilderImplTest, EmitExpression_ConstructEmpty) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%i:ptr<private, vec3<f32>, read_write> = var, vec3<f32> 0.0f
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
)");
}
@ -150,20 +150,20 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Construct) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%i:ptr<private, f32, read_write> = var, 1.0f
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:f32 = load %i
%tint_symbol:vec3<f32> = construct 2.0f, 3.0f, %3
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}

View File

@ -34,11 +34,11 @@ TEST_F(IR_BuilderImplTest, EmitFunction_Vertex) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():vec4<f32> [@vertex ra: @position] -> %fn1 {
%fn1 = block {
br %fn2 vec4<f32> 0.0f # return
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():vec4<f32> [@vertex ra: @position] -> %b1 {
%b1 = block {
br %b2 vec4<f32> 0.0f # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}
@ -50,11 +50,11 @@ TEST_F(IR_BuilderImplTest, EmitFunction_Fragment) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():void [@fragment] -> %fn1 {
%fn1 = block {
br %fn2 # return
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():void [@fragment] -> %b1 {
%b1 = block {
br %b2 # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}
@ -67,11 +67,11 @@ TEST_F(IR_BuilderImplTest, EmitFunction_Compute) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()),
R"(%test = func():void [@compute @workgroup_size(8, 4, 2)] -> %fn1 {
%fn1 = block {
br %fn2 # return
R"(%test = func():void [@compute @workgroup_size(8, 4, 2)] -> %b1 {
%b1 = block {
br %b2 # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}
@ -83,11 +83,11 @@ TEST_F(IR_BuilderImplTest, EmitFunction_Return) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():vec3<f32> -> %fn1 {
%fn1 = block {
br %fn2 vec3<f32> 0.0f # return
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():vec3<f32> -> %b1 {
%b1 = block {
br %b2 vec3<f32> 0.0f # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}
@ -100,11 +100,11 @@ TEST_F(IR_BuilderImplTest, EmitFunction_ReturnPosition) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():vec4<f32> [@vertex ra: @position] -> %fn1 {
%fn1 = block {
br %fn2 vec4<f32> 1.0f, 2.0f, 3.0f, 4.0f # return
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():vec4<f32> [@vertex ra: @position] -> %b1 {
%b1 = block {
br %b2 vec4<f32> 1.0f, 2.0f, 3.0f, 4.0f # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}
@ -118,11 +118,11 @@ TEST_F(IR_BuilderImplTest, EmitFunction_ReturnPositionInvariant) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()),
R"(%test = func():vec4<f32> [@vertex ra: @position @invariant] -> %fn1 {
%fn1 = block {
br %fn2 vec4<f32> 1.0f, 2.0f, 3.0f, 4.0f # return
R"(%test = func():vec4<f32> [@vertex ra: @position @invariant] -> %b1 {
%b1 = block {
br %b2 vec4<f32> 1.0f, 2.0f, 3.0f, 4.0f # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}
@ -135,11 +135,11 @@ TEST_F(IR_BuilderImplTest, EmitFunction_ReturnLocation) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()),
R"(%test = func():vec4<f32> [@fragment ra: @location(1)] -> %fn1 {
%fn1 = block {
br %fn2 vec4<f32> 1.0f, 2.0f, 3.0f, 4.0f # return
R"(%test = func():vec4<f32> [@fragment ra: @location(1)] -> %b1 {
%b1 = block {
br %b2 vec4<f32> 1.0f, 2.0f, 3.0f, 4.0f # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}
@ -152,11 +152,11 @@ TEST_F(IR_BuilderImplTest, EmitFunction_ReturnFragDepth) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():f32 [@fragment ra: @frag_depth] -> %fn1 {
%fn1 = block {
br %fn2 1.0f # return
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():f32 [@fragment ra: @frag_depth] -> %b1 {
%b1 = block {
br %b2 1.0f # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}
@ -169,11 +169,11 @@ TEST_F(IR_BuilderImplTest, EmitFunction_ReturnSampleMask) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():u32 [@fragment ra: @sample_mask] -> %fn1 {
%fn1 = block {
br %fn2 1u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%test = func():u32 [@fragment ra: @sample_mask] -> %b1 {
%b1 = block {
br %b2 1u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}

View File

@ -34,11 +34,11 @@ TEST_F(IR_BuilderImplTest, EmitExpression_MaterializedCall) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%test_function = func():f32 -> %fn1 {
%fn1 = block {
br %fn2 2.0f # return
EXPECT_EQ(Disassemble(m.Get()), R"(%test_function = func():f32 -> %b1 {
%b1 = block {
br %b2 2.0f # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}

View File

@ -36,19 +36,19 @@ TEST_F(IR_BuilderImplTest, EmitStatement_Assign) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%a:ptr<private, u32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
store %a, 4u
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}

File diff suppressed because it is too large Load Diff

View File

@ -34,19 +34,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Unary_Not) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool -> %fn1 {
%fn1 = block {
br %fn2 false # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():bool -> %b1 {
%b1 = block {
br %b2 false # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:bool = call %my_func
%tint_symbol:bool = eq %3, false
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -59,19 +59,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Unary_Complement) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %fn1 {
%fn1 = block {
br %fn2 1u # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():u32 -> %b1 {
%b1 = block {
br %b2 1u # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:u32 = call %my_func
%tint_symbol:u32 = complement %3
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -84,19 +84,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Unary_Negation) {
auto m = Build();
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():i32 -> %fn1 {
%fn1 = block {
br %fn2 1i # return
EXPECT_EQ(Disassemble(m.Get()), R"(%my_func = func():i32 -> %b1 {
%b1 = block {
br %b2 1i # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
%3:i32 = call %my_func
%tint_symbol:i32 = negation %3
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -111,18 +111,18 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Unary_AddressOf) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v2:ptr<private, i32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
br %fn4 # return
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}
@ -139,19 +139,19 @@ TEST_F(IR_BuilderImplTest, EmitExpression_Unary_Indirection) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%v3:ptr<private, i32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn3 {
%fn3 = block {
%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b3 {
%b3 = block {
store %v3, 42i
br %fn4 # return
br %b4 # return
}
%fn4 = func_terminator
%b4 = func_terminator
}
)");
}

View File

@ -33,12 +33,12 @@ TEST_F(IR_BuilderImplTest, Emit_GlobalVar_NoInit) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%a:ptr<private, u32, read_write> = var
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
)");
}
@ -51,12 +51,12 @@ TEST_F(IR_BuilderImplTest, Emit_GlobalVar_Init) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()), R"(# Root block
%fn1 = block {
%b1 = block {
%a:ptr<private, u32, read_write> = var, 2u
br %fn2 # root_end
br %b2 # root_end
}
%fn2 = root_terminator
%b2 = root_terminator
)");
}
@ -69,12 +69,12 @@ TEST_F(IR_BuilderImplTest, Emit_Var_NoInit) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()),
R"(%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn1 {
%fn1 = block {
R"(%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b1 {
%b1 = block {
%a:ptr<function, u32, read_write> = var
br %fn2 # return
br %b2 # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}
@ -88,12 +88,12 @@ TEST_F(IR_BuilderImplTest, Emit_Var_Init) {
ASSERT_TRUE(m) << (!m ? m.Failure() : "");
EXPECT_EQ(Disassemble(m.Get()),
R"(%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn1 {
%fn1 = block {
R"(%test_function = func():void [@compute @workgroup_size(1, 1, 1)] -> %b1 {
%b1 = block {
%a:ptr<function, u32, read_write> = var, 2u
br %fn2 # return
br %b2 # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)");
}

View File

@ -25,11 +25,11 @@ using IR_AddEmptyEntryPointTest = TransformTest;
TEST_F(IR_AddEmptyEntryPointTest, EmptyModule) {
auto* expect = R"(
%unused_entry_point = func():void [@compute @workgroup_size(1, 1, 1)] -> %fn1 {
%fn1 = block {
br %fn2 # return
%unused_entry_point = func():void [@compute @workgroup_size(1, 1, 1)] -> %b1 {
%b1 = block {
br %b2 # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)";
@ -44,11 +44,11 @@ TEST_F(IR_AddEmptyEntryPointTest, ExistingEntryPoint) {
mod.functions.Push(ep);
auto* expect = R"(
%main = func():void [@fragment] -> %fn1 {
%fn1 = block {
br %fn2 # return
%main = func():void [@fragment] -> %b1 {
%b1 = block {
br %b2 # return
}
%fn2 = func_terminator
%b2 = func_terminator
}
)";