Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Unified Diff: src/compiler/ia32/instruction-selector-ia32.cc

Issue 2711633006: [wasm] Reuse constrained input for same vreg
Patch Set: alternative mulpair Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/ia32/instruction-scheduler-ia32.cc ('k') | src/compiler/instruction-selector-impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ia32/instruction-selector-ia32.cc
diff --git a/src/compiler/ia32/instruction-selector-ia32.cc b/src/compiler/ia32/instruction-selector-ia32.cc
index a5f72c70b230320108f454b9fd62fa654d51467f..45aa782a4ff77b8355c18ff426692739f44a3758 100644
--- a/src/compiler/ia32/instruction-selector-ia32.cc
+++ b/src/compiler/ia32/instruction-selector-ia32.cc
@@ -763,20 +763,27 @@ void InstructionSelector::VisitInt32PairMul(Node* node) {
Node* projection1 = NodeProperties::FindProjection(node, 1);
if (projection1) {
- // 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)};
+ Node* lout = node;
+ Node* hout = NodeProperties::FindProjection(node, 1);
+ int temp1 = g.AllocateVirtualRegister();
+ int temp2 = g.AllocateVirtualRegister();
+ int temp3 = g.AllocateVirtualRegister();
+ int temp4 = g.AllocateVirtualRegister();
+
+ Emit(kIA32Imul, g.DefineAsFixedForVreg(temp1, ecx),
+ g.UseFixed(node->InputAt(3), ecx), g.Use(node->InputAt(0)));
+ Emit(kIA32Imul, g.DefineAsFixedForVreg(temp2, edx),
+ g.UseFixed(node->InputAt(1), edx), g.Use(node->InputAt(2)));
+ Emit(kIA32Add, g.DefineAsFixedForVreg(temp3, ecx),
+ g.UseFixedForVreg(temp2, ecx), g.UseRegisterForVreg(temp1));
+ InstructionOperand outputs[] = {g.DefineAsFixed(lout, eax),
+ g.DefineAsFixedForVreg(temp4, edx)};
+ InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
+ g.UseUniqueRegister(node->InputAt(2))};
+ Emit(kIA32Umul, 2, outputs, 2, inputs);
+ Emit(kIA32Add, g.DefineAsFixed(hout, ecx), g.UseFixedForVreg(temp3, ecx),
+ g.UseRegisterForVreg(temp4));
- InstructionOperand outputs[] = {
- g.DefineAsFixed(node, eax),
- g.DefineAsFixed(NodeProperties::FindProjection(node, 1), ecx)};
-
- InstructionOperand temps[] = {g.TempRegister(edx)};
-
- Emit(kIA32MulPair, 2, outputs, 4, inputs, 1, temps);
} else {
// The high word of the result is not used, so we emit the standard 32 bit
// instruction.
« no previous file with comments | « src/compiler/ia32/instruction-scheduler-ia32.cc ('k') | src/compiler/instruction-selector-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698