r300: remove the remaining of backend constant folding

This was needed to clean up after the comparison opcode lowering which
has now beed moved earlier to NIR. We just need to clean up the special
case of add a,0 manually as this happens way too late for any other
standard algebraic pass.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27089>
This commit is contained in:
Pavel Ondračka 2024-01-16 10:34:43 +01:00 committed by Marge Bot
parent 553e841d7c
commit 18a0ff121e

View file

@ -242,27 +242,6 @@ static int is_src_uniform_constant(struct rc_src_register src,
return 1;
}
static void constant_folding_add(struct rc_instruction * inst)
{
rc_swizzle swz = 0;
unsigned int negate = 0;
if (is_src_uniform_constant(inst->U.I.SrcReg[0], &swz, &negate)) {
if (swz == RC_SWIZZLE_ZERO) {
inst->U.I.Opcode = RC_OPCODE_MOV;
inst->U.I.SrcReg[0] = inst->U.I.SrcReg[1];
return;
}
}
if (is_src_uniform_constant(inst->U.I.SrcReg[1], &swz, &negate)) {
if (swz == RC_SWIZZLE_ZERO) {
inst->U.I.Opcode = RC_OPCODE_MOV;
return;
}
}
}
/**
* Replace 0.0, 1.0 and 0.5 immediate constants by their
* respective swizzles. Simplify instructions like ADD dst, src, 0;
@ -344,10 +323,6 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction *
inst->U.I.SrcReg[src] = newsrc;
}
if (c->type == RC_FRAGMENT_PROGRAM &&
inst->U.I.Opcode == RC_OPCODE_ADD)
constant_folding_add(inst);
/* In case this instruction has been converted, make sure all of the
* registers that are no longer used are empty. */
opcode = rc_get_opcode_info(inst->U.I.Opcode);