Index: src/compiler/x87/instruction-selector-x87.cc |
diff --git a/src/compiler/x87/instruction-selector-x87.cc b/src/compiler/x87/instruction-selector-x87.cc |
index 757eee961ead014bc475fb50f3451e18aad6031c..93c52e0eb7bda228d5a8b4b1649fbfa185a34ae3 100644 |
--- a/src/compiler/x87/instruction-selector-x87.cc |
+++ b/src/compiler/x87/instruction-selector-x87.cc |
@@ -607,55 +607,78 @@ void InstructionSelector::VisitWord32Sar(Node* node) { |
void InstructionSelector::VisitInt32PairAdd(Node* node) { |
X87OperandGenerator 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(kX87AddPair, 2, outputs, 4, inputs, 1, temps); |
+ Emit(kX87AddPair, 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(kX87Add, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), |
+ g.Use(node->InputAt(2))); |
+ } |
} |
void InstructionSelector::VisitInt32PairSub(Node* node) { |
X87OperandGenerator 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(kX87SubPair, 2, outputs, 4, inputs, 1, temps); |
+ Emit(kX87SubPair, 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(kX87Sub, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), |
+ g.Use(node->InputAt(2))); |
+ } |
} |
void InstructionSelector::VisitInt32PairMul(Node* node) { |
X87OperandGenerator 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(kX87MulPair, 2, outputs, 4, inputs, 1, temps); |
+ Emit(kX87MulPair, 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(kX87Imul, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), |
+ g.Use(node->InputAt(2))); |
+ } |
} |
void VisitWord32PairShift(InstructionSelector* selector, InstructionCode opcode, |
@@ -673,11 +696,19 @@ 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]; |
+ InstructionOperand temps[1]; |
+ int32_t output_count = 0; |
+ int32_t temp_count = 0; |
+ outputs[output_count++] = g.DefineAsFixed(node, eax); |
+ Node* projection1 = NodeProperties::FindProjection(node, 1); |
+ if (projection1) { |
+ outputs[output_count++] = g.DefineAsFixed(projection1, edx); |
+ } else { |
+ temps[temp_count++] = g.TempRegister(edx); |
+ } |
- selector->Emit(opcode, 2, outputs, 3, inputs); |
+ selector->Emit(opcode, output_count, outputs, 3, inputs, temp_count, temps); |
} |
void InstructionSelector::VisitWord32PairShl(Node* node) { |