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

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

Issue 732103002: [turbofan] remove redundant '& 0x1F' for shifts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments + ror fix 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 | « test/mjsunit/asm/word32ror.js ('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 1284c566a3431d75b20407bbaf1252e19b360df2..d8640163b3e9d9d6e977f0aacc4d9177882cc36c 100644
--- a/test/unittests/compiler/machine-operator-reducer-unittest.cc
+++ b/test/unittests/compiler/machine-operator-reducer-unittest.cc
@@ -573,23 +573,22 @@ TEST_F(MachineOperatorReducerTest, ReduceToWord32RorWithParameters) {
Node* value = Parameter(0);
Node* shift = Parameter(1);
Node* shl = graph()->NewNode(machine()->Word32Shl(), value, shift);
- Node* shr = graph()->NewNode(
- machine()->Word32Shr(), value,
- graph()->NewNode(machine()->Int32Sub(), Int32Constant(32), shift));
+ Node* sub = graph()->NewNode(machine()->Int32Sub(), Int32Constant(32), shift);
+ Node* shr = graph()->NewNode(machine()->Word32Shr(), value, sub);
- // (x << y) | (x >> (32 - y)) => x ror y
+ // (x << y) | (x >>> (32 - y)) => x ror (32 - y)
Node* node1 = graph()->NewNode(machine()->Word32Or(), shl, shr);
Reduction reduction1 = Reduce(node1);
EXPECT_TRUE(reduction1.Changed());
EXPECT_EQ(reduction1.replacement(), node1);
- EXPECT_THAT(reduction1.replacement(), IsWord32Ror(value, shift));
+ EXPECT_THAT(reduction1.replacement(), IsWord32Ror(value, sub));
- // (x >> (32 - y)) | (x << y) => x ror y
+ // (x >>> (32 - y)) | (x << y) => x ror y
Node* node2 = graph()->NewNode(machine()->Word32Or(), shr, shl);
Reduction reduction2 = Reduce(node2);
EXPECT_TRUE(reduction2.Changed());
EXPECT_EQ(reduction2.replacement(), node2);
- EXPECT_THAT(reduction2.replacement(), IsWord32Ror(value, shift));
+ EXPECT_THAT(reduction2.replacement(), IsWord32Ror(value, sub));
}
@@ -601,21 +600,21 @@ TEST_F(MachineOperatorReducerTest, ReduceToWord32RorWithConstant) {
Node* shr =
graph()->NewNode(machine()->Word32Shr(), value, Int32Constant(32 - k));
- // (x << K) | (x >> ((32 - K) - y)) => x ror K
+ // (x << K) | (x >>> ((32 - K) - y)) => x ror (32 - K)
Node* node1 = graph()->NewNode(machine()->Word32Or(), shl, shr);
Reduction reduction1 = Reduce(node1);
EXPECT_TRUE(reduction1.Changed());
EXPECT_EQ(reduction1.replacement(), node1);
EXPECT_THAT(reduction1.replacement(),
- IsWord32Ror(value, IsInt32Constant(k)));
+ IsWord32Ror(value, IsInt32Constant(32 - k)));
- // (x >> (32 - K)) | (x << K) => x ror K
+ // (x >>> (32 - K)) | (x << K) => x ror K
Node* node2 = graph()->NewNode(machine()->Word32Or(), shr, shl);
Reduction reduction2 = Reduce(node2);
EXPECT_TRUE(reduction2.Changed());
EXPECT_EQ(reduction2.replacement(), node2);
EXPECT_THAT(reduction2.replacement(),
- IsWord32Ror(value, IsInt32Constant(k)));
+ IsWord32Ror(value, IsInt32Constant(32 - k)));
}
}
« no previous file with comments | « test/mjsunit/asm/word32ror.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698