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

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

Issue 1779713009: Implement optional turbofan UnalignedLoad and UnalignedStore operators (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix review remarks Created 4 years, 9 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
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()) {

Powered by Google App Engine
This is Rietveld 408576698