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

Unified Diff: src/compiler/int64-lowering.cc

Issue 1779713009: Implement optional turbofan UnalignedLoad and UnalignedStore operators (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix failures in cctest/test-run-wasm-64/Run_Wasm_LoadStoreI64_sx due to missing implementation of U… 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/int64-lowering.cc
diff --git a/src/compiler/int64-lowering.cc b/src/compiler/int64-lowering.cc
index 403d4c961cfc3ebf6668c674138bda1cd1ea6546..7a358cfbf51dbf2a5a087dc1b01bc8fa240d9f9d 100644
--- a/src/compiler/int64-lowering.cc
+++ b/src/compiler/int64-lowering.cc
@@ -126,6 +126,38 @@ void Int64Lowering::LowerNode(Node* node) {
}
break;
}
+ case IrOpcode::kUnalignedLoad: {
+ UnalignedLoadRepresentation load_rep =
+ UnalignedLoadRepresentationOf(node->op());
+
+ if (load_rep.representation() == MachineRepresentation::kWord64) {
+ Node* base = node->InputAt(0);
+ Node* index = node->InputAt(1);
+ Node* index_high =
+ graph()->NewNode(machine()->Int32Add(), index,
+ graph()->NewNode(common()->Int32Constant(4)));
+
+ const Operator* load_op =
+ machine()->UnalignedLoad(MachineType::Int32()).op();
+ Node* high_node;
+ if (node->InputCount() > 2) {
+ Node* effect_high = node->InputAt(2);
+ Node* control_high = node->InputAt(3);
+ high_node = graph()->NewNode(load_op, base, index_high, effect_high,
+ control_high);
+ // change the effect change from old_node --> old_effect to
+ // old_node --> high_node --> old_effect.
+ node->ReplaceInput(2, high_node);
+ } else {
+ high_node = graph()->NewNode(load_op, base, index_high);
+ }
+ NodeProperties::ChangeOp(node, load_op);
+ ReplaceNode(node, node, high_node);
+ } else {
+ DefaultLowering(node);
+ }
+ break;
+ }
case IrOpcode::kStore: {
StoreRepresentation store_rep = StoreRepresentationOf(node->op());
if (store_rep.representation() == MachineRepresentation::kWord64) {
@@ -170,6 +202,46 @@ void Int64Lowering::LowerNode(Node* node) {
}
break;
}
+ case IrOpcode::kUnalignedStore: {
+ UnalignedStoreRepresentation store_rep =
+ UnalignedStoreRepresentationOf(node->op());
+ if (store_rep == MachineRepresentation::kWord64) {
+ Node* base = node->InputAt(0);
+ Node* index = node->InputAt(1);
+ Node* index_high =
+ graph()->NewNode(machine()->Int32Add(), index,
+ graph()->NewNode(common()->Int32Constant(4)));
+
+ Node* value = node->InputAt(2);
+ DCHECK(HasReplacementLow(value));
+ DCHECK(HasReplacementHigh(value));
+
+ const Operator* store_op =
+ machine()->UnalignedStore(MachineRepresentation::kWord32).op();
+
+ Node* high_node;
+ if (node->InputCount() > 3) {
+ Node* effect_high = node->InputAt(3);
+ Node* control_high = node->InputAt(4);
+ high_node = graph()->NewNode(store_op, base, index_high,
+ GetReplacementHigh(value), effect_high,
+ control_high);
+ node->ReplaceInput(3, high_node);
+
+ } else {
+ high_node = graph()->NewNode(store_op, base, index_high,
+ GetReplacementHigh(value));
+ }
+
+ node->ReplaceInput(2, GetReplacementLow(value));
+ NodeProperties::ChangeOp(node, store_op);
+ ReplaceNode(node, node, high_node);
+ } else {
+ DefaultLowering(node);
+ }
+ break;
+ }
+
case IrOpcode::kStart: {
int parameter_count = GetParameterCountAfterLowering(signature());
// Only exchange the node if the parameter count actually changed.

Powered by Google App Engine
This is Rietveld 408576698