Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: test/unittests/compiler/move-optimizer-unittest.cc

Issue 1527203002: [turbofan] fine grained move operand merge optimization (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/move-optimizer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/move-optimizer-unittest.cc
diff --git a/test/unittests/compiler/move-optimizer-unittest.cc b/test/unittests/compiler/move-optimizer-unittest.cc
index 413c58b6feb48684bd1a50974896e219ef3326d6..a28580b16494a9671e5bbe0e04e9ce058f21f8db 100644
--- a/test/unittests/compiler/move-optimizer-unittest.cc
+++ b/test/unittests/compiler/move-optimizer-unittest.cc
@@ -246,6 +246,82 @@ TEST_F(MoveOptimizerTest, GapsCanMoveOverInstruction) {
}
+TEST_F(MoveOptimizerTest, SubsetMovesMerge) {
+ StartBlock();
+ EndBlock(Branch(Imm(), 1, 2));
+
+ StartBlock();
+ EndBlock(Jump(2));
+ Instruction* last_move_b1 = LastInstruction();
+ AddMove(last_move_b1, Reg(0), Reg(1));
+ AddMove(last_move_b1, Reg(2), Reg(3));
+
+ StartBlock();
+ EndBlock(Jump(1));
+ Instruction* last_move_b2 = LastInstruction();
+ AddMove(last_move_b2, Reg(0), Reg(1));
+ AddMove(last_move_b2, Reg(4), Reg(5));
+
+ StartBlock();
+ EndBlock(Last());
+
+ Instruction* last = LastInstruction();
+
+ Optimize();
+
+ ParallelMove* last_move = last->parallel_moves()[0];
+ CHECK_EQ(1, NonRedundantSize(last_move));
+ CHECK(Contains(last_move, Reg(0), Reg(1)));
+
+ ParallelMove* b1_move = last_move_b1->parallel_moves()[0];
+ CHECK_EQ(1, NonRedundantSize(b1_move));
+ CHECK(Contains(b1_move, Reg(2), Reg(3)));
+
+ ParallelMove* b2_move = last_move_b2->parallel_moves()[0];
+ CHECK_EQ(1, NonRedundantSize(b2_move));
+ CHECK(Contains(b2_move, Reg(4), Reg(5)));
+}
+
+
+TEST_F(MoveOptimizerTest, GapConflictSubsetMovesDoNotMerge) {
+ StartBlock();
+ EndBlock(Branch(Imm(), 1, 2));
+
+ StartBlock();
+ EndBlock(Jump(2));
+ Instruction* last_move_b1 = LastInstruction();
+ AddMove(last_move_b1, Reg(0), Reg(1));
+ AddMove(last_move_b1, Reg(2), Reg(0));
+ AddMove(last_move_b1, Reg(4), Reg(5));
+
+ StartBlock();
+ EndBlock(Jump(1));
+ Instruction* last_move_b2 = LastInstruction();
+ AddMove(last_move_b2, Reg(0), Reg(1));
+ AddMove(last_move_b2, Reg(4), Reg(5));
+
+ StartBlock();
+ EndBlock(Last());
+
+ Instruction* last = LastInstruction();
+
+ Optimize();
+
+ ParallelMove* last_move = last->parallel_moves()[0];
+ CHECK_EQ(1, NonRedundantSize(last_move));
+ CHECK(Contains(last_move, Reg(4), Reg(5)));
+
+ ParallelMove* b1_move = last_move_b1->parallel_moves()[0];
+ CHECK_EQ(2, NonRedundantSize(b1_move));
+ CHECK(Contains(b1_move, Reg(0), Reg(1)));
+ CHECK(Contains(b1_move, Reg(2), Reg(0)));
+
+ ParallelMove* b2_move = last_move_b2->parallel_moves()[0];
+ CHECK_EQ(1, NonRedundantSize(b2_move));
+ CHECK(Contains(b1_move, Reg(0), Reg(1)));
+}
+
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/move-optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698