| Index: src/compiler/s390/instruction-selector-s390.cc
|
| diff --git a/src/compiler/s390/instruction-selector-s390.cc b/src/compiler/s390/instruction-selector-s390.cc
|
| index f1aa332a493ce44e0fc8aaa4d9598ec3cc8e26b6..84938dfd9f2a7fd8ddca383b69f61f2575848ef1 100644
|
| --- a/src/compiler/s390/instruction-selector-s390.cc
|
| +++ b/src/compiler/s390/instruction-selector-s390.cc
|
| @@ -835,48 +835,69 @@ void InstructionSelector::VisitWord32Sar(Node* node) {
|
| }
|
|
|
| #if !V8_TARGET_ARCH_S390X
|
| -void VisitPairBinop(InstructionSelector* selector, ArchOpcode opcode,
|
| - Node* node) {
|
| +void VisitPairBinop(InstructionSelector* selector, InstructionCode opcode,
|
| + InstructionCode opcode2, Node* node) {
|
| S390OperandGenerator g(selector);
|
|
|
| - // We use UseUniqueRegister here to avoid register sharing with the output
|
| - // registers.
|
| - 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 output
|
| + // registers.
|
| + 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.DefineAsRegister(node),
|
| - g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
|
| + InstructionOperand outputs[] = {
|
| + g.DefineAsRegister(node),
|
| + g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
|
|
|
| - selector->Emit(opcode, 2, outputs, 4, inputs);
|
| + selector->Emit(opcode, 2, outputs, 4, inputs);
|
| + } else {
|
| + // The high word of the result is not used, so we emit the standard 32 bit
|
| + // instruction.
|
| + selector->Emit(opcode2, g.DefineSameAsFirst(node),
|
| + g.UseRegister(node->InputAt(0)),
|
| + g.UseRegister(node->InputAt(2)));
|
| + }
|
| }
|
|
|
| void InstructionSelector::VisitInt32PairAdd(Node* node) {
|
| - VisitPairBinop(this, kS390_AddPair, node);
|
| + VisitPairBinop(this, kS390_AddPair, kS390_Add32, node);
|
| }
|
|
|
| void InstructionSelector::VisitInt32PairSub(Node* node) {
|
| - VisitPairBinop(this, kS390_SubPair, node);
|
| + VisitPairBinop(this, kS390_SubPair, kS390_Sub32, node);
|
| }
|
|
|
| void InstructionSelector::VisitInt32PairMul(Node* node) {
|
| S390OperandGenerator g(this);
|
| - InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
|
| - g.UseUniqueRegister(node->InputAt(1)),
|
| - g.UseUniqueRegister(node->InputAt(2)),
|
| - g.UseUniqueRegister(node->InputAt(3))};
|
| -
|
| - InstructionOperand outputs[] = {
|
| - g.DefineAsRegister(node),
|
| - g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
|
| -
|
| - Emit(kS390_MulPair, 2, outputs, 4, inputs);
|
| + Node* projection1 = NodeProperties::FindProjection(node, 1);
|
| + if (projection1) {
|
| + InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
|
| + g.UseUniqueRegister(node->InputAt(1)),
|
| + g.UseUniqueRegister(node->InputAt(2)),
|
| + g.UseUniqueRegister(node->InputAt(3))};
|
| +
|
| + InstructionOperand outputs[] = {
|
| + g.DefineAsRegister(node),
|
| + g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
|
| +
|
| + Emit(kS390_MulPair, 2, outputs, 4, inputs);
|
| + } else {
|
| + // The high word of the result is not used, so we emit the standard 32 bit
|
| + // instruction.
|
| + Emit(kS390_Mul32, g.DefineSameAsFirst(node),
|
| + g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(2)));
|
| + }
|
| }
|
|
|
| -void VisitPairShift(InstructionSelector* selector, ArchOpcode opcode,
|
| +namespace {
|
| +// Shared routine for multiple shift operations.
|
| +void VisitPairShift(InstructionSelector* selector, InstructionCode opcode,
|
| Node* node) {
|
| S390OperandGenerator g(selector);
|
| + // We use g.UseUniqueRegister here to guarantee that there is
|
| + // no register aliasing of input registers with output registers.
|
| Int32Matcher m(node->InputAt(2));
|
| InstructionOperand shift_operand;
|
| if (m.HasValue()) {
|
| @@ -885,16 +906,27 @@ void VisitPairShift(InstructionSelector* selector, ArchOpcode opcode,
|
| shift_operand = g.UseUniqueRegister(m.node());
|
| }
|
|
|
| - InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0)),
|
| - g.UseRegister(node->InputAt(1)),
|
| + InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
|
| + g.UseUniqueRegister(node->InputAt(1)),
|
| shift_operand};
|
|
|
| - InstructionOperand outputs[] = {
|
| - g.DefineSameAsFirst(node),
|
| - g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
|
| + Node* projection1 = NodeProperties::FindProjection(node, 1);
|
|
|
| - selector->Emit(opcode, 2, outputs, 3, inputs);
|
| + InstructionOperand outputs[2];
|
| + InstructionOperand temps[1];
|
| + int32_t output_count = 0;
|
| + int32_t temp_count = 0;
|
| +
|
| + outputs[output_count++] = g.DefineAsRegister(node);
|
| + if (projection1) {
|
| + outputs[output_count++] = g.DefineAsRegister(projection1);
|
| + } else {
|
| + temps[temp_count++] = g.TempRegister();
|
| + }
|
| +
|
| + selector->Emit(opcode, output_count, outputs, 3, inputs, temp_count, temps);
|
| }
|
| +} // namespace
|
|
|
| void InstructionSelector::VisitWord32PairShl(Node* node) {
|
| VisitPairShift(this, kS390_ShiftLeftPair, node);
|
|
|