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 51697163ae6f17fda9213e0adf7b98f34c9cbb7c..268afc4b275135aa2e407eb98f935a8ab3fe5b13 100644 |
--- a/test/unittests/compiler/machine-operator-reducer-unittest.cc |
+++ b/test/unittests/compiler/machine-operator-reducer-unittest.cc |
@@ -1132,6 +1132,30 @@ TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { |
} |
+TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32SarAndWord32Shl) { |
+ const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); |
+ Node* const base = Parameter(0); |
+ Node* const index = Parameter(1); |
+ Node* const value = Parameter(2); |
+ Node* const effect = graph()->start(); |
+ Node* const control = graph()->start(); |
+ TRACED_FORRANGE(int32_t, x, 1, 24) { |
+ Node* const node = graph()->NewNode( |
+ machine()->Store(rep), base, index, |
+ graph()->NewNode( |
+ machine()->Word32Sar(), |
+ graph()->NewNode(machine()->Word32Shl(), value, Int32Constant(x)), |
+ Int32Constant(x)), |
+ effect, control); |
+ |
+ Reduction r = Reduce(node); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), |
+ IsStore(rep, base, index, value, effect, control)); |
+ } |
+} |
+ |
+ |
TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32And) { |
const StoreRepresentation rep(kRepWord16, kNoWriteBarrier); |
Node* const base = Parameter(0); |
@@ -1153,6 +1177,30 @@ TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32And) { |
} |
} |
+ |
+TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32SarAndWord32Shl) { |
+ const StoreRepresentation rep(kRepWord16, kNoWriteBarrier); |
+ Node* const base = Parameter(0); |
+ Node* const index = Parameter(1); |
+ Node* const value = Parameter(2); |
+ Node* const effect = graph()->start(); |
+ Node* const control = graph()->start(); |
+ TRACED_FORRANGE(int32_t, x, 1, 16) { |
+ Node* const node = graph()->NewNode( |
+ machine()->Store(rep), base, index, |
+ graph()->NewNode( |
+ machine()->Word32Sar(), |
+ graph()->NewNode(machine()->Word32Shl(), value, Int32Constant(x)), |
+ Int32Constant(x)), |
+ effect, control); |
+ |
+ Reduction r = Reduce(node); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT(r.replacement(), |
+ IsStore(rep, base, index, value, effect, control)); |
+ } |
+} |
+ |
} // namespace compiler |
} // namespace internal |
} // namespace v8 |