| 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 <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_PPC | 9 #if V8_TARGET_ARCH_PPC |
| 10 | 10 |
| (...skipping 3782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3793 } | 3793 } |
| 3794 | 3794 |
| 3795 case LFSU: | 3795 case LFSU: |
| 3796 case LFS: { | 3796 case LFS: { |
| 3797 int frt = instr->RTValue(); | 3797 int frt = instr->RTValue(); |
| 3798 int ra = instr->RAValue(); | 3798 int ra = instr->RAValue(); |
| 3799 int32_t offset = SIGN_EXT_IMM16(instr->Bits(15, 0)); | 3799 int32_t offset = SIGN_EXT_IMM16(instr->Bits(15, 0)); |
| 3800 intptr_t ra_val = ra == 0 ? 0 : get_register(ra); | 3800 intptr_t ra_val = ra == 0 ? 0 : get_register(ra); |
| 3801 int32_t val = ReadW(ra_val + offset, instr); | 3801 int32_t val = ReadW(ra_val + offset, instr); |
| 3802 float* fptr = reinterpret_cast<float*>(&val); | 3802 float* fptr = reinterpret_cast<float*>(&val); |
| 3803 set_d_register_from_double(frt, static_cast<double>(*fptr)); | 3803 // Conversion using double changes sNan to qNan on ia32/x64 |
| 3804 #if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64 |
| 3805 if (val == 0x7fa00000) { |
| 3806 set_d_register(frt, 0x7ff4000000000000); |
| 3807 } else { |
| 3808 #endif |
| 3809 set_d_register_from_double(frt, static_cast<double>(*fptr)); |
| 3810 #if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64 |
| 3811 } |
| 3812 #endif |
| 3804 if (opcode == LFSU) { | 3813 if (opcode == LFSU) { |
| 3805 DCHECK(ra != 0); | 3814 DCHECK(ra != 0); |
| 3806 set_register(ra, ra_val + offset); | 3815 set_register(ra, ra_val + offset); |
| 3807 } | 3816 } |
| 3808 break; | 3817 break; |
| 3809 } | 3818 } |
| 3810 | 3819 |
| 3811 case LFDU: | 3820 case LFDU: |
| 3812 case LFD: { | 3821 case LFD: { |
| 3813 int frt = instr->RTValue(); | 3822 int frt = instr->RTValue(); |
| 3814 int ra = instr->RAValue(); | 3823 int ra = instr->RAValue(); |
| 3815 int32_t offset = SIGN_EXT_IMM16(instr->Bits(15, 0)); | 3824 int32_t offset = SIGN_EXT_IMM16(instr->Bits(15, 0)); |
| 3816 intptr_t ra_val = ra == 0 ? 0 : get_register(ra); | 3825 intptr_t ra_val = ra == 0 ? 0 : get_register(ra); |
| 3817 int64_t* dptr = reinterpret_cast<int64_t*>(ReadDW(ra_val + offset)); | 3826 int64_t* dptr = reinterpret_cast<int64_t*>(ReadDW(ra_val + offset)); |
| 3818 set_d_register(frt, *dptr); | 3827 set_d_register(frt, *dptr); |
| 3819 if (opcode == LFDU) { | 3828 if (opcode == LFDU) { |
| 3820 DCHECK(ra != 0); | 3829 DCHECK(ra != 0); |
| 3821 set_register(ra, ra_val + offset); | 3830 set_register(ra, ra_val + offset); |
| 3822 } | 3831 } |
| 3823 break; | 3832 break; |
| 3824 } | 3833 } |
| 3825 | 3834 |
| 3826 case STFSU: { | 3835 case STFSU: { |
| 3827 case STFS: | 3836 case STFS: |
| 3828 int frs = instr->RSValue(); | 3837 int frs = instr->RSValue(); |
| 3829 int ra = instr->RAValue(); | 3838 int ra = instr->RAValue(); |
| 3830 int32_t offset = SIGN_EXT_IMM16(instr->Bits(15, 0)); | 3839 int32_t offset = SIGN_EXT_IMM16(instr->Bits(15, 0)); |
| 3831 intptr_t ra_val = ra == 0 ? 0 : get_register(ra); | 3840 intptr_t ra_val = ra == 0 ? 0 : get_register(ra); |
| 3832 float frs_val = static_cast<float>(get_double_from_d_register(frs)); | 3841 float frs_val = static_cast<float>(get_double_from_d_register(frs)); |
| 3833 int32_t* p = reinterpret_cast<int32_t*>(&frs_val); | 3842 int32_t* p; |
| 3843 // Conversion using double changes sNan to qNan on ia32/x64 |
| 3844 #if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64 |
| 3845 int64_t frs_isnan = get_d_register(frs); |
| 3846 int32_t frs_nan_single = 0x7fa00000; |
| 3847 if (frs_isnan == 0x7ff4000000000000) { |
| 3848 p = &frs_nan_single; |
| 3849 } else { |
| 3850 #endif |
| 3851 p = reinterpret_cast<int32_t*>(&frs_val); |
| 3852 #if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64 |
| 3853 } |
| 3854 #endif |
| 3834 WriteW(ra_val + offset, *p, instr); | 3855 WriteW(ra_val + offset, *p, instr); |
| 3835 if (opcode == STFSU) { | 3856 if (opcode == STFSU) { |
| 3836 DCHECK(ra != 0); | 3857 DCHECK(ra != 0); |
| 3837 set_register(ra, ra_val + offset); | 3858 set_register(ra, ra_val + offset); |
| 3838 } | 3859 } |
| 3839 break; | 3860 break; |
| 3840 } | 3861 } |
| 3841 | 3862 |
| 3842 case STFDU: | 3863 case STFDU: |
| 3843 case STFD: { | 3864 case STFD: { |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4184 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp); | 4205 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp); |
| 4185 uintptr_t address = *stack_slot; | 4206 uintptr_t address = *stack_slot; |
| 4186 set_register(sp, current_sp + sizeof(uintptr_t)); | 4207 set_register(sp, current_sp + sizeof(uintptr_t)); |
| 4187 return address; | 4208 return address; |
| 4188 } | 4209 } |
| 4189 } // namespace internal | 4210 } // namespace internal |
| 4190 } // namespace v8 | 4211 } // namespace v8 |
| 4191 | 4212 |
| 4192 #endif // USE_SIMULATOR | 4213 #endif // USE_SIMULATOR |
| 4193 #endif // V8_TARGET_ARCH_PPC | 4214 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |