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

Side by Side Diff: src/compiler/ia32/instruction-selector-ia32.cc

Issue 2711633006: [wasm] Reuse constrained input for same vreg
Patch Set: alternative mulpair Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/compiler/instruction-selector-impl.h" 6 #include "src/compiler/instruction-selector-impl.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 Emit(kIA32Sub, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), 756 Emit(kIA32Sub, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)),
757 g.Use(node->InputAt(2))); 757 g.Use(node->InputAt(2)));
758 } 758 }
759 } 759 }
760 760
761 void InstructionSelector::VisitInt32PairMul(Node* node) { 761 void InstructionSelector::VisitInt32PairMul(Node* node) {
762 IA32OperandGenerator g(this); 762 IA32OperandGenerator g(this);
763 763
764 Node* projection1 = NodeProperties::FindProjection(node, 1); 764 Node* projection1 = NodeProperties::FindProjection(node, 1);
765 if (projection1) { 765 if (projection1) {
766 // InputAt(3) explicitly shares ecx with OutputRegister(1) to save one 766 Node* lout = node;
767 // register and one mov instruction. 767 Node* hout = NodeProperties::FindProjection(node, 1);
768 InstructionOperand inputs[] = {g.UseUnique(node->InputAt(0)), 768 int temp1 = g.AllocateVirtualRegister();
769 g.UseUnique(node->InputAt(1)), 769 int temp2 = g.AllocateVirtualRegister();
770 g.UseUniqueRegister(node->InputAt(2)), 770 int temp3 = g.AllocateVirtualRegister();
771 g.UseFixed(node->InputAt(3), ecx)}; 771 int temp4 = g.AllocateVirtualRegister();
772 772
773 InstructionOperand outputs[] = { 773 Emit(kIA32Imul, g.DefineAsFixedForVreg(temp1, ecx),
774 g.DefineAsFixed(node, eax), 774 g.UseFixed(node->InputAt(3), ecx), g.Use(node->InputAt(0)));
775 g.DefineAsFixed(NodeProperties::FindProjection(node, 1), ecx)}; 775 Emit(kIA32Imul, g.DefineAsFixedForVreg(temp2, edx),
776 g.UseFixed(node->InputAt(1), edx), g.Use(node->InputAt(2)));
777 Emit(kIA32Add, g.DefineAsFixedForVreg(temp3, ecx),
778 g.UseFixedForVreg(temp2, ecx), g.UseRegisterForVreg(temp1));
779 InstructionOperand outputs[] = {g.DefineAsFixed(lout, eax),
780 g.DefineAsFixedForVreg(temp4, edx)};
781 InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)),
782 g.UseUniqueRegister(node->InputAt(2))};
783 Emit(kIA32Umul, 2, outputs, 2, inputs);
784 Emit(kIA32Add, g.DefineAsFixed(hout, ecx), g.UseFixedForVreg(temp3, ecx),
785 g.UseRegisterForVreg(temp4));
776 786
777 InstructionOperand temps[] = {g.TempRegister(edx)};
778
779 Emit(kIA32MulPair, 2, outputs, 4, inputs, 1, temps);
780 } else { 787 } else {
781 // The high word of the result is not used, so we emit the standard 32 bit 788 // The high word of the result is not used, so we emit the standard 32 bit
782 // instruction. 789 // instruction.
783 Emit(kIA32Imul, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), 790 Emit(kIA32Imul, g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)),
784 g.Use(node->InputAt(2))); 791 g.Use(node->InputAt(2)));
785 } 792 }
786 } 793 }
787 794
788 void VisitWord32PairShift(InstructionSelector* selector, InstructionCode opcode, 795 void VisitWord32PairShift(InstructionSelector* selector, InstructionCode opcode,
789 Node* node) { 796 Node* node) {
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 // static 1748 // static
1742 MachineOperatorBuilder::AlignmentRequirements 1749 MachineOperatorBuilder::AlignmentRequirements
1743 InstructionSelector::AlignmentRequirements() { 1750 InstructionSelector::AlignmentRequirements() {
1744 return MachineOperatorBuilder::AlignmentRequirements:: 1751 return MachineOperatorBuilder::AlignmentRequirements::
1745 FullUnalignedAccessSupport(); 1752 FullUnalignedAccessSupport();
1746 } 1753 }
1747 1754
1748 } // namespace compiler 1755 } // namespace compiler
1749 } // namespace internal 1756 } // namespace internal
1750 } // namespace v8 1757 } // namespace v8
OLDNEW
« 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