From 18a0ff121ef652a3c589c5323b320b6f202c4b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Ondra=C4=8Dka?= Date: Tue, 16 Jan 2024 10:34:43 +0100 Subject: [PATCH] r300: remove the remaining of backend constant folding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Filip Gawin Part-of: --- .../drivers/r300/compiler/radeon_optimize.c | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/src/gallium/drivers/r300/compiler/radeon_optimize.c b/src/gallium/drivers/r300/compiler/radeon_optimize.c index fc475f1351c..f003538776f 100644 --- a/src/gallium/drivers/r300/compiler/radeon_optimize.c +++ b/src/gallium/drivers/r300/compiler/radeon_optimize.c @@ -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);