OLD | NEW |
---|---|
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/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 #include "src/compiler/code-generator.h" | 6 #include "src/compiler/code-generator.h" |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
823 } | 823 } |
824 break; | 824 break; |
825 case kMipsSar: | 825 case kMipsSar: |
826 if (instr->InputAt(1)->IsRegister()) { | 826 if (instr->InputAt(1)->IsRegister()) { |
827 __ srav(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); | 827 __ srav(i.OutputRegister(), i.InputRegister(0), i.InputRegister(1)); |
828 } else { | 828 } else { |
829 int32_t imm = i.InputOperand(1).immediate(); | 829 int32_t imm = i.InputOperand(1).immediate(); |
830 __ sra(i.OutputRegister(), i.InputRegister(0), imm); | 830 __ sra(i.OutputRegister(), i.InputRegister(0), imm); |
831 } | 831 } |
832 break; | 832 break; |
833 case kMipsShlPair: { | |
834 if (instr->InputAt(2)->IsRegister()) { | |
835 __ ShlPair(i.OutputRegister(0), i.OutputRegister(1), i.InputRegister(0), | |
836 i.InputRegister(1), i.InputRegister(2)); | |
837 } else { | |
838 uint32_t imm = i.InputOperand(2).immediate(); | |
839 __ ShlPair(i.OutputRegister(0), i.OutputRegister(1), i.InputRegister(0), | |
840 i.InputRegister(1), imm); | |
841 } | |
842 } break; | |
843 case kMipsShrPair: { | |
844 if (instr->InputAt(2)->IsRegister()) { | |
845 __ ShrPair(i.OutputRegister(0), i.OutputRegister(1), i.InputRegister(0), | |
846 i.InputRegister(1), i.InputRegister(2)); | |
847 } else { | |
848 uint32_t imm = i.InputOperand(2).immediate(); | |
849 __ ShrPair(i.OutputRegister(0), i.OutputRegister(1), i.InputRegister(0), | |
850 i.InputRegister(1), imm); | |
851 } | |
852 } break; | |
853 case kMipsSarPair: { | |
854 if (instr->InputAt(2)->IsRegister()) { | |
855 __ SarPair(i.OutputRegister(0), i.OutputRegister(1), i.InputRegister(0), | |
856 i.InputRegister(1), i.InputRegister(2)); | |
857 } else { | |
858 uint32_t imm = i.InputOperand(2).immediate(); | |
859 __ SarPair(i.OutputRegister(0), i.OutputRegister(1), i.InputRegister(0), | |
860 i.InputRegister(1), imm); | |
861 } | |
862 } break; | |
833 case kMipsExt: | 863 case kMipsExt: |
834 __ Ext(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1), | 864 __ Ext(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1), |
835 i.InputInt8(2)); | 865 i.InputInt8(2)); |
836 break; | 866 break; |
837 case kMipsIns: | 867 case kMipsIns: |
838 if (instr->InputAt(1)->IsImmediate() && i.InputInt8(1) == 0) { | 868 if (instr->InputAt(1)->IsImmediate() && i.InputInt8(1) == 0) { |
839 __ Ins(i.OutputRegister(), zero_reg, i.InputInt8(1), i.InputInt8(2)); | 869 __ Ins(i.OutputRegister(), zero_reg, i.InputInt8(1), i.InputInt8(2)); |
840 } else { | 870 } else { |
841 __ Ins(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1), | 871 __ Ins(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1), |
842 i.InputInt8(2)); | 872 i.InputInt8(2)); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
907 __ max_s(i.OutputDoubleRegister(), i.InputDoubleRegister(0), | 937 __ max_s(i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
908 i.InputDoubleRegister(1)); | 938 i.InputDoubleRegister(1)); |
909 break; | 939 break; |
910 case kMipsMinS: | 940 case kMipsMinS: |
911 __ min_s(i.OutputDoubleRegister(), i.InputDoubleRegister(0), | 941 __ min_s(i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
912 i.InputDoubleRegister(1)); | 942 i.InputDoubleRegister(1)); |
913 break; | 943 break; |
914 case kMipsCmpD: | 944 case kMipsCmpD: |
915 // Psuedo-instruction used for FP cmp/branch. No opcode emitted here. | 945 // Psuedo-instruction used for FP cmp/branch. No opcode emitted here. |
916 break; | 946 break; |
947 case kMipsAddPair: { | |
balazs.kilvady
2016/03/30 11:52:52
I would add AddPair and SubPair to MacroAssembler
Marija Antic
2016/03/30 14:21:09
Done.
| |
948 Label no_overflow; | |
949 // Add lower word | |
950 __ Addu(i.OutputRegister(0), i.InputRegister(0), i.InputRegister(2)); | |
951 __ Addu(i.OutputRegister(1), i.InputRegister(1), i.InputRegister(3)); | |
952 // Check for lower word overflow | |
balazs.kilvady
2016/03/30 11:52:52
What about the AddBranchOvf() usage? You said earl
akos.palfi.imgtec
2016/03/30 12:00:33
We discussed offline that the AddBranchOvf wrongly
Marija Antic
2016/03/30 13:16:20
Issue 283 is opened for the problems with AddBranc
| |
953 __ Sltu(kScratchReg, i.OutputRegister(0), i.InputRegister(0)); | |
954 __ Sltu(kScratchReg2, i.OutputRegister(0), i.InputRegister(2)); | |
955 __ Or(kScratchReg, kScratchReg2, kScratchReg); | |
956 __ Branch(&no_overflow, eq, kScratchReg, Operand(zero_reg)); | |
957 // Increment higher word if there was overflow | |
958 __ Addu(i.OutputRegister(1), i.OutputRegister(1), 0x1); | |
959 __ bind(&no_overflow); | |
960 } break; | |
961 case kMipsSubPair: { | |
962 Label no_overflow; | |
963 // Subtract lower word | |
964 __ Subu(i.OutputRegister(0), i.InputRegister(0), i.InputRegister(2)); | |
965 __ Subu(i.OutputRegister(1), i.InputRegister(1), i.InputRegister(3)); | |
966 // Check for lower word underflow | |
967 __ Sltu(kScratchReg, i.InputRegister(0), i.OutputRegister(0)); | |
ahaas
2016/03/30 13:32:47
I think this comparison is not sufficient. I think
Marija Antic
2016/03/30 14:21:09
Done.
| |
968 __ Branch(&no_overflow, eq, kScratchReg, Operand(zero_reg)); | |
969 // Decrement higher word if there was underflow | |
970 __ Subu(i.OutputRegister(1), i.OutputRegister(1), 0x1); | |
971 __ bind(&no_overflow); | |
972 } break; | |
917 case kMipsAddD: | 973 case kMipsAddD: |
918 // TODO(plind): add special case: combine mult & add. | 974 // TODO(plind): add special case: combine mult & add. |
919 __ add_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0), | 975 __ add_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
920 i.InputDoubleRegister(1)); | 976 i.InputDoubleRegister(1)); |
921 break; | 977 break; |
922 case kMipsSubD: | 978 case kMipsSubD: |
923 __ sub_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0), | 979 __ sub_d(i.OutputDoubleRegister(), i.InputDoubleRegister(0), |
924 i.InputDoubleRegister(1)); | 980 i.InputDoubleRegister(1)); |
925 break; | 981 break; |
926 case kMipsMulD: | 982 case kMipsMulD: |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1865 padding_size -= v8::internal::Assembler::kInstrSize; | 1921 padding_size -= v8::internal::Assembler::kInstrSize; |
1866 } | 1922 } |
1867 } | 1923 } |
1868 } | 1924 } |
1869 | 1925 |
1870 #undef __ | 1926 #undef __ |
1871 | 1927 |
1872 } // namespace compiler | 1928 } // namespace compiler |
1873 } // namespace internal | 1929 } // namespace internal |
1874 } // namespace v8 | 1930 } // namespace v8 |
OLD | NEW |