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

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

Issue 1520503002: MIPS: [turbofan] Optimize Float32 to Int32 rep. changes with Float32 round ops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo. Created 5 years 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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 return; 829 return;
830 case IrOpcode::kFloat64RoundTiesEven: 830 case IrOpcode::kFloat64RoundTiesEven:
831 Emit(kMips64RoundWD, g.DefineAsRegister(node), 831 Emit(kMips64RoundWD, g.DefineAsRegister(node),
832 g.UseRegister(value->InputAt(0))); 832 g.UseRegister(value->InputAt(0)));
833 return; 833 return;
834 case IrOpcode::kFloat64RoundTruncate: 834 case IrOpcode::kFloat64RoundTruncate:
835 Emit(kMips64TruncWD, g.DefineAsRegister(node), 835 Emit(kMips64TruncWD, g.DefineAsRegister(node),
836 g.UseRegister(value->InputAt(0))); 836 g.UseRegister(value->InputAt(0)));
837 return; 837 return;
838 default: 838 default:
839 VisitRR(this, kMips64TruncWD, node); 839 break;
840 }
841 if (value->opcode() == IrOpcode::kChangeFloat32ToFloat64) {
842 Node* next = value->InputAt(0);
843 if (CanCover(value, next)) {
844 // Match ChangeFloat64ToInt32(ChangeFloat32ToFloat64(Float64Round##OP))
845 switch (next->opcode()) {
846 case IrOpcode::kFloat32RoundDown:
847 Emit(kMips64FloorWS, g.DefineAsRegister(node),
848 g.UseRegister(next->InputAt(0)));
849 return;
850 case IrOpcode::kFloat32RoundUp:
851 Emit(kMips64CeilWS, g.DefineAsRegister(node),
852 g.UseRegister(next->InputAt(0)));
853 return;
854 case IrOpcode::kFloat32RoundTiesEven:
855 Emit(kMips64RoundWS, g.DefineAsRegister(node),
856 g.UseRegister(next->InputAt(0)));
857 return;
858 case IrOpcode::kFloat32RoundTruncate:
859 Emit(kMips64TruncWS, g.DefineAsRegister(node),
860 g.UseRegister(next->InputAt(0)));
861 return;
862 default:
863 Emit(kMips64TruncWS, g.DefineAsRegister(node),
864 g.UseRegister(value->InputAt(0)));
865 return;
866 }
867 } else {
868 // Match float32 -> float64 -> int32 representation change path.
869 Emit(kMips64TruncWS, g.DefineAsRegister(node),
870 g.UseRegister(value->InputAt(0)));
840 return; 871 return;
872 }
841 } 873 }
842 } 874 }
843 VisitRR(this, kMips64TruncWD, node); 875 VisitRR(this, kMips64TruncWD, node);
844 } 876 }
845 877
846 878
847 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { 879 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) {
848 VisitRR(this, kMips64TruncUwD, node); 880 VisitRR(this, kMips64TruncUwD, node);
849 } 881 }
850 882
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 default: 979 default:
948 break; 980 break;
949 } 981 }
950 } 982 }
951 Emit(kMips64Ext, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), 983 Emit(kMips64Ext, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)),
952 g.TempImmediate(0), g.TempImmediate(32)); 984 g.TempImmediate(0), g.TempImmediate(32));
953 } 985 }
954 986
955 987
956 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { 988 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
989 Mips64OperandGenerator g(this);
990 Node* value = node->InputAt(0);
991 // Match TruncateFloat64ToFloat32(ChangeInt32ToFloat64) to corresponding
992 // instruction.
993 if (CanCover(node, value) &&
994 value->opcode() == IrOpcode::kChangeInt32ToFloat64) {
995 Emit(kMips64CvtSW, g.DefineAsRegister(node),
996 g.UseRegister(value->InputAt(0)));
997 return;
998 }
957 VisitRR(this, kMips64CvtSD, node); 999 VisitRR(this, kMips64CvtSD, node);
958 } 1000 }
959 1001
960 1002
961 void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) { 1003 void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) {
962 switch (TruncationModeOf(node->op())) { 1004 switch (TruncationModeOf(node->op())) {
963 case TruncationMode::kJavaScript: 1005 case TruncationMode::kJavaScript:
964 return VisitRR(this, kArchTruncateDoubleToI, node); 1006 return VisitRR(this, kArchTruncateDoubleToI, node);
965 case TruncationMode::kRoundToZero: 1007 case TruncationMode::kRoundToZero:
966 return VisitRR(this, kMips64TruncWD, node); 1008 return VisitRR(this, kMips64TruncWD, node);
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 MachineOperatorBuilder::kFloat32RoundUp | 1828 MachineOperatorBuilder::kFloat32RoundUp |
1787 MachineOperatorBuilder::kFloat64RoundTruncate | 1829 MachineOperatorBuilder::kFloat64RoundTruncate |
1788 MachineOperatorBuilder::kFloat32RoundTruncate | 1830 MachineOperatorBuilder::kFloat32RoundTruncate |
1789 MachineOperatorBuilder::kFloat64RoundTiesEven | 1831 MachineOperatorBuilder::kFloat64RoundTiesEven |
1790 MachineOperatorBuilder::kFloat32RoundTiesEven; 1832 MachineOperatorBuilder::kFloat32RoundTiesEven;
1791 } 1833 }
1792 1834
1793 } // namespace compiler 1835 } // namespace compiler
1794 } // namespace internal 1836 } // namespace internal
1795 } // namespace v8 1837 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips64/instruction-codes-mips64.h ('k') | test/unittests/compiler/mips/instruction-selector-mips-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698