@@ -343,10 +343,8 @@ inline void InterpretedCPU::doBranch(uint32_t target, bool fromLink) {
343
343
* Format: OP rt, rs, immediate *
344
344
*********************************************************/
345
345
void InterpretedCPU::psxADDI (uint32_t code) {
346
- if (!_Rt_) return ;
347
-
348
- auto rs = _rRs_;
349
- auto imm = _Imm_;
346
+ const auto rs = _rRs_;
347
+ const auto imm = _Imm_;
350
348
uint32_t res = rs + imm;
351
349
352
350
if (_Rt_ == 29 ) {
@@ -369,9 +367,12 @@ void InterpretedCPU::psxADDI(uint32_t code) {
369
367
}
370
368
}
371
369
372
- maybeCancelDelayedLoad (_Rt_);
373
- _rRt_ = res;
374
- } // Rt = Rs + Im (Exception on Integer Overflow)
370
+ if (_Rt_ != 0 ) {
371
+ maybeCancelDelayedLoad (_Rt_);
372
+ _rRt_ = res;
373
+ }
374
+ }
375
+
375
376
void InterpretedCPU::psxADDIU (uint32_t code) {
376
377
if (!_Rt_) return ;
377
378
maybeCancelDelayedLoad (_Rt_);
@@ -437,10 +438,8 @@ void InterpretedCPU::psxSLTIU(uint32_t code) {
437
438
* Format: OP rd, rs, rt *
438
439
*********************************************************/
439
440
void InterpretedCPU::psxADD (uint32_t code) {
440
- if (!_Rd_) return ;
441
-
442
- auto rs = _rRs_;
443
- auto rt = _rRt_;
441
+ const auto rs = _rRs_;
442
+ const auto rt = _rRt_;
444
443
uint32_t res = rs + rt;
445
444
if (_Rd_ == 29 ) {
446
445
if ((_Rs_ == 29 ) || (_Rt_ == 29 )) {
@@ -462,13 +461,16 @@ void InterpretedCPU::psxADD(uint32_t code) {
462
461
}
463
462
}
464
463
465
- maybeCancelDelayedLoad (_Rd_);
466
- _rRd_ = res;
467
- } // Rd = Rs + Rt (Exception on Integer Overflow)
464
+ if (_Rd_ != 0 ) {
465
+ maybeCancelDelayedLoad (_Rd_);
466
+ _rRd_ = res;
467
+ }
468
+ }
469
+
468
470
void InterpretedCPU::psxADDU (uint32_t code) {
469
471
if (!_Rd_) return ;
470
472
maybeCancelDelayedLoad (_Rd_);
471
- uint32_t res = _u32 ( _rRs_) + _u32 ( _rRt_) ;
473
+ uint32_t res = _rRs_ + _rRt_;
472
474
if (_Rd_ == 29 ) {
473
475
if ((_Rs_ == 29 ) || (_Rt_ == 29 )) {
474
476
PCSX::g_emulator->m_callStacks ->offsetSP (_rRd_, res - _rRd_);
@@ -479,10 +481,8 @@ void InterpretedCPU::psxADDU(uint32_t code) {
479
481
_rRd_ = res;
480
482
} // Rd = Rs + Rt
481
483
void InterpretedCPU::psxSUB (uint32_t code) {
482
- if (!_Rd_) return ;
483
-
484
- auto rs = _rRs_;
485
- auto rt = _rRt_;
484
+ const auto rs = _rRs_;
485
+ const auto rt = _rRt_;
486
486
uint32_t res = rs - rt;
487
487
if (_Rd_ == 29 ) {
488
488
if (_Rs_ == 29 ) {
@@ -503,13 +503,16 @@ void InterpretedCPU::psxSUB(uint32_t code) {
503
503
return ;
504
504
}
505
505
}
506
- maybeCancelDelayedLoad (_Rd_);
507
- _rRd_ = res;
506
+
507
+ if (_Rd_ != 0 ) {
508
+ maybeCancelDelayedLoad (_Rd_);
509
+ _rRd_ = res;
510
+ }
508
511
} // Rd = Rs - Rt (Exception on Integer Overflow)
509
512
void InterpretedCPU::psxSUBU (uint32_t code) {
510
513
if (!_Rd_) return ;
511
514
maybeCancelDelayedLoad (_Rd_);
512
- uint32_t res = _u32 ( _rRs_) - _u32 ( _rRt_) ;
515
+ uint32_t res = _rRs_ - _rRt_;
513
516
if (_Rd_ == 29 ) {
514
517
if (_Rs_ == 29 ) {
515
518
PCSX::g_emulator->m_callStacks ->offsetSP (_rRd_, res - _rRd_);
0 commit comments