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..5637f3749f4d2afdd94aefdaf6d827292ceec954 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,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) { |