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

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

Issue 666723005: [turbofan] Reduce ~~x to x. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « 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 6c634bfa43e4a4df5250e95de5844a9b77c00e99..a5b1cfe19b87e2485c8a64af63092914c2bfb629 100644
--- a/test/unittests/compiler/machine-operator-reducer-unittest.cc
+++ b/test/unittests/compiler/machine-operator-reducer-unittest.cc
@@ -482,6 +482,45 @@ TEST_F(MachineOperatorReducerTest, TruncateInt64ToInt32WithConstant) {
// -----------------------------------------------------------------------------
+// Word32Xor
+
+
+TEST_F(MachineOperatorReducerTest, Word32XorWithWord32XorAndMinusOne) {
+ Node* const p0 = Parameter(0);
+
+ // (x ^ -1) ^ -1 => x
+ Reduction r1 = Reduce(graph()->NewNode(
+ machine()->Word32Xor(),
+ graph()->NewNode(machine()->Word32Xor(), p0, Int32Constant(-1)),
+ Int32Constant(-1)));
+ ASSERT_TRUE(r1.Changed());
+ EXPECT_EQ(r1.replacement(), p0);
+
+ // -1 ^ (x ^ -1) => x
+ Reduction r2 = Reduce(graph()->NewNode(
+ machine()->Word32Xor(), Int32Constant(-1),
+ graph()->NewNode(machine()->Word32Xor(), p0, Int32Constant(-1))));
+ ASSERT_TRUE(r2.Changed());
+ EXPECT_EQ(r2.replacement(), p0);
+
+ // (-1 ^ x) ^ -1 => x
+ Reduction r3 = Reduce(graph()->NewNode(
+ machine()->Word32Xor(),
+ graph()->NewNode(machine()->Word32Xor(), Int32Constant(-1), p0),
+ Int32Constant(-1)));
+ ASSERT_TRUE(r3.Changed());
+ EXPECT_EQ(r3.replacement(), p0);
+
+ // -1 ^ (-1 ^ x) => x
+ Reduction r4 = Reduce(graph()->NewNode(
+ machine()->Word32Xor(), Int32Constant(-1),
+ graph()->NewNode(machine()->Word32Xor(), Int32Constant(-1), p0)));
+ ASSERT_TRUE(r4.Changed());
+ EXPECT_EQ(r4.replacement(), p0);
+}
+
+
+// -----------------------------------------------------------------------------
// Word32Ror
« 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