From 1fc7a57b211e2027ec4f064fc95127f55818bb2e Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 22 Nov 2024 23:50:40 +1000 Subject: [PATCH] CPU/NewRec/ARM32: Shifts need to be explicitly masked --- src/core/cpu_newrec_compiler_aarch32.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/cpu_newrec_compiler_aarch32.cpp b/src/core/cpu_newrec_compiler_aarch32.cpp index fb8f7c08f..ce6f1f40a 100644 --- a/src/core/cpu_newrec_compiler_aarch32.cpp +++ b/src/core/cpu_newrec_compiler_aarch32.cpp @@ -997,13 +997,14 @@ void CPU::NewRec::AArch32Compiler::Compile_variable_shift(CompileFlags cf, if (cf.const_s) { if (const u32 shift = GetConstantRegU32(cf.MipsS()); shift != 0) - (armAsm->*op)(rd, rt, shift); + (armAsm->*op)(rd, rt, shift & 0x1Fu); else if (rd.GetCode() != rt.GetCode()) armAsm->mov(rd, rt); } else { - (armAsm->*op)(rd, rt, CFGetRegS(cf)); + armAsm->and_(RSCRATCH, CFGetRegS(cf), 0x1Fu); + (armAsm->*op)(rd, rt, RSCRATCH); } }