parent
fff03f64a3
commit
15617c1816
|
@ -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()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue