constant_propagation_pass: Shift with non-zero value does not require c flag as input
This commit is contained in:
parent
5a864f41c6
commit
9bdff6a9aa
1 changed files with 5 additions and 0 deletions
|
@ -300,6 +300,7 @@ bool FoldShifts(IR::Inst& inst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto shift_amount = inst.GetArg(1);
|
const auto shift_amount = inst.GetArg(1);
|
||||||
|
|
||||||
if (shift_amount.IsZero()) {
|
if (shift_amount.IsZero()) {
|
||||||
if (carry_inst) {
|
if (carry_inst) {
|
||||||
carry_inst->ReplaceUsesWith(inst.GetArg(2));
|
carry_inst->ReplaceUsesWith(inst.GetArg(2));
|
||||||
|
@ -308,6 +309,10 @@ bool FoldShifts(IR::Inst& inst) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inst.NumArgs() == 3 && shift_amount.IsImmediate() && !shift_amount.IsZero()) {
|
||||||
|
inst.SetArg(2, IR::Value(false));
|
||||||
|
}
|
||||||
|
|
||||||
if (!inst.AreAllArgsImmediates() || carry_inst) {
|
if (!inst.AreAllArgsImmediates() || carry_inst) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue