mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-04-05 22:46:56 +00:00
rsx/fp/cfg: Add unit test for special cond inversion
This commit is contained in:
parent
3c68c36fa0
commit
ddd226f0ea
1 changed files with 23 additions and 0 deletions
|
|
@ -228,4 +228,27 @@ namespace rsx::assembler
|
|||
ASSERT_EQ(graph.blocks.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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue