| Index: src/compiler/ia32/instruction-selector-ia32.cc
|
| diff --git a/src/compiler/ia32/instruction-selector-ia32.cc b/src/compiler/ia32/instruction-selector-ia32.cc
|
| index fcb0b484faa181c17e2d912ff78e74a692496ccc..fec49765de0438a758217ef419bf0bc88f5ca1f0 100644
|
| --- a/src/compiler/ia32/instruction-selector-ia32.cc
|
| +++ b/src/compiler/ia32/instruction-selector-ia32.cc
|
| @@ -39,6 +39,11 @@ class IA32OperandGenerator final : public OperandGenerator {
|
| MachineRepresentation rep =
|
| LoadRepresentationOf(input->op()).representation();
|
| switch (opcode) {
|
| + case kIA32And:
|
| + case kIA32Or:
|
| + case kIA32Xor:
|
| + case kIA32Add:
|
| + case kIA32Sub:
|
| case kIA32Cmp:
|
| case kIA32Test:
|
| return rep == MachineRepresentation::kWord32 ||
|
| @@ -533,7 +538,7 @@ 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;
|
| @@ -554,12 +559,26 @@ 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()) {
|
|
|