| 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 #include "src/v8.h" | 10 #include "src/v8.h" |
| (...skipping 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2322 default: // Mips64r6 CMP.S instructions unimplemented. | 2322 default: // Mips64r6 CMP.S instructions unimplemented. |
| 2323 UNREACHABLE(); | 2323 UNREACHABLE(); |
| 2324 } | 2324 } |
| 2325 } | 2325 } |
| 2326 | 2326 |
| 2327 | 2327 |
| 2328 void Simulator::DecodeTypeRegisterSRsType(Instruction* instr, | 2328 void Simulator::DecodeTypeRegisterSRsType(Instruction* instr, |
| 2329 const int32_t& ft_reg, | 2329 const int32_t& ft_reg, |
| 2330 const int32_t& fs_reg, | 2330 const int32_t& fs_reg, |
| 2331 const int32_t& fd_reg) { | 2331 const int32_t& fd_reg) { |
| 2332 float f; | 2332 float fs, ft; |
| 2333 double ft = get_fpu_register_double(ft_reg); | 2333 fs = get_fpu_register_float(fs_reg); |
| 2334 int64_t ft_int = static_cast<int64_t>(ft); | 2334 ft = get_fpu_register_float(ft_reg); |
| 2335 int64_t ft_int = static_cast<int64_t>(get_fpu_register_double(ft_reg)); |
| 2336 uint32_t cc, fcsr_cc; |
| 2337 cc = instr->FCccValue(); |
| 2338 fcsr_cc = get_fcsr_condition_bit(cc); |
| 2335 switch (instr->FunctionFieldRaw()) { | 2339 switch (instr->FunctionFieldRaw()) { |
| 2340 case ADD_D: |
| 2341 set_fpu_register_float(fd_reg, fs + ft); |
| 2342 break; |
| 2343 case SUB_D: |
| 2344 set_fpu_register_float(fd_reg, fs - ft); |
| 2345 break; |
| 2346 case MUL_D: |
| 2347 set_fpu_register_float(fd_reg, fs * ft); |
| 2348 break; |
| 2349 case DIV_D: |
| 2350 set_fpu_register_float(fd_reg, fs / ft); |
| 2351 break; |
| 2352 case ABS_D: |
| 2353 set_fpu_register_float(fd_reg, fabs(fs)); |
| 2354 break; |
| 2355 case MOV_D: |
| 2356 set_fpu_register_float(fd_reg, fs); |
| 2357 break; |
| 2358 case NEG_D: |
| 2359 set_fpu_register_float(fd_reg, -fs); |
| 2360 break; |
| 2361 case SQRT_D: |
| 2362 set_fpu_register_float(fd_reg, fast_sqrt(fs)); |
| 2363 break; |
| 2364 case C_UN_D: |
| 2365 set_fcsr_bit(fcsr_cc, std::isnan(fs) || std::isnan(ft)); |
| 2366 break; |
| 2367 case C_EQ_D: |
| 2368 set_fcsr_bit(fcsr_cc, (fs == ft)); |
| 2369 break; |
| 2370 case C_UEQ_D: |
| 2371 set_fcsr_bit(fcsr_cc, (fs == ft) || (std::isnan(fs) || std::isnan(ft))); |
| 2372 break; |
| 2373 case C_OLT_D: |
| 2374 set_fcsr_bit(fcsr_cc, (fs < ft)); |
| 2375 break; |
| 2376 case C_ULT_D: |
| 2377 set_fcsr_bit(fcsr_cc, (fs < ft) || (std::isnan(fs) || std::isnan(ft))); |
| 2378 break; |
| 2379 case C_OLE_D: |
| 2380 set_fcsr_bit(fcsr_cc, (fs <= ft)); |
| 2381 break; |
| 2382 case C_ULE_D: |
| 2383 set_fcsr_bit(fcsr_cc, (fs <= ft) || (std::isnan(fs) || std::isnan(ft))); |
| 2384 break; |
| 2336 case CVT_D_S: | 2385 case CVT_D_S: |
| 2337 f = get_fpu_register_float(fs_reg); | 2386 set_fpu_register_double(fd_reg, static_cast<double>(fs)); |
| 2338 set_fpu_register_double(fd_reg, static_cast<double>(f)); | |
| 2339 break; | 2387 break; |
| 2340 case SELEQZ_C: | 2388 case SELEQZ_C: |
| 2341 DCHECK(IsMipsArchVariant(kMips32r6)); | 2389 DCHECK(IsMipsArchVariant(kMips32r6)); |
| 2342 set_fpu_register_double( | 2390 set_fpu_register_double( |
| 2343 fd_reg, (ft_int & 0x1) == 0 ? get_fpu_register_double(fs_reg) : 0.0); | 2391 fd_reg, (ft_int & 0x1) == 0 ? get_fpu_register_double(fs_reg) : 0.0); |
| 2344 break; | 2392 break; |
| 2345 case SELNEZ_C: | 2393 case SELNEZ_C: |
| 2346 DCHECK(IsMipsArchVariant(kMips32r6)); | 2394 DCHECK(IsMipsArchVariant(kMips32r6)); |
| 2347 set_fpu_register_double( | 2395 set_fpu_register_double( |
| 2348 fd_reg, (ft_int & 0x1) != 0 ? get_fpu_register_double(fs_reg) : 0.0); | 2396 fd_reg, (ft_int & 0x1) != 0 ? get_fpu_register_double(fs_reg) : 0.0); |
| (...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3362 } | 3410 } |
| 3363 | 3411 |
| 3364 | 3412 |
| 3365 #undef UNSUPPORTED | 3413 #undef UNSUPPORTED |
| 3366 | 3414 |
| 3367 } } // namespace v8::internal | 3415 } } // namespace v8::internal |
| 3368 | 3416 |
| 3369 #endif // USE_SIMULATOR | 3417 #endif // USE_SIMULATOR |
| 3370 | 3418 |
| 3371 #endif // V8_TARGET_ARCH_MIPS | 3419 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |