From 6229d34b91506fadb3337c5d845d7d95ff4179a2 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Wed, 22 Feb 2023 12:44:40 -0800 Subject: [PATCH] glsl/opt_algebraic: Drop some fmul simplifications. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Looks like mostly noise, trending slightly positively. freedreno: total instructions in shared programs: 11012781 -> 11012472 (<.01%) instructions in affected programs: 114072 -> 113763 (-0.27%) helped: 123 HURT: 153 r300: total instructions in shared programs: 1338236 -> 1337897 (-0.03%) instructions in affected programs: 3460 -> 3121 (-9.80%) helped: 61 HURT: 11 Acked-by: Timothy Arceri Reviewed-by: Marek Olšák Part-of: --- src/compiler/glsl/opt_algebraic.cpp | 36 ----------------------------- 1 file changed, 36 deletions(-) diff --git a/src/compiler/glsl/opt_algebraic.cpp b/src/compiler/glsl/opt_algebraic.cpp index 6ca988331fa..a2da88e5430 100644 --- a/src/compiler/glsl/opt_algebraic.cpp +++ b/src/compiler/glsl/opt_algebraic.cpp @@ -100,24 +100,6 @@ ir_algebraic_visitor::visit_enter(ir_assignment *ir) } } -static inline bool -is_vec_zero(ir_constant *ir) -{ - return (ir == NULL) ? false : ir->is_zero(); -} - -static inline bool -is_vec_one(ir_constant *ir) -{ - return (ir == NULL) ? false : ir->is_one(); -} - -static inline bool -is_vec_negative_one(ir_constant *ir) -{ - return (ir == NULL) ? false : ir->is_negative_one(); -} - static inline bool is_valid_vec_const(ir_constant *ir) { @@ -358,24 +340,6 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) break; case ir_binop_mul: - if (is_vec_one(op_const[0])) - return ir->operands[1]; - if (is_vec_one(op_const[1])) - return ir->operands[0]; - - if (is_vec_zero(op_const[0]) || is_vec_zero(op_const[1])) - return ir_constant::zero(ir, ir->type); - - if (is_vec_negative_one(op_const[0])) - return neg(ir->operands[1]); - if (is_vec_negative_one(op_const[1])) - return neg(ir->operands[0]); - - if (op_expr[0] && op_expr[0]->operation == ir_unop_b2f && - op_expr[1] && op_expr[1]->operation == ir_unop_b2f) { - return b2f(logic_and(op_expr[0]->operands[0], op_expr[1]->operands[0])); - } - /* Reassociate multiplication of constants so that we can do * constant folding. */