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

Unified Diff: src/compiler/machine-operator-reducer.cc

Issue 684193002: [turbofan] Fix input count in Uint32Mod/Div reduction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Uint32Div, too 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 | « no previous file | test/cctest/compiler/test-machine-operator-reducer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/machine-operator-reducer.cc
diff --git a/src/compiler/machine-operator-reducer.cc b/src/compiler/machine-operator-reducer.cc
index a40da1360cfbfb3dc23f5ce05e75b2b1dbd4e4a4..aaf32bc07f208e56c0a44f8974932f86b3d08d9b 100644
--- a/src/compiler/machine-operator-reducer.cc
+++ b/src/compiler/machine-operator-reducer.cc
@@ -600,8 +600,9 @@ Reduction MachineOperatorReducer::ReduceUint32Div(Node* node) {
return Replace(Word32Equal(Word32Equal(m.left().node(), zero), zero));
}
if (m.right().IsPowerOf2()) { // x / 2^n => x >> n
- node->set_op(machine()->Word32Shr());
node->ReplaceInput(1, Uint32Constant(WhichPowerOf2(m.right().Value())));
Benedikt Meurer 2014/10/29 18:26:45 Let's keep the set_op() before ReplaceInput.
Jarin 2014/10/29 21:12:24 Done. I am wondering what's the reason for this.
+ node->TrimInputCount(2);
+ node->set_op(machine()->Word32Shr());
return Changed(node);
}
return NoChange();
@@ -665,8 +666,9 @@ Reduction MachineOperatorReducer::ReduceUint32Mod(Node* node) {
base::bits::UnsignedMod32(m.left().Value(), m.right().Value()));
}
if (m.right().IsPowerOf2()) { // x % 2^n => x & 2^n-1
- node->set_op(machine()->Word32And());
node->ReplaceInput(1, Uint32Constant(m.right().Value() - 1));
+ node->TrimInputCount(2);
+ node->set_op(machine()->Word32And());
Benedikt Meurer 2014/10/29 18:26:45 Same here.
Jarin 2014/10/29 21:12:24 Done.
return Changed(node);
}
return NoChange();
« no previous file with comments | « no previous file | test/cctest/compiler/test-machine-operator-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698