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

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

Issue 1400833002: MIPS: [turbofan] Improve test and equality compare with zero and constants. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo. 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
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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 void VisitWordCompare(InstructionSelector* selector, Node* node, 1012 void VisitWordCompare(InstructionSelector* selector, Node* node,
1013 InstructionCode opcode, FlagsContinuation* cont, 1013 InstructionCode opcode, FlagsContinuation* cont,
1014 bool commutative) { 1014 bool commutative) {
1015 Mips64OperandGenerator g(selector); 1015 Mips64OperandGenerator g(selector);
1016 Node* left = node->InputAt(0); 1016 Node* left = node->InputAt(0);
1017 Node* right = node->InputAt(1); 1017 Node* right = node->InputAt(1);
1018 1018
1019 // Match immediates on left or right side of comparison. 1019 // Match immediates on left or right side of comparison.
1020 if (g.CanBeImmediate(right, opcode)) { 1020 if (g.CanBeImmediate(right, opcode)) {
1021 switch (cont->condition()) { 1021 switch (cont->condition()) {
1022 case kEqual:
1023 case kNotEqual:
1024 if (cont->IsSet()) {
1025 VisitCompare(selector, opcode, g.UseRegister(left),
1026 g.UseImmediate(right), cont);
1027 } else {
1028 VisitCompare(selector, opcode, g.UseRegister(left),
1029 g.UseRegister(right), cont);
1030 }
1031 break;
1022 case kSignedLessThan: 1032 case kSignedLessThan:
1023 case kSignedGreaterThanOrEqual: 1033 case kSignedGreaterThanOrEqual:
1024 case kUnsignedLessThan: 1034 case kUnsignedLessThan:
1025 case kUnsignedGreaterThanOrEqual: 1035 case kUnsignedGreaterThanOrEqual:
1026 VisitCompare(selector, opcode, g.UseRegister(left), 1036 VisitCompare(selector, opcode, g.UseRegister(left),
1027 g.UseImmediate(right), cont); 1037 g.UseImmediate(right), cont);
1028 break; 1038 break;
1029 default: 1039 default:
1030 VisitCompare(selector, opcode, g.UseRegister(left), 1040 VisitCompare(selector, opcode, g.UseRegister(left),
1031 g.UseRegister(right), cont); 1041 g.UseRegister(right), cont);
1032 } 1042 }
1033 } else if (g.CanBeImmediate(left, opcode)) { 1043 } else if (g.CanBeImmediate(left, opcode)) {
1034 if (!commutative) cont->Commute(); 1044 if (!commutative) cont->Commute();
1035 switch (cont->condition()) { 1045 switch (cont->condition()) {
1046 case kEqual:
1047 case kNotEqual:
1048 if (cont->IsSet()) {
1049 VisitCompare(selector, opcode, g.UseRegister(right),
1050 g.UseImmediate(left), cont);
1051 } else {
1052 VisitCompare(selector, opcode, g.UseRegister(right),
1053 g.UseRegister(left), cont);
1054 }
1055 break;
1036 case kSignedLessThan: 1056 case kSignedLessThan:
1037 case kSignedGreaterThanOrEqual: 1057 case kSignedGreaterThanOrEqual:
1038 case kUnsignedLessThan: 1058 case kUnsignedLessThan:
1039 case kUnsignedGreaterThanOrEqual: 1059 case kUnsignedGreaterThanOrEqual:
1040 VisitCompare(selector, opcode, g.UseRegister(right), 1060 VisitCompare(selector, opcode, g.UseRegister(right),
1041 g.UseImmediate(left), cont); 1061 g.UseImmediate(left), cont);
1042 break; 1062 break;
1043 default: 1063 default:
1044 VisitCompare(selector, opcode, g.UseRegister(right), 1064 VisitCompare(selector, opcode, g.UseRegister(right),
1045 g.UseRegister(left), cont); 1065 g.UseRegister(left), cont);
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 // static 1404 // static
1385 MachineOperatorBuilder::Flags 1405 MachineOperatorBuilder::Flags
1386 InstructionSelector::SupportedMachineOperatorFlags() { 1406 InstructionSelector::SupportedMachineOperatorFlags() {
1387 return MachineOperatorBuilder::kFloat64RoundDown | 1407 return MachineOperatorBuilder::kFloat64RoundDown |
1388 MachineOperatorBuilder::kFloat64RoundTruncate; 1408 MachineOperatorBuilder::kFloat64RoundTruncate;
1389 } 1409 }
1390 1410
1391 } // namespace compiler 1411 } // namespace compiler
1392 } // namespace internal 1412 } // namespace internal
1393 } // namespace v8 1413 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698