Index: test/unittests/compiler/int64-lowering-unittest.cc |
diff --git a/test/unittests/compiler/int64-lowering-unittest.cc b/test/unittests/compiler/int64-lowering-unittest.cc |
index 4e82660d14fc68226fa74b34c8d1c872fe9944a2..14bc22e46fa510a07201abb6ba81311e5571dc9e 100644 |
--- a/test/unittests/compiler/int64-lowering-unittest.cc |
+++ b/test/unittests/compiler/int64-lowering-unittest.cc |
@@ -660,6 +660,107 @@ TEST_F(Int64LoweringTest, I64Popcnt) { |
IsInt32Constant(0), start(), start())); |
} |
+TEST_F(Int64LoweringTest, I64Ror) { |
+ LowerGraph(graph()->NewNode(machine()->Word64Ror(), Int64Constant(value(0)), |
+ Parameter(0)), |
+ MachineRepresentation::kWord64, MachineRepresentation::kWord64, 1); |
+ |
+ Matcher<Node*> branch_eqz_matcher = |
+ IsBranch(IsWord32Equal(IsWord32And(IsParameter(0), IsInt32Constant(0x1f)), |
+ IsInt32Constant(0)), |
+ start()); |
+ |
+ Matcher<Node*> branch_lt32_matcher = IsBranch( |
+ IsInt32LessThan(IsWord32And(IsParameter(0), IsInt32Constant(0x3f)), |
+ IsInt32Constant(32)), |
+ start()); |
+ |
+ Matcher<Node*> low_matcher = IsPhi( |
+ MachineRepresentation::kWord32, IsInt32Constant(low_word_value(0)), |
+ IsInt32Constant(high_word_value(0)), |
+ IsMerge(IsIfTrue(branch_lt32_matcher), IsIfFalse(branch_lt32_matcher))); |
+ |
+ Matcher<Node*> high_matcher = IsPhi( |
+ MachineRepresentation::kWord32, IsInt32Constant(high_word_value(0)), |
+ IsInt32Constant(low_word_value(0)), |
+ IsMerge(IsIfTrue(branch_lt32_matcher), IsIfFalse(branch_lt32_matcher))); |
+ |
+ Matcher<Node*> shift_matcher = |
+ IsWord32And(IsParameter(0), IsInt32Constant(0x1f)); |
+ Matcher<Node*> inv_shift_matcher = |
+ IsInt32Sub(IsInt32Constant(32), shift_matcher); |
+ |
+ EXPECT_THAT( |
+ graph()->end()->InputAt(1), |
+ IsReturn2(IsPhi(MachineRepresentation::kWord32, low_matcher, |
+ IsWord32Or(IsWord32Shr(low_matcher, shift_matcher), |
+ IsWord32Shl(high_matcher, inv_shift_matcher)), |
+ IsMerge(IsIfTrue(branch_eqz_matcher), |
+ IsIfFalse(branch_eqz_matcher))), |
+ IsPhi(MachineRepresentation::kWord32, high_matcher, |
+ IsWord32Or(IsWord32Shr(high_matcher, shift_matcher), |
+ IsWord32Shl(low_matcher, inv_shift_matcher)), |
+ IsMerge(IsIfTrue(branch_eqz_matcher), |
+ IsIfFalse(branch_eqz_matcher))), |
+ start(), start())); |
+} |
+ |
+TEST_F(Int64LoweringTest, I64Ror_0) { |
+ LowerGraph(graph()->NewNode(machine()->Word64Ror(), Int64Constant(value(0)), |
+ Int32Constant(0)), |
+ MachineRepresentation::kWord64); |
+ |
+ EXPECT_THAT(graph()->end()->InputAt(1), |
+ IsReturn2(IsInt32Constant(low_word_value(0)), |
+ IsInt32Constant(high_word_value(0)), start(), start())); |
+} |
+ |
+TEST_F(Int64LoweringTest, I64Ror_32) { |
+ LowerGraph(graph()->NewNode(machine()->Word64Ror(), Int64Constant(value(0)), |
+ Int32Constant(32)), |
+ MachineRepresentation::kWord64); |
+ |
+ EXPECT_THAT(graph()->end()->InputAt(1), |
+ IsReturn2(IsInt32Constant(high_word_value(0)), |
+ IsInt32Constant(low_word_value(0)), start(), start())); |
+} |
+ |
+TEST_F(Int64LoweringTest, I64Ror_11) { |
+ LowerGraph(graph()->NewNode(machine()->Word64Ror(), Int64Constant(value(0)), |
+ Int32Constant(11)), |
+ MachineRepresentation::kWord64); |
+ |
+ EXPECT_THAT( |
+ graph()->end()->InputAt(1), |
+ IsReturn2(IsWord32Or(IsWord32Shr(IsInt32Constant(low_word_value(0)), |
+ IsInt32Constant(11)), |
+ IsWord32Shl(IsInt32Constant(high_word_value(0)), |
+ IsInt32Constant(21))), |
+ IsWord32Or(IsWord32Shr(IsInt32Constant(high_word_value(0)), |
+ IsInt32Constant(11)), |
+ IsWord32Shl(IsInt32Constant(low_word_value(0)), |
+ IsInt32Constant(21))), |
+ start(), start())); |
+} |
+ |
+TEST_F(Int64LoweringTest, I64Ror_43) { |
+ LowerGraph(graph()->NewNode(machine()->Word64Ror(), Int64Constant(value(0)), |
+ Int32Constant(43)), |
+ MachineRepresentation::kWord64); |
+ |
+ EXPECT_THAT( |
+ graph()->end()->InputAt(1), |
+ IsReturn2(IsWord32Or(IsWord32Shr(IsInt32Constant(high_word_value(0)), |
+ IsInt32Constant(11)), |
+ IsWord32Shl(IsInt32Constant(low_word_value(0)), |
+ IsInt32Constant(21))), |
+ IsWord32Or(IsWord32Shr(IsInt32Constant(low_word_value(0)), |
+ IsInt32Constant(11)), |
+ IsWord32Shl(IsInt32Constant(high_word_value(0)), |
+ IsInt32Constant(21))), |
+ start(), start())); |
+} |
+ |
TEST_F(Int64LoweringTest, I64PhiWord64) { |
LowerGraph(graph()->NewNode(common()->Phi(MachineRepresentation::kWord64, 2), |
Int64Constant(value(0)), Int64Constant(value(1)), |