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

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

Issue 642033002: [turbofan] Eliminate redundant masking operations for word8/word16 stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comment. Created 6 years, 2 months 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 | « test/unittests/compiler/graph-unittest.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 4d3df88eb7782d8927ccd76cb82b2db96bfffb11..3a5eb1af45d1efc30baa43d92e439a8fec86c2ac 100644
--- a/test/unittests/compiler/machine-operator-reducer-unittest.cc
+++ b/test/unittests/compiler/machine-operator-reducer-unittest.cc
@@ -654,6 +654,54 @@ TEST_F(MachineOperatorReducerTest, Int32SubWithOverflowWithConstant) {
}
}
+
+// -----------------------------------------------------------------------------
+// Store
+
+
+TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) {
+ 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_FOREACH(uint32_t, x, kUint32Values) {
+ Node* const node =
+ graph()->NewNode(machine()->Store(rep), base, index,
+ graph()->NewNode(machine()->Word32And(), value,
+ Uint32Constant(x | 0xffu)),
+ 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);
+ Node* const index = Parameter(1);
+ Node* const value = Parameter(2);
+ Node* const effect = graph()->start();
+ Node* const control = graph()->start();
+ TRACED_FOREACH(uint32_t, x, kUint32Values) {
+ Node* const node =
+ graph()->NewNode(machine()->Store(rep), base, index,
+ graph()->NewNode(machine()->Word32And(), value,
+ Uint32Constant(x | 0xffffu)),
+ 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 | « test/unittests/compiler/graph-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698