Commit b295462e authored by jyan's avatar jyan Committed by Commit bot

S390: [wasm] Int64Lowering of Int64Mul.

port 40bdbef9

 Original commit message:
     Int64Mul is lowered to a new turbofan operator, Int32MulPair. The new
     operator takes 4 inputs an generates 2 outputs. The inputs are the low
     word of the left input, high word of the left input, the low word of the
     right input, and high word of the right input. The ouputs are the low
     and high word of the result of the multiplication.

R=titzer@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1849543003

Cr-Commit-Position: refs/heads/master@{#35167}
parent 9e1f2c5e
......@@ -882,6 +882,19 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ SubLogicalWithBorrow32(i.OutputRegister(1), i.InputRegister(1),
i.InputRegister(3));
break;
case kS390_MulPair:
// i.InputRegister(0) ... left low word.
// i.InputRegister(1) ... left high word.
// i.InputRegister(2) ... right low word.
// i.InputRegister(3) ... right high word.
__ sllg(r0, i.InputRegister(1), Operand(32));
__ sllg(r1, i.InputRegister(3), Operand(32));
__ lr(r0, i.InputRegister(0));
__ lr(r1, i.InputRegister(2));
__ msgr(r1, r0);
__ lr(i.OutputRegister(0), r1);
__ srag(i.OutputRegister(1), r1, Operand(32));
break;
case kS390_ShiftLeftPair:
if (instr->InputAt(2)->IsImmediate()) {
__ ShiftLeftPair(i.OutputRegister(0), i.OutputRegister(1),
......
......@@ -43,6 +43,7 @@ namespace compiler {
V(S390_SubFloat) \
V(S390_SubDouble) \
V(S390_SubPair) \
V(S390_MulPair) \
V(S390_Mul32) \
V(S390_Mul64) \
V(S390_MulHigh32) \
......
......@@ -42,6 +42,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kS390_Sub:
case kS390_SubWithOverflow32:
case kS390_SubPair:
case kS390_MulPair:
case kS390_SubFloat:
case kS390_SubDouble:
case kS390_Mul32:
......
......@@ -779,6 +779,20 @@ void InstructionSelector::VisitInt32PairSub(Node* node) {
VisitPairBinop(this, kS390_SubPair, 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);
}
void VisitPairShift(InstructionSelector* selector, ArchOpcode opcode,
Node* node) {
S390OperandGenerator g(selector);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment