mirror of
https://github.com/azahar-emu/dynarmic
synced 2025-11-07 15:40:00 +01:00
constant_propagation_pass: Fold ZeroExtend{Type}ToLong opcodes if possible
These are equivalent to the ZeroExtendXToWord variants, so we can trivially do this as well.
This commit is contained in:
parent
2274214ff0
commit
c42f6ea184
@ -122,6 +122,15 @@ void FoldZeroExtendXToWord(IR::Inst& inst) {
|
|||||||
const u64 value = inst.GetArg(0).GetImmediateAsU64();
|
const u64 value = inst.GetArg(0).GetImmediateAsU64();
|
||||||
inst.ReplaceUsesWith(IR::Value{static_cast<u32>(value)});
|
inst.ReplaceUsesWith(IR::Value{static_cast<u32>(value)});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FoldZeroExtendXToLong(IR::Inst& inst) {
|
||||||
|
if (!inst.AreAllArgsImmediates()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const u64 value = inst.GetArg(0).GetImmediateAsU64();
|
||||||
|
inst.ReplaceUsesWith(IR::Value{value});
|
||||||
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
void ConstantPropagation(IR::Block& block) {
|
void ConstantPropagation(IR::Block& block) {
|
||||||
@ -167,6 +176,11 @@ void ConstantPropagation(IR::Block& block) {
|
|||||||
case IR::Opcode::ZeroExtendHalfToWord:
|
case IR::Opcode::ZeroExtendHalfToWord:
|
||||||
FoldZeroExtendXToWord(inst);
|
FoldZeroExtendXToWord(inst);
|
||||||
break;
|
break;
|
||||||
|
case IR::Opcode::ZeroExtendByteToLong:
|
||||||
|
case IR::Opcode::ZeroExtendHalfToLong:
|
||||||
|
case IR::Opcode::ZeroExtendWordToLong:
|
||||||
|
FoldZeroExtendXToLong(inst);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user