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

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

Issue 850653002: [turbofan] Improve code generation for unordered comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/ia32/code-generator-ia32.cc ('k') | src/compiler/instruction.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/compiler/instruction-selector-impl.h" 5 #include "src/compiler/instruction-selector-impl.h"
6 #include "src/compiler/node-matchers.h" 6 #include "src/compiler/node-matchers.h"
7 #include "src/compiler/node-properties-inl.h" 7 #include "src/compiler/node-properties-inl.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 Node* left, Node* right, FlagsContinuation* cont, 792 Node* left, Node* right, FlagsContinuation* cont,
793 bool commutative) { 793 bool commutative) {
794 IA32OperandGenerator g(selector); 794 IA32OperandGenerator g(selector);
795 if (commutative && g.CanBeBetterLeftOperand(right)) { 795 if (commutative && g.CanBeBetterLeftOperand(right)) {
796 std::swap(left, right); 796 std::swap(left, right);
797 } 797 }
798 VisitCompare(selector, opcode, g.UseRegister(left), g.Use(right), cont); 798 VisitCompare(selector, opcode, g.UseRegister(left), g.Use(right), cont);
799 } 799 }
800 800
801 801
802 // Shared routine for multiple float compare operations. 802 // Shared routine for multiple float64 compare operations (inputs commuted).
803 void VisitFloat64Compare(InstructionSelector* selector, Node* node, 803 void VisitFloat64Compare(InstructionSelector* selector, Node* node,
804 FlagsContinuation* cont) { 804 FlagsContinuation* cont) {
805 VisitCompare(selector, kSSEFloat64Cmp, node->InputAt(0), node->InputAt(1), 805 Node* const left = node->InputAt(0);
806 cont, node->op()->HasProperty(Operator::kCommutative)); 806 Node* const right = node->InputAt(1);
807 VisitCompare(selector, kSSEFloat64Cmp, right, left, cont, false);
807 } 808 }
808 809
809 810
810 // Shared routine for multiple word compare operations. 811 // Shared routine for multiple word compare operations.
811 void VisitWordCompare(InstructionSelector* selector, Node* node, 812 void VisitWordCompare(InstructionSelector* selector, Node* node,
812 InstructionCode opcode, FlagsContinuation* cont) { 813 InstructionCode opcode, FlagsContinuation* cont) {
813 IA32OperandGenerator g(selector); 814 IA32OperandGenerator g(selector);
814 Node* const left = node->InputAt(0); 815 Node* const left = node->InputAt(0);
815 Node* const right = node->InputAt(1); 816 Node* const right = node->InputAt(1);
816 817
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 case IrOpcode::kUint32LessThan: 862 case IrOpcode::kUint32LessThan:
862 cont->OverwriteAndNegateIfEqual(kUnsignedLessThan); 863 cont->OverwriteAndNegateIfEqual(kUnsignedLessThan);
863 return VisitWordCompare(selector, value, cont); 864 return VisitWordCompare(selector, value, cont);
864 case IrOpcode::kUint32LessThanOrEqual: 865 case IrOpcode::kUint32LessThanOrEqual:
865 cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual); 866 cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual);
866 return VisitWordCompare(selector, value, cont); 867 return VisitWordCompare(selector, value, cont);
867 case IrOpcode::kFloat64Equal: 868 case IrOpcode::kFloat64Equal:
868 cont->OverwriteAndNegateIfEqual(kUnorderedEqual); 869 cont->OverwriteAndNegateIfEqual(kUnorderedEqual);
869 return VisitFloat64Compare(selector, value, cont); 870 return VisitFloat64Compare(selector, value, cont);
870 case IrOpcode::kFloat64LessThan: 871 case IrOpcode::kFloat64LessThan:
871 cont->OverwriteAndNegateIfEqual(kUnorderedLessThan); 872 cont->OverwriteAndNegateIfEqual(kUnsignedGreaterThan);
872 return VisitFloat64Compare(selector, value, cont); 873 return VisitFloat64Compare(selector, value, cont);
873 case IrOpcode::kFloat64LessThanOrEqual: 874 case IrOpcode::kFloat64LessThanOrEqual:
874 cont->OverwriteAndNegateIfEqual(kUnorderedLessThanOrEqual); 875 cont->OverwriteAndNegateIfEqual(kUnsignedGreaterThanOrEqual);
875 return VisitFloat64Compare(selector, value, cont); 876 return VisitFloat64Compare(selector, value, cont);
876 case IrOpcode::kProjection: 877 case IrOpcode::kProjection:
877 // Check if this is the overflow output projection of an 878 // Check if this is the overflow output projection of an
878 // <Operation>WithOverflow node. 879 // <Operation>WithOverflow node.
879 if (OpParameter<size_t>(value) == 1u) { 880 if (OpParameter<size_t>(value) == 1u) {
880 // We cannot combine the <Operation>WithOverflow with this branch 881 // We cannot combine the <Operation>WithOverflow with this branch
881 // unless the 0th projection (the use of the actual value of the 882 // unless the 0th projection (the use of the actual value of the
882 // <Operation> is either NULL, which means there's no use of the 883 // <Operation> is either NULL, which means there's no use of the
883 // actual value, or was already defined, which means it is scheduled 884 // actual value, or was already defined, which means it is scheduled
884 // *AFTER* this branch). 885 // *AFTER* this branch).
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 } 978 }
978 979
979 980
980 void InstructionSelector::VisitFloat64Equal(Node* node) { 981 void InstructionSelector::VisitFloat64Equal(Node* node) {
981 FlagsContinuation cont(kUnorderedEqual, node); 982 FlagsContinuation cont(kUnorderedEqual, node);
982 VisitFloat64Compare(this, node, &cont); 983 VisitFloat64Compare(this, node, &cont);
983 } 984 }
984 985
985 986
986 void InstructionSelector::VisitFloat64LessThan(Node* node) { 987 void InstructionSelector::VisitFloat64LessThan(Node* node) {
987 FlagsContinuation cont(kUnorderedLessThan, node); 988 FlagsContinuation cont(kUnsignedGreaterThan, node);
988 VisitFloat64Compare(this, node, &cont); 989 VisitFloat64Compare(this, node, &cont);
989 } 990 }
990 991
991 992
992 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { 993 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) {
993 FlagsContinuation cont(kUnorderedLessThanOrEqual, node); 994 FlagsContinuation cont(kUnsignedGreaterThanOrEqual, node);
994 VisitFloat64Compare(this, node, &cont); 995 VisitFloat64Compare(this, node, &cont);
995 } 996 }
996 997
997 998
998 // static 999 // static
999 MachineOperatorBuilder::Flags 1000 MachineOperatorBuilder::Flags
1000 InstructionSelector::SupportedMachineOperatorFlags() { 1001 InstructionSelector::SupportedMachineOperatorFlags() {
1001 if (CpuFeatures::IsSupported(SSE4_1)) { 1002 if (CpuFeatures::IsSupported(SSE4_1)) {
1002 return MachineOperatorBuilder::kFloat64Floor | 1003 return MachineOperatorBuilder::kFloat64Floor |
1003 MachineOperatorBuilder::kFloat64Ceil | 1004 MachineOperatorBuilder::kFloat64Ceil |
1004 MachineOperatorBuilder::kFloat64RoundTruncate | 1005 MachineOperatorBuilder::kFloat64RoundTruncate |
1005 MachineOperatorBuilder::kWord32ShiftIsSafe; 1006 MachineOperatorBuilder::kWord32ShiftIsSafe;
1006 } 1007 }
1007 return MachineOperatorBuilder::Flag::kNoFlags; 1008 return MachineOperatorBuilder::Flag::kNoFlags;
1008 } 1009 }
1010
1009 } // namespace compiler 1011 } // namespace compiler
1010 } // namespace internal 1012 } // namespace internal
1011 } // namespace v8 1013 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ia32/code-generator-ia32.cc ('k') | src/compiler/instruction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698