Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: src/mips64/simulator-mips64.cc

Issue 1045203003: MIPS64: [turbofan] Add backend support for float32 operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips64/simulator-mips64.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 } 2265 }
2266 break; 2266 break;
2267 default: 2267 default:
2268 UNREACHABLE(); 2268 UNREACHABLE();
2269 } 2269 }
2270 } 2270 }
2271 2271
2272 2272
2273 void Simulator::DecodeTypeRegisterSRsType(Instruction* instr, 2273 void Simulator::DecodeTypeRegisterSRsType(Instruction* instr,
2274 const int32_t& fs_reg, 2274 const int32_t& fs_reg,
2275 const int32_t& ft_reg,
2275 const int64_t& fd_reg) { 2276 const int64_t& fd_reg) {
2276 float f; 2277 float fs, ft;
2278 fs = get_fpu_register_float(fs_reg);
2279 ft = get_fpu_register_float(ft_reg);
2280 uint32_t cc, fcsr_cc;
2281 cc = instr->FCccValue();
2282 fcsr_cc = get_fcsr_condition_bit(cc);
2277 switch (instr->FunctionFieldRaw()) { 2283 switch (instr->FunctionFieldRaw()) {
2284 case ADD_D:
2285 set_fpu_register_float(fd_reg, fs + ft);
2286 break;
2287 case SUB_D:
2288 set_fpu_register_float(fd_reg, fs - ft);
2289 break;
2290 case MUL_D:
2291 set_fpu_register_float(fd_reg, fs * ft);
2292 break;
2293 case DIV_D:
2294 set_fpu_register_float(fd_reg, fs / ft);
2295 break;
2296 case ABS_D:
2297 set_fpu_register_float(fd_reg, fabs(fs));
2298 break;
2299 case MOV_D:
2300 set_fpu_register_float(fd_reg, fs);
2301 break;
2302 case NEG_D:
2303 set_fpu_register_float(fd_reg, -fs);
2304 break;
2305 case SQRT_D:
2306 set_fpu_register_float(fd_reg, fast_sqrt(fs));
2307 break;
2308 case C_UN_D:
2309 set_fcsr_bit(fcsr_cc, std::isnan(fs) || std::isnan(ft));
2310 break;
2311 case C_EQ_D:
2312 set_fcsr_bit(fcsr_cc, (fs == ft));
2313 break;
2314 case C_UEQ_D:
2315 set_fcsr_bit(fcsr_cc, (fs == ft) || (std::isnan(fs) || std::isnan(ft)));
2316 break;
2317 case C_OLT_D:
2318 set_fcsr_bit(fcsr_cc, (fs < ft));
2319 break;
2320 case C_ULT_D:
2321 set_fcsr_bit(fcsr_cc, (fs < ft) || (std::isnan(fs) || std::isnan(ft)));
2322 break;
2323 case C_OLE_D:
2324 set_fcsr_bit(fcsr_cc, (fs <= ft));
2325 break;
2326 case C_ULE_D:
2327 set_fcsr_bit(fcsr_cc, (fs <= ft) || (std::isnan(fs) || std::isnan(ft)));
2328 break;
2278 case CVT_D_S: 2329 case CVT_D_S:
2279 f = get_fpu_register_float(fs_reg); 2330 set_fpu_register_double(fd_reg, static_cast<double>(fs));
2280 set_fpu_register_double(fd_reg, static_cast<double>(f));
2281 break; 2331 break;
2282 default: 2332 default:
2283 // CVT_W_S CVT_L_S TRUNC_W_S ROUND_W_S ROUND_L_S FLOOR_W_S FLOOR_L_S 2333 // CVT_W_S CVT_L_S TRUNC_W_S ROUND_W_S ROUND_L_S FLOOR_W_S FLOOR_L_S
2284 // CEIL_W_S CEIL_L_S CVT_PS_S are unimplemented. 2334 // CEIL_W_S CEIL_L_S CVT_PS_S are unimplemented.
2285 UNREACHABLE(); 2335 UNREACHABLE();
2286 } 2336 }
2287 } 2337 }
2288 2338
2289 2339
2290 void Simulator::DecodeTypeRegisterDRsType(Instruction* instr, 2340 void Simulator::DecodeTypeRegisterDRsType(Instruction* instr,
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 set_fpu_register_hi_word(fs_reg, 0); 2624 set_fpu_register_hi_word(fs_reg, 0);
2575 set_fpu_register_word(fs_reg, registers_[rt_reg]); 2625 set_fpu_register_word(fs_reg, registers_[rt_reg]);
2576 break; 2626 break;
2577 case DMTC1: 2627 case DMTC1:
2578 set_fpu_register(fs_reg, registers_[rt_reg]); 2628 set_fpu_register(fs_reg, registers_[rt_reg]);
2579 break; 2629 break;
2580 case MTHC1: 2630 case MTHC1:
2581 set_fpu_register_hi_word(fs_reg, registers_[rt_reg]); 2631 set_fpu_register_hi_word(fs_reg, registers_[rt_reg]);
2582 break; 2632 break;
2583 case S: 2633 case S:
2584 DecodeTypeRegisterSRsType(instr, fs_reg, fd_reg); 2634 DecodeTypeRegisterSRsType(instr, fs_reg, ft_reg, fd_reg);
2585 break; 2635 break;
2586 case D: 2636 case D:
2587 DecodeTypeRegisterDRsType(instr, fs_reg, ft_reg, fd_reg); 2637 DecodeTypeRegisterDRsType(instr, fs_reg, ft_reg, fd_reg);
2588 break; 2638 break;
2589 case W: 2639 case W:
2590 DecodeTypeRegisterWRsType(instr, fs_reg, fd_reg, alu_out); 2640 DecodeTypeRegisterWRsType(instr, fs_reg, fd_reg, alu_out);
2591 break; 2641 break;
2592 case L: 2642 case L:
2593 DecodeTypeRegisterLRsType(instr, fs_reg, fd_reg, ft_reg); 2643 DecodeTypeRegisterLRsType(instr, fs_reg, fd_reg, ft_reg);
2594 break; 2644 break;
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
3541 } 3591 }
3542 3592
3543 3593
3544 #undef UNSUPPORTED 3594 #undef UNSUPPORTED
3545 3595
3546 } } // namespace v8::internal 3596 } } // namespace v8::internal
3547 3597
3548 #endif // USE_SIMULATOR 3598 #endif // USE_SIMULATOR
3549 3599
3550 #endif // V8_TARGET_ARCH_MIPS64 3600 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/simulator-mips64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698