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

Unified Diff: src/compiler/x64/instruction-selector-x64.cc

Issue 2728533003: [turbofan] Enable complex memory operands for binops on ia32/x64 (Closed)
Patch Set: Rebase and Add tests for the 64-bit variants Created 3 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/x64/instruction-selector-x64.cc
diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc
index cfc1841bac507e11b23295d393814faa12151491..44103971680c17ea1132070df9eb1cbe73aaf65b 100644
--- a/src/compiler/x64/instruction-selector-x64.cc
+++ b/src/compiler/x64/instruction-selector-x64.cc
@@ -58,10 +58,20 @@ class X64OperandGenerator final : public OperandGenerator {
MachineRepresentation rep =
LoadRepresentationOf(input->op()).representation();
switch (opcode) {
+ case kX64And:
+ case kX64Or:
+ case kX64Xor:
+ case kX64Add:
+ case kX64Sub:
case kX64Push:
case kX64Cmp:
case kX64Test:
return rep == MachineRepresentation::kWord64 || IsAnyTagged(rep);
+ case kX64And32:
+ case kX64Or32:
+ case kX64Xor32:
+ case kX64Add32:
+ case kX64Sub32:
case kX64Cmp32:
case kX64Test32:
return rep == MachineRepresentation::kWord32;
@@ -507,7 +517,7 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
Int32BinopMatcher m(node);
Node* left = m.left().node();
Node* right = m.right().node();
- InstructionOperand inputs[4];
+ InstructionOperand inputs[6];
size_t input_count = 0;
InstructionOperand outputs[2];
size_t output_count = 0;
@@ -528,12 +538,26 @@ static void VisitBinop(InstructionSelector* selector, Node* node,
inputs[input_count++] = g.UseRegister(left);
inputs[input_count++] = g.UseImmediate(right);
} else {
+ int effect_level = selector->GetEffectLevel(node);
+ if (cont->IsBranch()) {
+ effect_level = selector->GetEffectLevel(
+ cont->true_block()->PredecessorAt(0)->control_input());
+ }
if (node->op()->HasProperty(Operator::kCommutative) &&
- g.CanBeBetterLeftOperand(right)) {
+ g.CanBeBetterLeftOperand(right) &&
+ (!g.CanBeBetterLeftOperand(left) ||
+ !g.CanBeMemoryOperand(opcode, node, right, effect_level))) {
std::swap(left, right);
}
- inputs[input_count++] = g.UseRegister(left);
- inputs[input_count++] = g.Use(right);
+ if (g.CanBeMemoryOperand(opcode, node, right, effect_level)) {
+ inputs[input_count++] = g.UseRegister(left);
+ AddressingMode addressing_mode =
+ g.GetEffectiveAddressMemoryOperand(right, inputs, &input_count);
+ opcode |= AddressingModeField::encode(addressing_mode);
+ } else {
+ inputs[input_count++] = g.UseRegister(left);
+ inputs[input_count++] = g.Use(right);
+ }
}
if (cont->IsBranch()) {
« no previous file with comments | « src/compiler/x64/code-generator-x64.cc ('k') | test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698