Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: test/unittests/compiler/machine-operator-reducer-unittest.cc

Issue 698963002: [turbofan] Strip useless sign-extension for store8/store16. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698