Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
[turbofan] Fix operands for VisitDiv on Intel.
Browse files Browse the repository at this point in the history
The idiv instruction has 2 registers as output. This needs to be
modeled so that the move optimizer won't incorrectly elide away
moves.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#34978}
  • Loading branch information
mtrofin authored and Commit bot committed Mar 22, 2016
1 parent e1bd9af commit 1da4b88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/compiler/ia32/instruction-selector-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,10 @@ void VisitDiv(InstructionSelector* selector, Node* node, ArchOpcode opcode) {

void VisitMod(InstructionSelector* selector, Node* node, ArchOpcode opcode) {
IA32OperandGenerator g(selector);
InstructionOperand temps[] = {g.TempRegister(eax)};
selector->Emit(opcode, g.DefineAsFixed(node, edx),
g.UseFixed(node->InputAt(0), eax),
g.UseUnique(node->InputAt(1)));
g.UseUnique(node->InputAt(1)), arraysize(temps), temps);
}

void EmitLea(InstructionSelector* selector, Node* result, Node* index,
Expand Down
7 changes: 4 additions & 3 deletions src/compiler/x64/instruction-selector-x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,10 @@ void VisitDiv(InstructionSelector* selector, Node* node, ArchOpcode opcode) {

void VisitMod(InstructionSelector* selector, Node* node, ArchOpcode opcode) {
X64OperandGenerator g(selector);
selector->Emit(opcode, g.DefineAsFixed(node, rdx),
g.UseFixed(node->InputAt(0), rax),
g.UseUniqueRegister(node->InputAt(1)));
InstructionOperand temps[] = {g.TempRegister(rax)};
selector->Emit(
opcode, g.DefineAsFixed(node, rdx), g.UseFixed(node->InputAt(0), rax),
g.UseUniqueRegister(node->InputAt(1)), arraysize(temps), temps);
}

} // namespace
Expand Down

0 comments on commit 1da4b88

Please sign in to comment.