Commit f954934d authored by ahaas's avatar ahaas Committed by Commit bot

[wasm] Refactoring pair-shift code in the instruction selector of arm and ia32.

R=titzer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#35140}
parent 53d51c52
...@@ -638,8 +638,9 @@ void InstructionSelector::VisitInt32PairMul(Node* node) { ...@@ -638,8 +638,9 @@ void InstructionSelector::VisitInt32PairMul(Node* node) {
Emit(kIA32MulPair, 2, outputs, 4, inputs, 1, temps); Emit(kIA32MulPair, 2, outputs, 4, inputs, 1, temps);
} }
void InstructionSelector::VisitWord32PairShl(Node* node) { void VisitWord32PairShift(InstructionSelector* selector, InstructionCode opcode,
IA32OperandGenerator g(this); Node* node) {
IA32OperandGenerator g(selector);
Node* shift = node->InputAt(2); Node* shift = node->InputAt(2);
InstructionOperand shift_operand; InstructionOperand shift_operand;
...@@ -656,49 +657,19 @@ void InstructionSelector::VisitWord32PairShl(Node* node) { ...@@ -656,49 +657,19 @@ void InstructionSelector::VisitWord32PairShl(Node* node) {
g.DefineAsFixed(node, eax), g.DefineAsFixed(node, eax),
g.DefineAsFixed(NodeProperties::FindProjection(node, 1), edx)}; g.DefineAsFixed(NodeProperties::FindProjection(node, 1), edx)};
Emit(kIA32ShlPair, 2, outputs, 3, inputs); selector->Emit(opcode, 2, outputs, 3, inputs);
} }
void InstructionSelector::VisitWord32PairShr(Node* node) { void InstructionSelector::VisitWord32PairShl(Node* node) {
IA32OperandGenerator g(this); VisitWord32PairShift(this, kIA32ShlPair, node);
}
Node* shift = node->InputAt(2);
InstructionOperand shift_operand;
if (g.CanBeImmediate(shift)) {
shift_operand = g.UseImmediate(shift);
} else {
shift_operand = g.UseFixed(shift, ecx);
}
InstructionOperand inputs[] = {g.UseFixed(node->InputAt(0), eax),
g.UseFixed(node->InputAt(1), edx),
shift_operand};
InstructionOperand outputs[] = {
g.DefineAsFixed(node, eax),
g.DefineAsFixed(NodeProperties::FindProjection(node, 1), edx)};
Emit(kIA32ShrPair, 2, outputs, 3, inputs); void InstructionSelector::VisitWord32PairShr(Node* node) {
VisitWord32PairShift(this, kIA32ShrPair, node);
} }
void InstructionSelector::VisitWord32PairSar(Node* node) { void InstructionSelector::VisitWord32PairSar(Node* node) {
IA32OperandGenerator g(this); VisitWord32PairShift(this, kIA32SarPair, node);
Node* shift = node->InputAt(2);
InstructionOperand shift_operand;
if (g.CanBeImmediate(shift)) {
shift_operand = g.UseImmediate(shift);
} else {
shift_operand = g.UseFixed(shift, ecx);
}
InstructionOperand inputs[] = {g.UseFixed(node->InputAt(0), eax),
g.UseFixed(node->InputAt(1), edx),
shift_operand};
InstructionOperand outputs[] = {
g.DefineAsFixed(node, eax),
g.DefineAsFixed(NodeProperties::FindProjection(node, 1), edx)};
Emit(kIA32SarPair, 2, outputs, 3, inputs);
} }
void InstructionSelector::VisitWord32Ror(Node* node) { void InstructionSelector::VisitWord32Ror(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