From 4bf65ce221982039855ea154b460c5b01104b896 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Wed, 22 Feb 2023 12:39:41 -0800 Subject: [PATCH] glsl/opt_algebraic: Drop the flrp/ffma simplifiers. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NIR seems to do a better job. Freedreno: total instructions in shared programs: 11013096 -> 11012781 (<.01%) instructions in affected programs: 258358 -> 258043 (-0.12%) helped: 470 HURT: 269 r300: total instructions in shared programs: 1338237 -> 1338236 (<.01%) instructions in affected programs: 161 -> 160 (-0.62%) helped: 1 HURT: 0 total presub in shared programs: 45127 -> 44881 (-0.55%) presub in affected programs: 1719 -> 1473 (-14.31%) helped: 246 HURT: 0 Acked-by: Timothy Arceri Reviewed-by: Marek Olšák Part-of: --- src/compiler/glsl/opt_algebraic.cpp | 46 ----------------------------- 1 file changed, 46 deletions(-) diff --git a/src/compiler/glsl/opt_algebraic.cpp b/src/compiler/glsl/opt_algebraic.cpp index 7b7e05995c8..6ca988331fa 100644 --- a/src/compiler/glsl/opt_algebraic.cpp +++ b/src/compiler/glsl/opt_algebraic.cpp @@ -494,52 +494,6 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) break; - case ir_triop_fma: - /* Operands are op0 * op1 + op2. */ - if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) { - return ir->operands[2]; - } else if (is_vec_zero(op_const[2])) { - return mul(ir->operands[0], ir->operands[1]); - } else if (is_vec_one(op_const[0])) { - return add(ir->operands[1], ir->operands[2]); - } else if (is_vec_one(op_const[1])) { - return add(ir->operands[0], ir->operands[2]); - } - break; - - case ir_triop_lrp: - /* Operands are (x, y, a). */ - if (is_vec_zero(op_const[2])) { - return ir->operands[0]; - } else if (is_vec_one(op_const[2])) { - return ir->operands[1]; - } else if (ir->operands[0]->equals(ir->operands[1])) { - return ir->operands[0]; - } else if (is_vec_zero(op_const[0])) { - return mul(ir->operands[1], ir->operands[2]); - } else if (is_vec_zero(op_const[1])) { - unsigned op2_components = ir->operands[2]->type->vector_elements; - ir_constant *one; - - switch (ir->type->base_type) { - case GLSL_TYPE_FLOAT16: - one = new(mem_ctx) ir_constant(float16_t::one(), op2_components); - break; - case GLSL_TYPE_FLOAT: - one = new(mem_ctx) ir_constant(1.0f, op2_components); - break; - case GLSL_TYPE_DOUBLE: - one = new(mem_ctx) ir_constant(1.0, op2_components); - break; - default: - one = NULL; - unreachable("unexpected type"); - } - - return mul(ir->operands[0], add(one, neg(ir->operands[2]))); - } - break; - /* Remove interpolateAt* instructions for demoted inputs. They are * assigned a constant expression to facilitate this. */