diff options
| author | 2015-02-10 19:33:22 +0000 | |
|---|---|---|
| committer | 2015-02-10 19:33:23 +0000 | |
| commit | 1d6957f0b9d560c75a1901a83a45b4f3510a1015 (patch) | |
| tree | 36a174d4b12ef46744c5f3e80f8afeb46809a2e6 /compiler/optimizing/parallel_move_test.cc | |
| parent | 0525d6aa15cb9db70e26c01f7e7a695bae377268 (diff) | |
| parent | f7a0c4e421b5edaad5b7a15bfff687da28d0b287 (diff) | |
Merge "Improve ParallelMoveResolver to work with pairs."
Diffstat (limited to 'compiler/optimizing/parallel_move_test.cc')
| -rw-r--r-- | compiler/optimizing/parallel_move_test.cc | 88 |
1 files changed, 85 insertions, 3 deletions
diff --git a/compiler/optimizing/parallel_move_test.cc b/compiler/optimizing/parallel_move_test.cc index 28b5697bbd..bb7541d99a 100644 --- a/compiler/optimizing/parallel_move_test.cc +++ b/compiler/optimizing/parallel_move_test.cc @@ -165,7 +165,7 @@ TEST(ParallelMoveTest, Pairs) { Location::RegisterPairLocation(2, 3), nullptr); resolver.EmitNativeCode(moves); - ASSERT_STREQ("(2 -> 4) (0 -> 2) (1 -> 3)", resolver.GetMessage().c_str()); + ASSERT_STREQ("(2 -> 4) (0,1 -> 2,3)", resolver.GetMessage().c_str()); } { @@ -180,7 +180,7 @@ TEST(ParallelMoveTest, Pairs) { Location::RegisterLocation(4), nullptr); resolver.EmitNativeCode(moves); - ASSERT_STREQ("(2 -> 4) (0 -> 2) (1 -> 3)", resolver.GetMessage().c_str()); + ASSERT_STREQ("(2 -> 4) (0,1 -> 2,3)", resolver.GetMessage().c_str()); } { @@ -195,7 +195,89 @@ TEST(ParallelMoveTest, Pairs) { Location::RegisterLocation(0), nullptr); resolver.EmitNativeCode(moves); - ASSERT_STREQ("(2 <-> 0) (1 -> 3)", resolver.GetMessage().c_str()); + ASSERT_STREQ("(0,1 <-> 2,3)", resolver.GetMessage().c_str()); + } + { + TestParallelMoveResolver resolver(&allocator); + HParallelMove* moves = new (&allocator) HParallelMove(&allocator); + moves->AddMove( + Location::RegisterLocation(2), + Location::RegisterLocation(7), + nullptr); + moves->AddMove( + Location::RegisterLocation(7), + Location::RegisterLocation(1), + nullptr); + moves->AddMove( + Location::RegisterPairLocation(0, 1), + Location::RegisterPairLocation(2, 3), + nullptr); + resolver.EmitNativeCode(moves); + ASSERT_STREQ("(0,1 <-> 2,3) (7 -> 1) (0 -> 7)", resolver.GetMessage().c_str()); + } + { + TestParallelMoveResolver resolver(&allocator); + HParallelMove* moves = new (&allocator) HParallelMove(&allocator); + moves->AddMove( + Location::RegisterLocation(2), + Location::RegisterLocation(7), + nullptr); + moves->AddMove( + Location::RegisterPairLocation(0, 1), + Location::RegisterPairLocation(2, 3), + nullptr); + moves->AddMove( + Location::RegisterLocation(7), + Location::RegisterLocation(1), + nullptr); + resolver.EmitNativeCode(moves); + ASSERT_STREQ("(0,1 <-> 2,3) (7 -> 1) (0 -> 7)", resolver.GetMessage().c_str()); + } + { + TestParallelMoveResolver resolver(&allocator); + HParallelMove* moves = new (&allocator) HParallelMove(&allocator); + moves->AddMove( + Location::RegisterPairLocation(0, 1), + Location::RegisterPairLocation(2, 3), + nullptr); + moves->AddMove( + Location::RegisterLocation(2), + Location::RegisterLocation(7), + nullptr); + moves->AddMove( + Location::RegisterLocation(7), + Location::RegisterLocation(1), + nullptr); + resolver.EmitNativeCode(moves); + ASSERT_STREQ("(0,1 <-> 2,3) (7 -> 1) (0 -> 7)", resolver.GetMessage().c_str()); + } + { + TestParallelMoveResolver resolver(&allocator); + HParallelMove* moves = new (&allocator) HParallelMove(&allocator); + moves->AddMove( + Location::RegisterPairLocation(0, 1), + Location::RegisterPairLocation(2, 3), + nullptr); + moves->AddMove( + Location::RegisterPairLocation(2, 3), + Location::RegisterPairLocation(0, 1), + nullptr); + resolver.EmitNativeCode(moves); + ASSERT_STREQ("(2,3 <-> 0,1)", resolver.GetMessage().c_str()); + } + { + TestParallelMoveResolver resolver(&allocator); + HParallelMove* moves = new (&allocator) HParallelMove(&allocator); + moves->AddMove( + Location::RegisterPairLocation(2, 3), + Location::RegisterPairLocation(0, 1), + nullptr); + moves->AddMove( + Location::RegisterPairLocation(0, 1), + Location::RegisterPairLocation(2, 3), + nullptr); + resolver.EmitNativeCode(moves); + ASSERT_STREQ("(0,1 <-> 2,3)", resolver.GetMessage().c_str()); } } |