nv50/ir: optimize shift of 0 bits

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10164>
This commit is contained in:
Ilia Mirkin
2021-03-09 23:59:31 -05:00
committed by Marge Bot
parent dbdc2b160c
commit e762061127
@@ -1461,6 +1461,12 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
{
if (s != 1 || i->src(0).mod != Modifier(0))
break;
if (imm0.reg.data.u32 == 0) {
i->op = OP_MOV;
i->setSrc(1, NULL);
break;
}
// try to concatenate shifts
Instruction *si = i->getSrc(0)->getInsn();
if (!si)