glsl/opt_algebraic: Drop some fmul simplifications.
authorEmma Anholt <emma@anholt.net>
Wed, 22 Feb 2023 20:44:40 +0000 (12:44 -0800)
committerMarge Bot <emma+marge@anholt.net>
Tue, 28 Feb 2023 03:36:09 +0000 (03:36 +0000)
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 <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21475>

src/compiler/glsl/opt_algebraic.cpp

index 6ca9883..a2da88e 100644 (file)
@@ -101,24 +101,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)
 {
    if (ir == NULL)
@@ -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.
        */