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

Side by Side Diff: src/compiler/mips/instruction-selector-mips.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
« 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 26 matching lines...) Expand all
37 int32_t value = m.Value(); 37 int32_t value = m.Value();
38 switch (ArchOpcodeField::decode(opcode)) { 38 switch (ArchOpcodeField::decode(opcode)) {
39 case kMipsShl: 39 case kMipsShl:
40 case kMipsSar: 40 case kMipsSar:
41 case kMipsShr: 41 case kMipsShr:
42 return is_uint5(value); 42 return is_uint5(value);
43 case kMipsXor: 43 case kMipsXor:
44 return is_uint16(value); 44 return is_uint16(value);
45 case kMipsLdc1: 45 case kMipsLdc1:
46 case kMipsSdc1: 46 case kMipsSdc1:
47 case kCheckedLoadFloat32:
48 case kCheckedLoadFloat64: 47 case kCheckedLoadFloat64:
paul.l... 2015/10/12 03:53:45 Why do you remove the kCheckedLoadFloat32/kChecked
dusan.milosavljevic 2015/10/12 14:41:52 Yes, the requirement for kCheckedLoadFloat32/kChec
49 case kCheckedStoreFloat32:
50 case kCheckedStoreFloat64: 48 case kCheckedStoreFloat64:
51 return is_int16(value + kIntSize); 49 return std::numeric_limits<int16_t>::min() <= (value + kIntSize) &&
50 std::numeric_limits<int16_t>::max() >= (value + kIntSize);
paul.l... 2015/10/12 03:53:45 Can you explain why this is better than is_int16(v
dusan.milosavljevic 2015/10/12 14:41:52 Old check does not handle minimum offset edge cas
52 default: 51 default:
53 return is_int16(value); 52 return is_int16(value);
54 } 53 }
55 } 54 }
56 55
57 private: 56 private:
58 bool ImmediateFitsAddrMode1Instruction(int32_t imm) const { 57 bool ImmediateFitsAddrMode1Instruction(int32_t imm) const {
59 TRACE_UNIMPL(); 58 TRACE_UNIMPL();
60 return false; 59 return false;
61 } 60 }
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 void VisitWordCompare(InstructionSelector* selector, Node* node, 818 void VisitWordCompare(InstructionSelector* selector, Node* node,
820 InstructionCode opcode, FlagsContinuation* cont, 819 InstructionCode opcode, FlagsContinuation* cont,
821 bool commutative) { 820 bool commutative) {
822 MipsOperandGenerator g(selector); 821 MipsOperandGenerator g(selector);
823 Node* left = node->InputAt(0); 822 Node* left = node->InputAt(0);
824 Node* right = node->InputAt(1); 823 Node* right = node->InputAt(1);
825 824
826 // Match immediates on left or right side of comparison. 825 // Match immediates on left or right side of comparison.
827 if (g.CanBeImmediate(right, opcode)) { 826 if (g.CanBeImmediate(right, opcode)) {
828 switch (cont->condition()) { 827 switch (cont->condition()) {
828 case kEqual:
829 case kNotEqual:
830 if (cont->IsSet()) {
831 VisitCompare(selector, opcode, g.UseRegister(left),
832 g.UseImmediate(right), cont);
833 } else {
834 VisitCompare(selector, opcode, g.UseRegister(left),
835 g.UseRegister(right), cont);
836 }
837 break;
829 case kSignedLessThan: 838 case kSignedLessThan:
830 case kSignedGreaterThanOrEqual: 839 case kSignedGreaterThanOrEqual:
831 case kUnsignedLessThan: 840 case kUnsignedLessThan:
832 case kUnsignedGreaterThanOrEqual: 841 case kUnsignedGreaterThanOrEqual:
833 VisitCompare(selector, opcode, g.UseRegister(left), 842 VisitCompare(selector, opcode, g.UseRegister(left),
834 g.UseImmediate(right), cont); 843 g.UseImmediate(right), cont);
835 break; 844 break;
836 default: 845 default:
837 VisitCompare(selector, opcode, g.UseRegister(left), 846 VisitCompare(selector, opcode, g.UseRegister(left),
838 g.UseRegister(right), cont); 847 g.UseRegister(right), cont);
839 } 848 }
840 } else if (g.CanBeImmediate(left, opcode)) { 849 } else if (g.CanBeImmediate(left, opcode)) {
841 if (!commutative) cont->Commute(); 850 if (!commutative) cont->Commute();
842 switch (cont->condition()) { 851 switch (cont->condition()) {
852 case kEqual:
853 case kNotEqual:
854 if (cont->IsSet()) {
855 VisitCompare(selector, opcode, g.UseRegister(right),
856 g.UseImmediate(left), cont);
857 } else {
858 VisitCompare(selector, opcode, g.UseRegister(right),
859 g.UseRegister(left), cont);
860 }
861 break;
843 case kSignedLessThan: 862 case kSignedLessThan:
844 case kSignedGreaterThanOrEqual: 863 case kSignedGreaterThanOrEqual:
845 case kUnsignedLessThan: 864 case kUnsignedLessThan:
846 case kUnsignedGreaterThanOrEqual: 865 case kUnsignedGreaterThanOrEqual:
847 VisitCompare(selector, opcode, g.UseRegister(right), 866 VisitCompare(selector, opcode, g.UseRegister(right),
848 g.UseImmediate(left), cont); 867 g.UseImmediate(left), cont);
849 break; 868 break;
850 default: 869 default:
851 VisitCompare(selector, opcode, g.UseRegister(right), 870 VisitCompare(selector, opcode, g.UseRegister(right),
852 g.UseRegister(left), cont); 871 g.UseRegister(left), cont);
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 IsFp64Mode()) { 1145 IsFp64Mode()) {
1127 flags |= MachineOperatorBuilder::kFloat64RoundDown | 1146 flags |= MachineOperatorBuilder::kFloat64RoundDown |
1128 MachineOperatorBuilder::kFloat64RoundTruncate; 1147 MachineOperatorBuilder::kFloat64RoundTruncate;
1129 } 1148 }
1130 return flags; 1149 return flags;
1131 } 1150 }
1132 1151
1133 } // namespace compiler 1152 } // namespace compiler
1134 } // namespace internal 1153 } // namespace internal
1135 } // namespace v8 1154 } // 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