Commit 20ff44f0 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: [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=ahaas@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#35143}
parent 555c4611
......@@ -991,6 +991,18 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ sube(i.OutputRegister(1), i.InputRegister(1), i.InputRegister(3));
DCHECK_EQ(LeaveRC, i.OutputRCBit());
break;
case kPPC_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.
__ mullw(i.TempRegister(0), i.InputRegister(0), i.InputRegister(3));
__ mullw(i.TempRegister(1), i.InputRegister(2), i.InputRegister(1));
__ add(i.TempRegister(0), i.TempRegister(0), i.TempRegister(1));
__ mullw(i.OutputRegister(0), i.InputRegister(0), i.InputRegister(2));
__ mulhwu(i.OutputRegister(1), i.InputRegister(0), i.InputRegister(2));
__ add(i.OutputRegister(1), i.OutputRegister(1), i.TempRegister(0));
break;
case kPPC_ShiftLeftPair:
if (instr->InputAt(2)->IsImmediate()) {
__ ShiftLeftPair(i.OutputRegister(0), i.OutputRegister(1),
......
......@@ -45,6 +45,7 @@ namespace compiler {
V(PPC_Mul64) \
V(PPC_MulHigh32) \
V(PPC_MulHighU32) \
V(PPC_MulPair) \
V(PPC_MulDouble) \
V(PPC_Div32) \
V(PPC_Div64) \
......
......@@ -47,6 +47,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_Mul64:
case kPPC_MulHigh32:
case kPPC_MulHighU32:
case kPPC_MulPair:
case kPPC_MulDouble:
case kPPC_Div32:
case kPPC_Div64:
......
......@@ -810,7 +810,21 @@ void InstructionSelector::VisitInt32PairSub(Node* node) {
VisitPairBinop(this, kPPC_SubPair, node);
}
void InstructionSelector::VisitInt32PairMul(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitInt32PairMul(Node* node) {
PPCOperandGenerator g(this);
InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
g.UseUniqueRegister(node->InputAt(1)),
g.UseUniqueRegister(node->InputAt(2)),
g.UseRegister(node->InputAt(3))};
InstructionOperand outputs[] = {
g.DefineAsRegister(node),
g.DefineAsRegister(NodeProperties::FindProjection(node, 1))};
InstructionOperand temps[] = {g.TempRegister(), g.TempRegister()};
Emit(kPPC_MulPair, 2, outputs, 4, inputs, 2, temps);
}
void VisitPairShift(InstructionSelector* selector, InstructionCode opcode,
Node* node) {
......
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