rsx/fp/cfg: Add unit test for special cond inversion
This commit is contained in:
@@ -228,4 +228,27 @@ namespace rsx::assembler
|
|||||||
ASSERT_EQ(graph.blocks.size(), 1);
|
ASSERT_EQ(graph.blocks.size(), 1);
|
||||||
EXPECT_EQ(graph.blocks.front().instructions.size(), 1);
|
EXPECT_EQ(graph.blocks.front().instructions.size(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(CFG, FpToCFG_EmptyIFWithELSE)
|
||||||
|
{
|
||||||
|
auto ir = FPIR::from_source(
|
||||||
|
"IF.LT;" // Empty branch
|
||||||
|
"ELSE;" // With real ELSE
|
||||||
|
" MOV R1, R2;" // Content. Should execute if branch cond fails (IF.GE)
|
||||||
|
"ENDIF;"
|
||||||
|
"MOV R0, R1;" // False merge block.
|
||||||
|
);
|
||||||
|
|
||||||
|
RSXFragmentProgram program{};
|
||||||
|
auto bytecode = ir.compile();
|
||||||
|
program.data = bytecode.data();
|
||||||
|
|
||||||
|
FlowGraph graph = deconstruct_fragment_program(program);
|
||||||
|
|
||||||
|
ASSERT_EQ(graph.blocks.size(), 3);
|
||||||
|
ASSERT_EQ(graph.blocks.front().instructions.size(), 1);
|
||||||
|
EXPECT_EQ(SRC0{ .HEX = graph.blocks.front().instructions[0].bytecode[1] }.exec_if_lt, 0);
|
||||||
|
EXPECT_EQ(SRC0{ .HEX = graph.blocks.front().instructions[0].bytecode[1] }.exec_if_gr, 1);
|
||||||
|
EXPECT_EQ(SRC0{ .HEX = graph.blocks.front().instructions[0].bytecode[1] }.exec_if_eq, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user