mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-04-28 13:55:14 -06:00
rsx/fp/cfg: Add unit test for special cond inversion
This commit is contained in:
parent
3c68c36fa0
commit
ddd226f0ea
@ -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…
Reference in New Issue
Block a user