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

Unified Diff: src/compiler/machine-operator-reducer.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
« no previous file with comments | « no previous file | src/compiler/node-matchers.h » ('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 6c4d5dcb953725ec4ba114c25c8add56ce7bceef..470e71d6738cf8a2a51d45f767d3ef3fc429144d 100644
--- a/src/compiler/machine-operator-reducer.cc
+++ b/src/compiler/machine-operator-reducer.cc
@@ -137,6 +137,19 @@ Reduction MachineOperatorReducer::Reduce(Node* node) {
return Changed(node);
}
}
+ if (m.left().IsInt32Add() && m.right().IsNegativePowerOf2()) {
+ Int32BinopMatcher mleft(m.left().node());
+ if (mleft.right().HasValue() &&
+ (mleft.right().Value() & m.right().Value()) ==
+ mleft.right().Value()) {
+ // (x + K) & K => (x & K) + K
Jarin 2014/11/24 12:28:09 How about (x + K1) & K2 => (x & K2) + K1?
Benedikt Meurer 2014/11/24 12:29:33 This was the terminology that we always used here.
+ return Replace(graph()->NewNode(
+ machine()->Int32Add(),
+ graph()->NewNode(machine()->Word32And(), mleft.left().node(),
+ m.right().node()),
+ mleft.right().node()));
Jarin 2014/11/24 12:28:09 Funny indentation.
Benedikt Meurer 2014/11/24 12:29:33 clang-format...
+ }
+ }
break;
}
case IrOpcode::kWord32Or: {
« no previous file with comments | « no previous file | src/compiler/node-matchers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698