diff --git a/src/dynarmic/ir/opt/constant_propagation_pass.cpp b/src/dynarmic/ir/opt/constant_propagation_pass.cpp index f30d9836..f63f6464 100644 --- a/src/dynarmic/ir/opt/constant_propagation_pass.cpp +++ b/src/dynarmic/ir/opt/constant_propagation_pass.cpp @@ -300,6 +300,7 @@ bool FoldShifts(IR::Inst& inst) { } const auto shift_amount = inst.GetArg(1); + if (shift_amount.IsZero()) { if (carry_inst) { carry_inst->ReplaceUsesWith(inst.GetArg(2)); @@ -308,6 +309,10 @@ bool FoldShifts(IR::Inst& inst) { return false; } + if (inst.NumArgs() == 3 && shift_amount.IsImmediate() && !shift_amount.IsZero()) { + inst.SetArg(2, IR::Value(false)); + } + if (!inst.AreAllArgsImmediates() || carry_inst) { return false; }