glsl/opt_algebraic: Drop the flrp/ffma simplifiers.
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 <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:
@@ -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.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user