Merge remote-tracking branch 'origin/master' into dev

This commit is contained in:
Flyinghead 2024-12-08 10:47:31 +01:00
commit e4599e36ed
1 changed files with 26 additions and 22 deletions

View File

@ -285,14 +285,17 @@ private:
{ {
// Replace shld/shad with shl/shr/sar // Replace shld/shad with shl/shr/sar
u32 r2 = op.rs2.imm_value(); u32 r2 = op.rs2.imm_value();
if (r2 != 0) // r2 == 0 is nop, handled in SimplifyExpressionPass()
{
if ((r2 & 0x1F) == 0) if ((r2 & 0x1F) == 0)
{ {
if (op.op == shop_shld) if (op.op == shop_shld) {
// rd = 0 // rd = 0
ReplaceByMov32(op, 0); ReplaceByMov32(op, 0);
}
else else
{ {
// rd = r1 >> 31; // rd = r1 >> 31
op.op = shop_sar; op.op = shop_sar;
op.rs2._imm = 31; op.rs2._imm = 31;
stats.constant_ops_replaced++; stats.constant_ops_replaced++;
@ -315,6 +318,7 @@ private:
} }
} }
} }
}
void DeadCodeRemovalPass() void DeadCodeRemovalPass()
{ {