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

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

Issue 1408033003: MIPS: [turbofan] Optimize fpu compares with zero literal. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base/bits.h" 6 #include "src/base/bits.h"
7 #include "src/compiler/instruction-selector-impl.h" 7 #include "src/compiler/instruction-selector-impl.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 10
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 DCHECK(cont->IsSet()); 792 DCHECK(cont->IsSet());
793 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); 793 selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right);
794 } 794 }
795 } 795 }
796 796
797 797
798 // Shared routine for multiple float32 compare operations. 798 // Shared routine for multiple float32 compare operations.
799 void VisitFloat32Compare(InstructionSelector* selector, Node* node, 799 void VisitFloat32Compare(InstructionSelector* selector, Node* node,
800 FlagsContinuation* cont) { 800 FlagsContinuation* cont) {
801 MipsOperandGenerator g(selector); 801 MipsOperandGenerator g(selector);
802 Node* left = node->InputAt(0); 802 Float32BinopMatcher m(node);
803 Node* right = node->InputAt(1); 803 InstructionOperand lhs, rhs;
804 VisitCompare(selector, kMipsCmpS, g.UseRegister(left), g.UseRegister(right), 804
805 cont); 805 lhs = m.left().IsZero() ? g.UseImmediate(m.left().node())
806 : g.UseRegister(m.left().node());
807 rhs = m.right().IsZero() ? g.UseImmediate(m.right().node())
808 : g.UseRegister(m.right().node());
809 VisitCompare(selector, kMipsCmpS, lhs, rhs, cont);
806 } 810 }
807 811
808 812
809 // Shared routine for multiple float64 compare operations. 813 // Shared routine for multiple float64 compare operations.
810 void VisitFloat64Compare(InstructionSelector* selector, Node* node, 814 void VisitFloat64Compare(InstructionSelector* selector, Node* node,
811 FlagsContinuation* cont) { 815 FlagsContinuation* cont) {
812 MipsOperandGenerator g(selector); 816 MipsOperandGenerator g(selector);
813 Node* left = node->InputAt(0); 817 Float64BinopMatcher m(node);
814 Node* right = node->InputAt(1); 818 InstructionOperand lhs, rhs;
815 VisitCompare(selector, kMipsCmpD, g.UseRegister(left), g.UseRegister(right), 819
816 cont); 820 lhs = m.left().IsZero() ? g.UseImmediate(m.left().node())
821 : g.UseRegister(m.left().node());
822 rhs = m.right().IsZero() ? g.UseImmediate(m.right().node())
823 : g.UseRegister(m.right().node());
824 VisitCompare(selector, kMipsCmpD, lhs, rhs, cont);
817 } 825 }
818 826
819 827
820 // Shared routine for multiple word compare operations. 828 // Shared routine for multiple word compare operations.
821 void VisitWordCompare(InstructionSelector* selector, Node* node, 829 void VisitWordCompare(InstructionSelector* selector, Node* node,
822 InstructionCode opcode, FlagsContinuation* cont, 830 InstructionCode opcode, FlagsContinuation* cont,
823 bool commutative) { 831 bool commutative) {
824 MipsOperandGenerator g(selector); 832 MipsOperandGenerator g(selector);
825 Node* left = node->InputAt(0); 833 Node* left = node->InputAt(0);
826 Node* right = node->InputAt(1); 834 Node* right = node->InputAt(1);
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 IsFp64Mode()) { 1156 IsFp64Mode()) {
1149 flags |= MachineOperatorBuilder::kFloat64RoundDown | 1157 flags |= MachineOperatorBuilder::kFloat64RoundDown |
1150 MachineOperatorBuilder::kFloat64RoundTruncate; 1158 MachineOperatorBuilder::kFloat64RoundTruncate;
1151 } 1159 }
1152 return flags; 1160 return flags;
1153 } 1161 }
1154 1162
1155 } // namespace compiler 1163 } // namespace compiler
1156 } // namespace internal 1164 } // namespace internal
1157 } // namespace v8 1165 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/code-generator-mips.cc ('k') | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698