From ce9a1a6d9ed35eee8fb08bc40a1205dfeaae1bda Mon Sep 17 00:00:00 2001 From: dingusdev <52434309+dingusdev@users.noreply.github.com> Date: Thu, 9 May 2024 19:09:06 -0700 Subject: [PATCH] A bit more clean-up --- cpu/ppc/ppcmacros.h | 6 ++++++ cpu/ppc/ppcopcodes.cpp | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cpu/ppc/ppcmacros.h b/cpu/ppc/ppcmacros.h index 5676101be..7be3be11a 100644 --- a/cpu/ppc/ppcmacros.h +++ b/cpu/ppc/ppcmacros.h @@ -48,6 +48,12 @@ along with this program. If not, see . uint32_t ppc_result_d = ppc_state.gpr[reg_s]; \ uint32_t ppc_result_a = ppc_state.gpr[reg_a]; +#define ppc_grab_crfd_regsauimm(opcode) \ + int crf_d = (opcode >> 21) & 0x1C; \ + int reg_a = (opcode >> 16) & 31; \ + uint32_t uimm = uint16_t(opcode); \ + uint32_t ppc_result_a = ppc_state.gpr[reg_a]; + #define ppc_grab_da(opcode)\ int reg_d = (opcode >> 21) & 31;\ int reg_a = (opcode >> 16) & 31;\ diff --git a/cpu/ppc/ppcopcodes.cpp b/cpu/ppc/ppcopcodes.cpp index 1d5ea9c47..6dd6243e6 100644 --- a/cpu/ppc/ppcopcodes.cpp +++ b/cpu/ppc/ppcopcodes.cpp @@ -1261,8 +1261,7 @@ void dppc_interpreter::ppc_cmpli() { return; } #endif - int crf_d = (ppc_cur_instruction >> 21) & 0x1C; - ppc_grab_regssauimm(ppc_cur_instruction); + ppc_grab_crfd_regsauimm(ppc_cur_instruction); uint32_t xercon = (ppc_state.spr[SPR::XER] & XER::SO) >> 3; uint32_t cmp_c = (ppc_result_a == uimm) ? 0x20000000UL : \ (ppc_result_a > uimm) ? 0x40000000UL : 0x80000000UL; @@ -1467,7 +1466,7 @@ void dppc_interpreter::ppc_dcbtst() { } void dppc_interpreter::ppc_dcbz() { - ppc_grab_regsdab(ppc_cur_instruction); + ppc_grab_regsab(ppc_cur_instruction); ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0); ppc_effective_address &= 0xFFFFFFE0UL; // align EA on a 32-byte boundary