Skip to content

Commit

Permalink
CPU/NewRec/ARM32: Shifts need to be explicitly masked
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Nov 23, 2024
1 parent 5c03e1d commit d2d06ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/cpu_newrec_compiler_aarch32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit d2d06ad

Please sign in to comment.