OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdarg.h> | 5 #include <stdarg.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #if V8_TARGET_ARCH_ARM | 9 #if V8_TARGET_ARCH_ARM |
10 | 10 |
(...skipping 3725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3736 UNIMPLEMENTED(); // Not used by V8. | 3736 UNIMPLEMENTED(); // Not used by V8. |
3737 } | 3737 } |
3738 } else { | 3738 } else { |
3739 UNIMPLEMENTED(); // Not used by V8. | 3739 UNIMPLEMENTED(); // Not used by V8. |
3740 } | 3740 } |
3741 } | 3741 } |
3742 | 3742 |
3743 | 3743 |
3744 void Simulator::DecodeSpecialCondition(Instruction* instr) { | 3744 void Simulator::DecodeSpecialCondition(Instruction* instr) { |
3745 switch (instr->SpecialValue()) { | 3745 switch (instr->SpecialValue()) { |
| 3746 case 4: |
| 3747 if (instr->Bits(21, 20) == 2 && instr->Bits(11, 8) == 1 && |
| 3748 instr->Bit(4) == 1) { |
| 3749 // vmov Qd, Qm |
| 3750 int Vd = instr->VFPDRegValue(kSimd128Precision); |
| 3751 int Vm = instr->VFPMRegValue(kSimd128Precision); |
| 3752 uint32_t data[4]; |
| 3753 get_q_register(Vm, data); |
| 3754 set_q_register(Vd, data); |
| 3755 } else { |
| 3756 UNIMPLEMENTED(); |
| 3757 } |
| 3758 break; |
3746 case 5: | 3759 case 5: |
3747 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && | 3760 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && |
3748 (instr->Bit(4) == 1)) { | 3761 (instr->Bit(4) == 1)) { |
3749 // vmovl signed | 3762 // vmovl signed |
3750 if ((instr->VdValue() & 1) != 0) UNIMPLEMENTED(); | 3763 if ((instr->VdValue() & 1) != 0) UNIMPLEMENTED(); |
3751 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); | 3764 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); |
3752 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); | 3765 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); |
3753 int imm3 = instr->Bits(21, 19); | 3766 int imm3 = instr->Bits(21, 19); |
3754 if ((imm3 != 1) && (imm3 != 2) && (imm3 != 4)) UNIMPLEMENTED(); | 3767 if ((imm3 != 1) && (imm3 != 2) && (imm3 != 4)) UNIMPLEMENTED(); |
3755 int esize = 8 * imm3; | 3768 int esize = 8 * imm3; |
3756 int elements = 64 / esize; | 3769 int elements = 64 / esize; |
3757 int8_t from[8]; | 3770 int8_t from[8]; |
3758 get_d_register(Vm, reinterpret_cast<uint64_t*>(from)); | 3771 get_d_register(Vm, reinterpret_cast<uint64_t*>(from)); |
3759 int16_t to[8]; | 3772 int16_t to[8]; |
3760 int e = 0; | 3773 int e = 0; |
3761 while (e < elements) { | 3774 while (e < elements) { |
3762 to[e] = from[e]; | 3775 to[e] = from[e]; |
3763 e++; | 3776 e++; |
3764 } | 3777 } |
3765 set_q_register(Vd, reinterpret_cast<uint64_t*>(to)); | 3778 set_q_register(Vd, reinterpret_cast<uint64_t*>(to)); |
3766 } else { | 3779 } else { |
3767 UNIMPLEMENTED(); | 3780 UNIMPLEMENTED(); |
3768 } | 3781 } |
3769 break; | 3782 break; |
| 3783 case 6: |
| 3784 if (instr->Bits(21, 20) == 0 && instr->Bits(11, 8) == 1 && |
| 3785 instr->Bit(4) == 1) { |
| 3786 if (instr->Bit(6) == 0) { |
| 3787 // veor Dd, Dn, Dm |
| 3788 int Vd = instr->VFPDRegValue(kDoublePrecision); |
| 3789 int Vn = instr->VFPNRegValue(kDoublePrecision); |
| 3790 int Vm = instr->VFPMRegValue(kDoublePrecision); |
| 3791 uint64_t n_data, m_data; |
| 3792 get_d_register(Vn, &n_data); |
| 3793 get_d_register(Vm, &m_data); |
| 3794 n_data ^= m_data; |
| 3795 set_d_register(Vd, &n_data); |
| 3796 |
| 3797 } else { |
| 3798 // veor Qd, Qn, Qm |
| 3799 int Vd = instr->VFPDRegValue(kSimd128Precision); |
| 3800 int Vn = instr->VFPNRegValue(kSimd128Precision); |
| 3801 int Vm = instr->VFPMRegValue(kSimd128Precision); |
| 3802 uint32_t n_data[4], m_data[4]; |
| 3803 get_q_register(Vn, n_data); |
| 3804 get_q_register(Vm, m_data); |
| 3805 for (int i = 0; i < 4; i++) n_data[i] ^= m_data[i]; |
| 3806 set_q_register(Vd, n_data); |
| 3807 } |
| 3808 } else { |
| 3809 UNIMPLEMENTED(); |
| 3810 } |
| 3811 break; |
3770 case 7: | 3812 case 7: |
3771 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && | 3813 if ((instr->Bits(18, 16) == 0) && (instr->Bits(11, 6) == 0x28) && |
3772 (instr->Bit(4) == 1)) { | 3814 (instr->Bit(4) == 1)) { |
3773 // vmovl unsigned | 3815 // vmovl unsigned |
3774 if ((instr->VdValue() & 1) != 0) UNIMPLEMENTED(); | 3816 if ((instr->VdValue() & 1) != 0) UNIMPLEMENTED(); |
3775 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); | 3817 int Vd = (instr->Bit(22) << 3) | (instr->VdValue() >> 1); |
3776 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); | 3818 int Vm = (instr->Bit(5) << 4) | instr->VmValue(); |
3777 int imm3 = instr->Bits(21, 19); | 3819 int imm3 = instr->Bits(21, 19); |
3778 if ((imm3 != 1) && (imm3 != 2) && (imm3 != 4)) UNIMPLEMENTED(); | 3820 if ((imm3 != 1) && (imm3 != 2) && (imm3 != 4)) UNIMPLEMENTED(); |
3779 int esize = 8 * imm3; | 3821 int esize = 8 * imm3; |
3780 int elements = 64 / esize; | 3822 int elements = 64 / esize; |
3781 uint8_t from[8]; | 3823 uint8_t from[8]; |
3782 get_d_register(Vm, reinterpret_cast<uint64_t*>(from)); | 3824 get_d_register(Vm, reinterpret_cast<uint64_t*>(from)); |
3783 uint16_t to[8]; | 3825 uint16_t to[8]; |
3784 int e = 0; | 3826 int e = 0; |
3785 while (e < elements) { | 3827 while (e < elements) { |
3786 to[e] = from[e]; | 3828 to[e] = from[e]; |
3787 e++; | 3829 e++; |
3788 } | 3830 } |
3789 set_q_register(Vd, reinterpret_cast<uint64_t*>(to)); | 3831 set_q_register(Vd, reinterpret_cast<uint64_t*>(to)); |
3790 } else if ((instr->Bits(21, 16) == 0x32) && (instr->Bits(11, 7) == 0) && | 3832 } else if ((instr->Bits(21, 16) == 0x32) && (instr->Bits(11, 7) == 0) && |
3791 (instr->Bit(4) == 0)) { | 3833 (instr->Bit(4) == 0)) { |
3792 int vd = instr->VFPDRegValue(kDoublePrecision); | |
3793 int vm = instr->VFPMRegValue(kDoublePrecision); | |
3794 if (instr->Bit(6) == 0) { | 3834 if (instr->Bit(6) == 0) { |
3795 // vswp Dd, Dm. | 3835 // vswp Dd, Dm. |
3796 uint64_t dval, mval; | 3836 uint64_t dval, mval; |
| 3837 int vd = instr->VFPDRegValue(kDoublePrecision); |
| 3838 int vm = instr->VFPMRegValue(kDoublePrecision); |
3797 get_d_register(vd, &dval); | 3839 get_d_register(vd, &dval); |
3798 get_d_register(vm, &mval); | 3840 get_d_register(vm, &mval); |
3799 set_d_register(vm, &dval); | 3841 set_d_register(vm, &dval); |
3800 set_d_register(vd, &mval); | 3842 set_d_register(vd, &mval); |
3801 } else { | 3843 } else { |
3802 // Q register vswp unimplemented. | 3844 // vswp Qd, Qm. |
3803 UNIMPLEMENTED(); | 3845 uint32_t dval[4], mval[4]; |
| 3846 int vd = instr->VFPDRegValue(kSimd128Precision); |
| 3847 int vm = instr->VFPMRegValue(kSimd128Precision); |
| 3848 get_q_register(vd, dval); |
| 3849 get_q_register(vm, mval); |
| 3850 set_q_register(vm, dval); |
| 3851 set_q_register(vd, mval); |
3804 } | 3852 } |
3805 } else { | 3853 } else { |
3806 UNIMPLEMENTED(); | 3854 UNIMPLEMENTED(); |
3807 } | 3855 } |
3808 break; | 3856 break; |
3809 case 8: | 3857 case 8: |
3810 if (instr->Bits(21, 20) == 0) { | 3858 if (instr->Bits(21, 20) == 0) { |
3811 // vst1 | 3859 // vst1 |
3812 int Vd = (instr->Bit(22) << 4) | instr->VdValue(); | 3860 int Vd = (instr->Bit(22) << 4) | instr->VdValue(); |
3813 int Rn = instr->VnValue(); | 3861 int Rn = instr->VnValue(); |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4315 set_register(sp, current_sp + sizeof(uintptr_t)); | 4363 set_register(sp, current_sp + sizeof(uintptr_t)); |
4316 return address; | 4364 return address; |
4317 } | 4365 } |
4318 | 4366 |
4319 } // namespace internal | 4367 } // namespace internal |
4320 } // namespace v8 | 4368 } // namespace v8 |
4321 | 4369 |
4322 #endif // USE_SIMULATOR | 4370 #endif // USE_SIMULATOR |
4323 | 4371 |
4324 #endif // V8_TARGET_ARCH_ARM | 4372 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |