Index: src/compiler/machine-operator-reducer.cc |
diff --git a/src/compiler/machine-operator-reducer.cc b/src/compiler/machine-operator-reducer.cc |
index 19ea06205361fef01f29d5a2dc22e6067de10554..1ab438c22c09cb2104891c3977b3c6a5cd25b20c 100644 |
--- a/src/compiler/machine-operator-reducer.cc |
+++ b/src/compiler/machine-operator-reducer.cc |
@@ -439,6 +439,8 @@ Reduction MachineOperatorReducer::Reduce(Node* node) { |
return ReduceFloat64InsertHighWord32(node); |
case IrOpcode::kStore: |
return ReduceStore(node); |
+ case IrOpcode::kUnalignedStore: |
+ return ReduceUnalignedStore(node); |
case IrOpcode::kFloat64Equal: |
case IrOpcode::kFloat64LessThan: |
case IrOpcode::kFloat64LessThanOrEqual: |
@@ -712,6 +714,41 @@ Reduction MachineOperatorReducer::ReduceStore(Node* node) { |
return NoChange(); |
} |
+Reduction MachineOperatorReducer::ReduceUnalignedStore(Node* node) { |
+ MachineRepresentation const rep = UnalignedStoreRepresentationOf(node->op()); |
+ Node* const value = node->InputAt(2); |
+ switch (value->opcode()) { |
+ case IrOpcode::kWord32And: { |
+ Uint32BinopMatcher m(value); |
+ if (m.right().HasValue() && ((rep == MachineRepresentation::kWord8 && |
+ (m.right().Value() & 0xff) == 0xff) || |
+ (rep == MachineRepresentation::kWord16 && |
+ (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 == MachineRepresentation::kWord8 && |
+ m.right().IsInRange(1, 24)) || |
+ (rep == MachineRepresentation::kWord16 && |
+ 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()) { |