mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-24 17:00:48 +02:00
ConstProp: Mul x,#powof2 -> Lshl x,clz(#powof2)
This commit is contained in:
1 parent
d481bd4ffc
commit
46fb0503f0
1 file changed
+7
@@ -374,6 +374,13 @@ bool ConstProp::Run(IREmitter *IREmit) {
|
||||
IREmit->ReplaceWithConstant(CodeNode, NewConstant);
|
||||
Changed = true;
|
||||
continue;
|
||||
} else if (IREmit->IsValueConstant(Op->Header.Args[1], &Constant2) && __builtin_popcountl(Constant2) == 1) {
|
||||
if (IROp->Size == 4 || IROp->Size == 8) {
|
||||
uint64_t amt = __builtin_ctzl(Constant2);
|
||||
IREmit->SetWriteCursor(CodeNode);
|
||||
auto shift = IREmit->_Lshl(CurrentIR.GetNode(Op->Header.Args[0]), IREmit->_Constant(amt));
|
||||
IREmit->ReplaceAllUsesWith(CodeNode, shift);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user