From e1f31a2da34353e31495275ca4f31deaa43953a1 Mon Sep 17 00:00:00 2001 From: joevt Date: Tue, 9 Apr 2024 02:17:03 -0700 Subject: [PATCH] poweropcodes: Fix rrib. It is redundant to test bit 0 of rS and then use bit 0 of rS in the case when bit 0 of rS is set. In the case when bit 0 of rS is not set, using bit 0 or rS is incorrect since it results in no change of rA. --- cpu/ppc/poweropcodes.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cpu/ppc/poweropcodes.cpp b/cpu/ppc/poweropcodes.cpp index 9a0df83..2ce1a72 100644 --- a/cpu/ppc/poweropcodes.cpp +++ b/cpu/ppc/poweropcodes.cpp @@ -365,11 +365,12 @@ void dppc_interpreter::power_rlmi() { template void dppc_interpreter::power_rrib() { ppc_grab_regssab(ppc_cur_instruction); + unsigned rot_sh = ppc_result_b & 0x1F; if (int32_t(ppc_result_d) < 0) { - ppc_result_a |= ((ppc_result_d & 0x80000000) >> ppc_result_b); + ppc_result_a |= (0x80000000U >> rot_sh); } else { - ppc_result_a &= ~((ppc_result_d & 0x80000000) >> ppc_result_b); + ppc_result_a &= ~(0x80000000U >> rot_sh); } if (rec)