glsl/opt_algebraic: Drop abs(-x) -> abs(x) and abs(abs(x)) -> abs(x).

NIR does this.  No change on freedreno shader-db.

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 11:38:14 -08:00
committed by Marge Bot
parent 7a8a50106e
commit 766f551cb5

View File

@@ -305,19 +305,6 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
this->mem_ctx = ralloc_parent(ir);
switch (ir->operation) {
case ir_unop_abs:
if (op_expr[0] == NULL)
break;
switch (op_expr[0]->operation) {
case ir_unop_abs:
case ir_unop_neg:
return abs(op_expr[0]->operands[0]);
default:
break;
}
break;
case ir_unop_neg:
if (op_expr[0] == NULL)
break;