OLD | NEW |
---|---|
1 | 1 |
2 // Copyright 2012 the V8 project authors. All rights reserved. | 2 // Copyright 2012 the V8 project authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
7 | 7 |
8 #if V8_TARGET_ARCH_MIPS | 8 #if V8_TARGET_ARCH_MIPS |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
797 mul(rd_lo, rs, at); | 797 mul(rd_lo, rs, at); |
798 } else { | 798 } else { |
799 DCHECK(!rd_hi.is(at) && !rd_lo.is(at)); | 799 DCHECK(!rd_hi.is(at) && !rd_lo.is(at)); |
800 mul(rd_lo, rs, at); | 800 mul(rd_lo, rs, at); |
801 muh(rd_hi, rs, at); | 801 muh(rd_hi, rs, at); |
802 } | 802 } |
803 } | 803 } |
804 } | 804 } |
805 } | 805 } |
806 | 806 |
807 void MacroAssembler::Mulu(Register rd_hi, Register rd_lo, Register rs, | |
808 const Operand& rt) { | |
809 if (rt.is_reg()) { | |
810 if (!IsMipsArchVariant(kMips32r6)) { | |
811 multu(rs, rt.rm()); | |
812 mflo(rd_lo); | |
813 mfhi(rd_hi); | |
814 } else { | |
815 if (rd_lo.is(rs)) { | |
816 DCHECK(!rd_hi.is(rs)); | |
817 DCHECK(!rd_hi.is(rt.rm()) && !rd_lo.is(rt.rm())); | |
818 muhu(rd_hi, rs, rt.rm()); | |
819 mulu(rd_lo, rs, rt.rm()); | |
820 } else { | |
821 DCHECK(!rd_hi.is(rt.rm()) && !rd_lo.is(rt.rm())); | |
822 mulu(rd_lo, rs, rt.rm()); | |
823 muhu(rd_hi, rs, rt.rm()); | |
824 } | |
825 } | |
826 } else { | |
827 // li handles the relocation. | |
828 DCHECK(!rs.is(at)); | |
829 li(at, rt); | |
830 if (!IsMipsArchVariant(kMips32r6)) { | |
831 multu(rs, at); | |
832 mflo(rd_lo); | |
833 mfhi(rd_hi); | |
834 } else { | |
835 if (rd_lo.is(rs)) { | |
836 DCHECK(!rd_hi.is(rs)); | |
837 DCHECK(!rd_hi.is(at) && !rd_lo.is(at)); | |
838 muhu(rd_hi, rs, at); | |
839 mulu(rd_lo, rs, at); | |
840 } else { | |
841 DCHECK(!rd_hi.is(at) && !rd_lo.is(at)); | |
842 mulu(rd_lo, rs, at); | |
843 muhu(rd_hi, rs, at); | |
844 } | |
845 } | |
846 } | |
847 } | |
balazs.kilvady
2016/04/01 12:16:21
The 2 blocks are almost identical. What do you thi
Marija Antic
2016/04/05 07:50:04
Done.
| |
807 | 848 |
808 void MacroAssembler::Mulh(Register rd, Register rs, const Operand& rt) { | 849 void MacroAssembler::Mulh(Register rd, Register rs, const Operand& rt) { |
809 if (rt.is_reg()) { | 850 if (rt.is_reg()) { |
810 if (!IsMipsArchVariant(kMips32r6)) { | 851 if (!IsMipsArchVariant(kMips32r6)) { |
811 mult(rs, rt.rm()); | 852 mult(rs, rt.rm()); |
812 mfhi(rd); | 853 mfhi(rd); |
813 } else { | 854 } else { |
814 muh(rd, rs, rt.rm()); | 855 muh(rd, rs, rt.rm()); |
815 } | 856 } |
816 } else { | 857 } else { |
(...skipping 5412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6229 if (mag.shift > 0) sra(result, result, mag.shift); | 6270 if (mag.shift > 0) sra(result, result, mag.shift); |
6230 srl(at, dividend, 31); | 6271 srl(at, dividend, 31); |
6231 Addu(result, result, Operand(at)); | 6272 Addu(result, result, Operand(at)); |
6232 } | 6273 } |
6233 | 6274 |
6234 | 6275 |
6235 } // namespace internal | 6276 } // namespace internal |
6236 } // namespace v8 | 6277 } // namespace v8 |
6237 | 6278 |
6238 #endif // V8_TARGET_ARCH_MIPS | 6279 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |