CPU/NewRec/ARM32: Shifts need to be explicitly masked

This commit is contained in:
Stenzek 2024-11-22 23:50:40 +10:00
parent a73b3ebbc6
commit 1fc7a57b21
No known key found for this signature in database
1 changed files with 3 additions and 2 deletions

View File

@ -997,13 +997,14 @@ void CPU::NewRec::AArch32Compiler::Compile_variable_shift(CompileFlags cf,
if (cf.const_s) if (cf.const_s)
{ {
if (const u32 shift = GetConstantRegU32(cf.MipsS()); shift != 0) 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()) else if (rd.GetCode() != rt.GetCode())
armAsm->mov(rd, rt); armAsm->mov(rd, rt);
} }
else else
{ {
(armAsm->*op)(rd, rt, CFGetRegS(cf)); armAsm->and_(RSCRATCH, CFGetRegS(cf), 0x1Fu);
(armAsm->*op)(rd, rt, RSCRATCH);
} }
} }