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

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

Issue 749233002: [turbofan] Combine Word32And with Int32Add and negative power of two. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Unit test 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
« src/compiler/machine-operator-reducer.cc ('K') | « src/compiler/node-matchers.h ('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 d8640163b3e9d9d6e977f0aacc4d9177882cc36c..6e1b12f79e0449c1fb974855e2edff1a9c6100be 100644
--- a/test/unittests/compiler/machine-operator-reducer-unittest.cc
+++ b/test/unittests/compiler/machine-operator-reducer-unittest.cc
@@ -526,6 +526,25 @@ TEST_F(MachineOperatorReducerTest, Word32AndWithWord32AndWithConstant) {
}
+TEST_F(MachineOperatorReducerTest, Word32AndWithInt32AddAndConstant) {
+ Node* const p0 = Parameter(0);
+
+ TRACED_FOREACH(int32_t, k, kInt32Values) {
+ TRACED_FORRANGE(int32_t, l, 1, 31) {
+ // (x + (K << L)) & (-1 << L) => (x & (-1 << L)) + (K << L)
+ Reduction const r = Reduce(graph()->NewNode(
+ machine()->Word32And(),
+ graph()->NewNode(machine()->Int32Add(), p0, Int32Constant(k << l)),
+ Int32Constant(-1 << l)));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(),
+ IsInt32Add(IsWord32And(p0, IsInt32Constant(-1 << l)),
+ IsInt32Constant(k << l)));
+ }
+ }
+}
+
+
// -----------------------------------------------------------------------------
// Word32Xor
« src/compiler/machine-operator-reducer.cc ('K') | « src/compiler/node-matchers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698