diff options
author | 2015-03-31 17:57:27 +0000 | |
---|---|---|
committer | 2015-03-31 17:57:28 +0000 | |
commit | 1f940310658cd5a15e12305463fb6d2d508bbd26 (patch) | |
tree | 71d7da32199f1342202099c9c7c0baa30094299f /compiler/optimizing/parallel_move_test.cc | |
parent | dcff612c3a6e1427749771c4559f198fa480f709 (diff) | |
parent | a2d15b5e486021bef330b70c21e99557cb116ee5 (diff) |
Merge "Fix wrong assumptions about ParallelMove."
Diffstat (limited to 'compiler/optimizing/parallel_move_test.cc')
-rw-r--r-- | compiler/optimizing/parallel_move_test.cc | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/compiler/optimizing/parallel_move_test.cc b/compiler/optimizing/parallel_move_test.cc index 817a44b184..5c502f7ef4 100644 --- a/compiler/optimizing/parallel_move_test.cc +++ b/compiler/optimizing/parallel_move_test.cc @@ -31,8 +31,13 @@ class TestParallelMoveResolver : public ParallelMoveResolver { message_ << "C"; } else if (location.IsPair()) { message_ << location.low() << "," << location.high(); - } else { + } else if (location.IsRegister()) { message_ << location.reg(); + } else if (location.IsStackSlot()) { + message_ << location.GetStackIndex() << "(sp)"; + } else { + message_ << "2x" << location.GetStackIndex() << "(sp)"; + DCHECK(location.IsDoubleStackSlot()) << location; } } @@ -279,6 +284,26 @@ TEST(ParallelMoveTest, Pairs) { resolver.EmitNativeCode(moves); ASSERT_STREQ("(0,1 <-> 2,3)", resolver.GetMessage().c_str()); } + + { + // Test involving registers used in single context and pair context. + TestParallelMoveResolver resolver(&allocator); + HParallelMove* moves = new (&allocator) HParallelMove(&allocator); + moves->AddMove( + Location::RegisterLocation(10), + Location::RegisterLocation(5), + nullptr); + moves->AddMove( + Location::RegisterPairLocation(4, 5), + Location::DoubleStackSlot(32), + nullptr); + moves->AddMove( + Location::DoubleStackSlot(32), + Location::RegisterPairLocation(10, 11), + nullptr); + resolver.EmitNativeCode(moves); + ASSERT_STREQ("(2x32(sp) <-> 10,11) (4,5 <-> 2x32(sp)) (4 -> 5)", resolver.GetMessage().c_str()); + } } } // namespace art |