OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 <limits.h> | 5 #include <limits.h> |
6 #include <stdarg.h> | 6 #include <stdarg.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #if V8_TARGET_ARCH_MIPS | 10 #if V8_TARGET_ARCH_MIPS |
(...skipping 3815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3826 0x10101LU >> | 3826 0x10101LU >> |
3827 16); | 3827 16); |
3828 | 3828 |
3829 output = output | (static_cast<uint32_t>(o_byte << 24)); | 3829 output = output | (static_cast<uint32_t>(o_byte << 24)); |
3830 input = input >> 8; | 3830 input = input >> 8; |
3831 } | 3831 } |
3832 | 3832 |
3833 alu_out = static_cast<int32_t>(output); | 3833 alu_out = static_cast<int32_t>(output); |
3834 break; | 3834 break; |
3835 } | 3835 } |
3836 case SEB: | 3836 case SEB: { |
3837 case SEH: | 3837 uint8_t input = static_cast<uint8_t>(rt()); |
3838 case WSBH: | 3838 uint32_t output = input; |
3839 alu_out = 0x12345678; | 3839 uint32_t mask = 0x00000080; |
3840 UNREACHABLE(); | 3840 |
| 3841 // Extending sign |
| 3842 if (mask & input) { |
| 3843 output |= 0xFFFFFF00; |
| 3844 } |
| 3845 |
| 3846 alu_out = static_cast<int32_t>(output); |
3841 break; | 3847 break; |
| 3848 } |
| 3849 case SEH: { |
| 3850 uint16_t input = static_cast<uint16_t>(rt()); |
| 3851 uint32_t output = input; |
| 3852 uint32_t mask = 0x00008000; |
| 3853 |
| 3854 // Extending sign |
| 3855 if (mask & input) { |
| 3856 output |= 0xFFFF0000; |
| 3857 } |
| 3858 |
| 3859 alu_out = static_cast<int32_t>(output); |
| 3860 break; |
| 3861 } |
| 3862 case WSBH: { |
| 3863 uint32_t input = static_cast<uint32_t>(rt()); |
| 3864 uint32_t output = 0; |
| 3865 |
| 3866 uint32_t mask = 0xFF000000; |
| 3867 for (int i = 0; i < 4; i++) { |
| 3868 uint32_t tmp = mask & input; |
| 3869 if (i % 2 == 0) { |
| 3870 tmp = tmp >> 8; |
| 3871 } else { |
| 3872 tmp = tmp << 8; |
| 3873 } |
| 3874 output = output | tmp; |
| 3875 mask = mask >> 8; |
| 3876 } |
| 3877 |
| 3878 alu_out = static_cast<int32_t>(output); |
| 3879 break; |
| 3880 } |
3842 default: { | 3881 default: { |
3843 const uint8_t bp = get_instr()->Bp2Value(); | 3882 const uint8_t bp = get_instr()->Bp2Value(); |
3844 sa >>= kBp2Bits; | 3883 sa >>= kBp2Bits; |
3845 switch (sa) { | 3884 switch (sa) { |
3846 case ALIGN: { | 3885 case ALIGN: { |
3847 if (bp == 0) { | 3886 if (bp == 0) { |
3848 alu_out = static_cast<int32_t>(rt()); | 3887 alu_out = static_cast<int32_t>(rt()); |
3849 } else { | 3888 } else { |
3850 uint32_t rt_hi = rt() << (8 * bp); | 3889 uint32_t rt_hi = rt() << (8 * bp); |
3851 uint32_t rs_lo = rs() >> (8 * (4 - bp)); | 3890 uint32_t rs_lo = rs() >> (8 * (4 - bp)); |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4599 | 4638 |
4600 | 4639 |
4601 #undef UNSUPPORTED | 4640 #undef UNSUPPORTED |
4602 | 4641 |
4603 } // namespace internal | 4642 } // namespace internal |
4604 } // namespace v8 | 4643 } // namespace v8 |
4605 | 4644 |
4606 #endif // USE_SIMULATOR | 4645 #endif // USE_SIMULATOR |
4607 | 4646 |
4608 #endif // V8_TARGET_ARCH_MIPS | 4647 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |