Commit 25fe0e01 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [wasm] Int64Lowering of Int64Mul on ia32 and arm.

  port 40bdbef9 (r35131)

  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.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#35146}
parent 297daf6c
......@@ -812,6 +812,18 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
}
break;
}
case kX87MulPair: {
__ imul(i.OutputRegister(1), i.InputOperand(0));
__ mov(i.TempRegister(0), i.InputOperand(1));
__ imul(i.TempRegister(0), i.InputOperand(2));
__ add(i.OutputRegister(1), i.TempRegister(0));
__ mov(i.OutputRegister(0), i.InputOperand(0));
// Multiplies the low words and stores them in eax and edx.
__ mul(i.InputRegister(2));
__ add(i.OutputRegister(1), i.TempRegister(0));
break;
}
case kX87ShlPair:
if (HasImmediateInput(instr, 2)) {
__ ShlPair(i.InputRegister(1), i.InputRegister(0), i.InputInt6(2));
......
......@@ -33,6 +33,7 @@ namespace compiler {
V(X87Sar) \
V(X87AddPair) \
V(X87SubPair) \
V(X87MulPair) \
V(X87ShlPair) \
V(X87ShrPair) \
V(X87SarPair) \
......
......@@ -581,7 +581,23 @@ void InstructionSelector::VisitInt32PairSub(Node* node) {
Emit(kX87SubPair, 2, outputs, 4, inputs, 1, temps);
}
void InstructionSelector::VisitInt32PairMul(Node* node) { UNIMPLEMENTED(); }
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)};
InstructionOperand outputs[] = {
g.DefineAsFixed(node, eax),
g.DefineAsFixed(NodeProperties::FindProjection(node, 1), ecx)};
InstructionOperand temps[] = {g.TempRegister(edx)};
Emit(kX87MulPair, 2, outputs, 4, inputs, 1, temps);
}
void InstructionSelector::VisitWord32PairShl(Node* node) {
X87OperandGenerator g(this);
......
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