Chromium Code Reviews| Index: test/unittests/compiler/machine-operator-reducer-unittest.cc |
| diff --git a/test/unittests/compiler/machine-operator-reducer-unittest.cc b/test/unittests/compiler/machine-operator-reducer-unittest.cc |
| index 5f9f1134a36c50e436bb43e17f52731268b53823..b178c7c6436a8fabaf6a6aef89c99827b718929d 100644 |
| --- a/test/unittests/compiler/machine-operator-reducer-unittest.cc |
| +++ b/test/unittests/compiler/machine-operator-reducer-unittest.cc |
| @@ -532,9 +532,10 @@ TEST_F(MachineOperatorReducerTest, Word32AndWithWord32AndWithConstant) { |
| TEST_F(MachineOperatorReducerTest, Word32AndWithInt32AddAndConstant) { |
| Node* const p0 = Parameter(0); |
| + Node* const p1 = Parameter(0); |
|
Jarin
2014/12/03 07:33:13
Not that it is really important, but should not th
Benedikt Meurer
2014/12/03 07:34:33
Done.
|
| - TRACED_FOREACH(int32_t, k, kInt32Values) { |
| - TRACED_FORRANGE(int32_t, l, 1, 31) { |
| + TRACED_FORRANGE(int32_t, l, 1, 31) { |
| + TRACED_FOREACH(int32_t, k, kInt32Values) { |
| // (x + (K << L)) & (-1 << L) => (x & (-1 << L)) + (K << L) |
| Reduction const r = Reduce(graph()->NewNode( |
| machine()->Word32And(), |
| @@ -545,6 +546,24 @@ TEST_F(MachineOperatorReducerTest, Word32AndWithInt32AddAndConstant) { |
| IsInt32Add(IsWord32And(p0, IsInt32Constant(-1 << l)), |
| IsInt32Constant(k << l))); |
| } |
| + |
| + Node* s1 = graph()->NewNode(machine()->Word32Shl(), p1, Int32Constant(l)); |
| + |
| + // (y << L + x) & (-1 << L) => (x & (-1 << L)) + y << L |
| + Reduction const r1 = Reduce(graph()->NewNode( |
| + machine()->Word32And(), graph()->NewNode(machine()->Int32Add(), s1, p0), |
| + Int32Constant(-1 << l))); |
| + ASSERT_TRUE(r1.Changed()); |
| + EXPECT_THAT(r1.replacement(), |
| + IsInt32Add(IsWord32And(p0, IsInt32Constant(-1 << l)), s1)); |
| + |
| + // (x + y << L) & (-1 << L) => (x & (-1 << L)) + y << L |
| + Reduction const r2 = Reduce(graph()->NewNode( |
| + machine()->Word32And(), graph()->NewNode(machine()->Int32Add(), p0, s1), |
| + Int32Constant(-1 << l))); |
| + ASSERT_TRUE(r2.Changed()); |
| + EXPECT_THAT(r2.replacement(), |
| + IsInt32Add(IsWord32And(p0, IsInt32Constant(-1 << l)), s1)); |
| } |
| } |