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

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

Issue 1779713009: Implement optional turbofan UnalignedLoad and UnalignedStore operators (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 } 879 }
880 } 880 }
881 } 881 }
882 } 882 }
883 883
884 884
885 bool InstructionSelector::IsTailCallAddressImmediate() { return false; } 885 bool InstructionSelector::IsTailCallAddressImmediate() { return false; }
886 886
887 int InstructionSelector::GetTempsCountForTailCallFromJSFunction() { return 3; } 887 int InstructionSelector::GetTempsCountForTailCallFromJSFunction() { return 3; }
888 888
889 void InstructionSelector::VisitUnalignedLoad(Node* node) {
890 UnalignedLoadRepresentation load_rep =
891 UnalignedLoadRepresentationOf(node->op());
892 MipsOperandGenerator g(this);
893 Node* base = node->InputAt(0);
894 Node* index = node->InputAt(1);
895
896 ArchOpcode opcode = kArchNop;
897 switch (load_rep.representation()) {
898 case MachineRepresentation::kBit: // Fall through.
899 case MachineRepresentation::kWord8:
900 opcode = load_rep.IsUnsigned() ? kMipsLbu : kMipsLb;
901 break;
902 case MachineRepresentation::kWord16:
903 opcode = load_rep.IsUnsigned() ? kMipsUlhu : kMipsUlh;
904 break;
905 case MachineRepresentation::kTagged: // Fall through.
906 case MachineRepresentation::kWord32:
907 opcode = kMipsUlw;
908 break;
909 case MachineRepresentation::kFloat32:
910 case MachineRepresentation::kFloat64:
911 UNREACHABLE();
912 break;
913 case MachineRepresentation::kWord64: // Fall through.
914 case MachineRepresentation::kSimd128: // Fall through.
915 case MachineRepresentation::kNone:
916 UNREACHABLE();
917 return;
918 }
919
920 if (g.CanBeImmediate(index, opcode)) {
921 Emit(opcode | AddressingModeField::encode(kMode_MRI),
922 g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(index));
923 } else {
924 InstructionOperand addr_reg = g.TempRegister();
925 Emit(kMipsAdd | AddressingModeField::encode(kMode_None), addr_reg,
926 g.UseRegister(index), g.UseRegister(base));
927 // Emit desired load opcode, using temp addr_reg.
928 Emit(opcode | AddressingModeField::encode(kMode_MRI),
929 g.DefineAsRegister(node), addr_reg, g.TempImmediate(0));
930 }
931 }
932
933 void InstructionSelector::VisitUnalignedStore(Node* node) {
934 MipsOperandGenerator g(this);
935 Node* base = node->InputAt(0);
936 Node* index = node->InputAt(1);
937 Node* value = node->InputAt(2);
938
939 UnalignedStoreRepresentation rep = UnalignedStoreRepresentationOf(node->op());
940
941 // TODO(mips): I guess this could be done in a better way.
942 ArchOpcode opcode = kArchNop;
943 switch (rep) {
944 case MachineRepresentation::kFloat32:
945 case MachineRepresentation::kFloat64:
946 UNREACHABLE();
947 return;
948 case MachineRepresentation::kBit: // Fall through.
949 case MachineRepresentation::kWord8:
950 opcode = kMipsSb;
951 break;
952 case MachineRepresentation::kWord16:
953 opcode = kMipsUsh;
954 break;
955 case MachineRepresentation::kTagged: // Fall through.
956 case MachineRepresentation::kWord32:
957 opcode = kMipsUsw;
958 break;
959 case MachineRepresentation::kWord64: // Fall through.
960 case MachineRepresentation::kSimd128: // Fall through.
961 case MachineRepresentation::kNone:
962 UNREACHABLE();
963 return;
964 }
965
966 if (g.CanBeImmediate(index, opcode)) {
967 Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(),
968 g.UseRegister(base), g.UseImmediate(index), g.UseRegister(value));
969 } else {
970 InstructionOperand addr_reg = g.TempRegister();
971 Emit(kMipsAdd | AddressingModeField::encode(kMode_None), addr_reg,
972 g.UseRegister(index), g.UseRegister(base));
973 // Emit desired store opcode, using temp addr_reg.
974 Emit(opcode | AddressingModeField::encode(kMode_MRI), g.NoOutput(),
975 addr_reg, g.TempImmediate(0), g.UseRegister(value));
976 }
977 }
978
889 void InstructionSelector::VisitCheckedLoad(Node* node) { 979 void InstructionSelector::VisitCheckedLoad(Node* node) {
890 CheckedLoadRepresentation load_rep = CheckedLoadRepresentationOf(node->op()); 980 CheckedLoadRepresentation load_rep = CheckedLoadRepresentationOf(node->op());
891 MipsOperandGenerator g(this); 981 MipsOperandGenerator g(this);
892 Node* const buffer = node->InputAt(0); 982 Node* const buffer = node->InputAt(0);
893 Node* const offset = node->InputAt(1); 983 Node* const offset = node->InputAt(1);
894 Node* const length = node->InputAt(2); 984 Node* const length = node->InputAt(2);
895 ArchOpcode opcode = kArchNop; 985 ArchOpcode opcode = kArchNop;
896 switch (load_rep.representation()) { 986 switch (load_rep.representation()) {
897 case MachineRepresentation::kWord8: 987 case MachineRepresentation::kWord8:
898 opcode = load_rep.IsSigned() ? kCheckedLoadInt8 : kCheckedLoadUint8; 988 opcode = load_rep.IsSigned() ? kCheckedLoadInt8 : kCheckedLoadUint8;
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 MachineOperatorBuilder::kFloat32Max | 1480 MachineOperatorBuilder::kFloat32Max |
1391 MachineOperatorBuilder::kFloat32RoundDown | 1481 MachineOperatorBuilder::kFloat32RoundDown |
1392 MachineOperatorBuilder::kFloat32RoundUp | 1482 MachineOperatorBuilder::kFloat32RoundUp |
1393 MachineOperatorBuilder::kFloat32RoundTruncate | 1483 MachineOperatorBuilder::kFloat32RoundTruncate |
1394 MachineOperatorBuilder::kFloat32RoundTiesEven; 1484 MachineOperatorBuilder::kFloat32RoundTiesEven;
1395 } 1485 }
1396 1486
1397 } // namespace compiler 1487 } // namespace compiler
1398 } // namespace internal 1488 } // namespace internal
1399 } // namespace v8 1489 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698