glsl/opt_algebraic: Drop some fmul simplifications.

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>
This commit is contained in:
Emma Anholt
2023-02-22 12:44:40 -08:00
committed by Marge Bot
parent 4bf65ce221
commit 6229d34b91

View File

@@ -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.
*/