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

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

Issue 698963002: [turbofan] Strip useless sign-extension for store8/store16. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
Index: src/compiler/machine-operator-reducer.cc
diff --git a/src/compiler/machine-operator-reducer.cc b/src/compiler/machine-operator-reducer.cc
index 836ddd146483d4702aa7c2bfb76b158bbf504a5f..f51125a001b660d02a5cfbc9e6577acc699a75b8 100644
--- a/src/compiler/machine-operator-reducer.cc
+++ b/src/compiler/machine-operator-reducer.cc
@@ -534,22 +534,8 @@ Reduction MachineOperatorReducer::Reduce(Node* node) {
if (m.IsChangeFloat32ToFloat64()) return Replace(m.node()->InputAt(0));
break;
}
- case IrOpcode::kStore: {
- Node* const value = node->InputAt(2);
- // TODO(turbofan): Extend to 64-bit?
- if (value->opcode() == IrOpcode::kWord32And) {
- MachineType const rep = static_cast<MachineType>(
- StoreRepresentationOf(node->op()).machine_type() & kRepMask);
- Uint32BinopMatcher m(value);
- if (m.right().HasValue() &&
- ((rep == kRepWord8 && (m.right().Value() & 0xff) == 0xff) ||
- (rep == kRepWord16 && (m.right().Value() & 0xffff) == 0xffff))) {
- node->ReplaceInput(2, m.left().node());
- return Changed(node);
- }
- }
- break;
- }
+ case IrOpcode::kStore:
+ return ReduceStore(node);
default:
break;
}
@@ -712,6 +698,41 @@ Reduction MachineOperatorReducer::ReduceUint32Mod(Node* node) {
}
+Reduction MachineOperatorReducer::ReduceStore(Node* node) {
+ MachineType const rep =
+ RepresentationOf(StoreRepresentationOf(node->op()).machine_type());
+ Node* const value = node->InputAt(2);
+ switch (value->opcode()) {
+ case IrOpcode::kWord32And: {
+ Uint32BinopMatcher m(value);
+ if (m.right().HasValue() &&
+ ((rep == kRepWord8 && (m.right().Value() & 0xff) == 0xff) ||
+ (rep == kRepWord16 && (m.right().Value() & 0xffff) == 0xffff))) {
+ node->ReplaceInput(2, m.left().node());
+ return Changed(node);
+ }
+ break;
+ }
+ case IrOpcode::kWord32Sar: {
+ Int32BinopMatcher m(value);
+ if (m.left().IsWord32Shl() &&
+ ((rep == kRepWord8 && m.right().IsInRange(1, 24)) ||
+ (rep == kRepWord16 && m.right().IsInRange(1, 16)))) {
+ Int32BinopMatcher mleft(m.left().node());
+ if (mleft.right().Is(m.right().Value())) {
+ node->ReplaceInput(2, mleft.left().node());
+ return Changed(node);
+ }
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ return NoChange();
+}
+
+
Reduction MachineOperatorReducer::ReduceProjection(size_t index, Node* node) {
switch (node->opcode()) {
case IrOpcode::kInt32AddWithOverflow: {
« no previous file with comments | « src/compiler/machine-operator-reducer.h ('k') | test/unittests/compiler/machine-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698