summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2022-10-29 19:53:20 -0400
committer AJR <ajrhacker@users.noreply.github.com>2022-10-29 19:53:20 -0400
commit16b6207d1ae4ed8122b182bcfc430dae26898625 (patch)
tree9e7d68a191d848fb516fac3e741dd029d8228111
parentcb2175d2596174a9994d1c4090bc5428801214b8 (diff)
cpu/i960, cpu/sh: Use rotl_32 and rotr_32 for executing rotate instructions
-rw-r--r--src/devices/cpu/i960/i960.cpp2
-rw-r--r--src/devices/cpu/sh/sh.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/devices/cpu/i960/i960.cpp b/src/devices/cpu/i960/i960.cpp
index 318a9326e30..7d87f4955b0 100644
--- a/src/devices/cpu/i960/i960.cpp
+++ b/src/devices/cpu/i960/i960.cpp
@@ -1152,7 +1152,7 @@ void i960_cpu_device::execute_op(uint32_t opcode)
m_icount--;
t1 = get_1_ri(opcode) & 0x1f;
t2 = get_2_ri(opcode);
- set_ri(opcode, (t2<<t1)|(t2>>(32-t1)));
+ set_ri(opcode, rotl_32(t2, t1));
break;
case 0xe: // shli
diff --git a/src/devices/cpu/sh/sh.cpp b/src/devices/cpu/sh/sh.cpp
index f7560ba28f2..591e7e24a61 100644
--- a/src/devices/cpu/sh/sh.cpp
+++ b/src/devices/cpu/sh/sh.cpp
@@ -1347,14 +1347,14 @@ void sh_common_execution::ROTCR(uint32_t n)
void sh_common_execution::ROTL(uint32_t n)
{
m_sh2_state->sr = (m_sh2_state->sr & ~SH_T) | ((m_sh2_state->r[n] >> 31) & SH_T);
- m_sh2_state->r[n] = (m_sh2_state->r[n] << 1) | (m_sh2_state->r[n] >> 31);
+ m_sh2_state->r[n] = rotl_32(m_sh2_state->r[n], 1);
}
/* ROTR Rn */
void sh_common_execution::ROTR(uint32_t n)
{
m_sh2_state->sr = (m_sh2_state->sr & ~SH_T) | (m_sh2_state->r[n] & SH_T);
- m_sh2_state->r[n] = (m_sh2_state->r[n] >> 1) | (m_sh2_state->r[n] << 31);
+ m_sh2_state->r[n] = rotr_32(m_sh2_state->r[n], 1);
}
/* RTS */