Skip to content

Commit

Permalink
A bit more clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
dingusdev committed May 10, 2024
1 parent a95b06f commit ce9a1a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cpu/ppc/ppcmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
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;\
Expand Down
5 changes: 2 additions & 3 deletions cpu/ppc/ppcopcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ce9a1a6

Please sign in to comment.