Chromium Code Reviews| 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 7e98023f5dfacf81cc344199e08910ee84191f47..e710c8529534f3e8a7d010c7159ea6ffad6a5a9f 100644 |
| --- a/src/compiler/ia32/instruction-selector-ia32.cc |
| +++ b/src/compiler/ia32/instruction-selector-ia32.cc |
| @@ -646,55 +646,78 @@ void InstructionSelector::VisitWord32Sar(Node* node) { |
| void InstructionSelector::VisitInt32PairAdd(Node* node) { |
| IA32OperandGenerator g(this); |
| - // We use UseUniqueRegister here to avoid register sharing with the temp |
| - // register. |
| - InstructionOperand inputs[] = { |
| - g.UseRegister(node->InputAt(0)), g.UseUniqueRegister(node->InputAt(1)), |
| - g.UseRegister(node->InputAt(2)), g.UseUniqueRegister(node->InputAt(3))}; |
| + Node* projection1 = NodeProperties::FindProjection(node, 1); |
| + if (projection1) { |
| + // We use UseUniqueRegister here to avoid register sharing with the temp |
| + // register. |
| + InstructionOperand inputs[] = { |
| + g.UseRegister(node->InputAt(0)), g.UseUniqueRegister(node->InputAt(1)), |
| + g.UseRegister(node->InputAt(2)), g.UseUniqueRegister(node->InputAt(3))}; |
| - InstructionOperand outputs[] = { |
| - g.DefineSameAsFirst(node), |
| - g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; |
| + InstructionOperand outputs[] = {g.DefineSameAsFirst(node), |
| + g.DefineAsRegister(projection1)}; |
| - InstructionOperand temps[] = {g.TempRegister()}; |
| + InstructionOperand temps[] = {g.TempRegister()}; |
| - Emit(kIA32AddPair, 2, outputs, 4, inputs, 1, temps); |
| + Emit(kIA32AddPair, 2, outputs, 4, inputs, 1, temps); |
| + } else { |
| + // The high word of the result is not used, so we emit the standard 32 bit |
| + // instruction. |
| + Emit(kIA32Add, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), |
| + g.Use(node->InputAt(2))); |
| + } |
| } |
| void InstructionSelector::VisitInt32PairSub(Node* node) { |
| IA32OperandGenerator g(this); |
| - // We use UseUniqueRegister here to avoid register sharing with the temp |
| - // register. |
| - InstructionOperand inputs[] = { |
| - g.UseRegister(node->InputAt(0)), g.UseUniqueRegister(node->InputAt(1)), |
| - g.UseRegister(node->InputAt(2)), g.UseUniqueRegister(node->InputAt(3))}; |
| + Node* projection1 = NodeProperties::FindProjection(node, 1); |
| + if (projection1) { |
| + // We use UseUniqueRegister here to avoid register sharing with the temp |
| + // register. |
| + InstructionOperand inputs[] = { |
| + g.UseRegister(node->InputAt(0)), g.UseUniqueRegister(node->InputAt(1)), |
| + g.UseRegister(node->InputAt(2)), g.UseUniqueRegister(node->InputAt(3))}; |
| - InstructionOperand outputs[] = { |
| - g.DefineSameAsFirst(node), |
| - g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; |
| + InstructionOperand outputs[] = {g.DefineSameAsFirst(node), |
| + g.DefineAsRegister(projection1)}; |
| - InstructionOperand temps[] = {g.TempRegister()}; |
| + InstructionOperand temps[] = {g.TempRegister()}; |
| - Emit(kIA32SubPair, 2, outputs, 4, inputs, 1, temps); |
| + Emit(kIA32SubPair, 2, outputs, 4, inputs, 1, temps); |
| + } else { |
| + // The high word of the result is not used, so we emit the standard 32 bit |
| + // instruction. |
| + Emit(kIA32Sub, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), |
| + g.Use(node->InputAt(2))); |
| + } |
| } |
| void InstructionSelector::VisitInt32PairMul(Node* node) { |
| IA32OperandGenerator g(this); |
| - // InputAt(3) explicitly shares ecx with OutputRegister(1) to save one |
| - // register and one mov instruction. |
| - InstructionOperand inputs[] = { |
| - g.UseUnique(node->InputAt(0)), g.UseUnique(node->InputAt(1)), |
| - g.UseUniqueRegister(node->InputAt(2)), g.UseFixed(node->InputAt(3), ecx)}; |
| + Node* projection1 = NodeProperties::FindProjection(node, 1); |
| + if (projection1) { |
| + // InputAt(3) explicitly shares ecx with OutputRegister(1) to save one |
| + // register and one mov instruction. |
| + InstructionOperand inputs[] = {g.UseUnique(node->InputAt(0)), |
| + g.UseUnique(node->InputAt(1)), |
| + g.UseUniqueRegister(node->InputAt(2)), |
| + g.UseFixed(node->InputAt(3), ecx)}; |
| - InstructionOperand outputs[] = { |
| - g.DefineAsFixed(node, eax), |
| - g.DefineAsFixed(NodeProperties::FindProjection(node, 1), ecx)}; |
| + InstructionOperand outputs[] = { |
| + g.DefineAsFixed(node, eax), |
| + g.DefineAsFixed(NodeProperties::FindProjection(node, 1), ecx)}; |
| - InstructionOperand temps[] = {g.TempRegister(edx)}; |
| + InstructionOperand temps[] = {g.TempRegister(edx)}; |
| - Emit(kIA32MulPair, 2, outputs, 4, inputs, 1, temps); |
| + Emit(kIA32MulPair, 2, outputs, 4, inputs, 1, temps); |
| + } else { |
| + // The high word of the result is not used, so we emit the standard 32 bit |
| + // instruction. |
| + Emit(kIA32Imul, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), |
| + g.Use(node->InputAt(2))); |
| + } |
| } |
| void VisitWord32PairShift(InstructionSelector* selector, InstructionCode opcode, |
| @@ -712,11 +735,15 @@ void VisitWord32PairShift(InstructionSelector* selector, InstructionCode opcode, |
| g.UseFixed(node->InputAt(1), edx), |
| shift_operand}; |
| - InstructionOperand outputs[] = { |
| - g.DefineAsFixed(node, eax), |
| - g.DefineAsFixed(NodeProperties::FindProjection(node, 1), edx)}; |
| + InstructionOperand outputs[2]; |
| + int32_t output_count = 0; |
| + outputs[output_count++] = g.DefineAsFixed(node, eax); |
| + Node* projection1 = NodeProperties::FindProjection(node, 1); |
| + if (projection1) { |
| + outputs[output_count++] = g.DefineAsFixed(projection1, edx); |
|
titzer
2016/10/19 09:20:42
This doesn't seem quite right. Isn't edx overwritt
ahaas
2016/10/19 09:59:19
We always use edx because it is one of the input r
titzer
2016/10/19 11:07:08
That's what I mean. Shouldn't we always mark edx a
|
| + } |
| - selector->Emit(opcode, 2, outputs, 3, inputs); |
| + selector->Emit(opcode, output_count, outputs, 3, inputs); |
| } |
| void InstructionSelector::VisitWord32PairShl(Node* node) { |