summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/parallel_move_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/parallel_move_test.cc')
-rw-r--r--compiler/optimizing/parallel_move_test.cc27
1 files changed, 24 insertions, 3 deletions
diff --git a/compiler/optimizing/parallel_move_test.cc b/compiler/optimizing/parallel_move_test.cc
index 62629bcd0c..210f7d7f09 100644
--- a/compiler/optimizing/parallel_move_test.cc
+++ b/compiler/optimizing/parallel_move_test.cc
@@ -31,9 +31,13 @@ class TestParallelMoveResolver : public ParallelMoveResolver {
if (!message_.str().empty()) {
message_ << " ";
}
- message_ << "("
- << move->GetSource().reg()
- << " -> "
+ message_ << "(";
+ if (move->GetSource().IsConstant()) {
+ message_ << "C";
+ } else {
+ message_ << move->GetSource().reg();
+ }
+ message_ << " -> "
<< move->GetDestination().reg()
<< ")";
}
@@ -129,4 +133,21 @@ TEST(ParallelMoveTest, Swap) {
}
}
+TEST(ParallelMoveTest, ConstantLast) {
+ ArenaPool pool;
+ ArenaAllocator allocator(&pool);
+ TestParallelMoveResolver resolver(&allocator);
+ HParallelMove* moves = new (&allocator) HParallelMove(&allocator);
+ moves->AddMove(new (&allocator) MoveOperands(
+ Location::ConstantLocation(new (&allocator) HIntConstant(0)),
+ Location::RegisterLocation(0),
+ nullptr));
+ moves->AddMove(new (&allocator) MoveOperands(
+ Location::RegisterLocation(1),
+ Location::RegisterLocation(2),
+ nullptr));
+ resolver.EmitNativeCode(moves);
+ ASSERT_STREQ("(1 -> 2) (C -> 0)", resolver.GetMessage().c_str());
+}
+
} // namespace art