mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 01:50:10 +01:00
glsl: Recognize sat(add(b2f(a), b2f(b))) as a logical OR.
Transform this into b2f(or(a, b)). Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
parent
c8e8f66036
commit
b481ebbe39
1 changed files with 12 additions and 0 deletions
|
|
@ -421,6 +421,18 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
|
|||
break;
|
||||
}
|
||||
|
||||
case ir_unop_saturate:
|
||||
if (op_expr[0] && op_expr[0]->operation == ir_binop_add) {
|
||||
ir_expression *b2f_0 = op_expr[0]->operands[0]->as_expression();
|
||||
ir_expression *b2f_1 = op_expr[0]->operands[1]->as_expression();
|
||||
|
||||
if (b2f_0 && b2f_0->operation == ir_unop_b2f &&
|
||||
b2f_1 && b2f_1->operation == ir_unop_b2f) {
|
||||
return b2f(logic_or(b2f_0->operands[0], b2f_1->operands[0]));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ir_binop_add:
|
||||
if (is_vec_zero(op_const[0]))
|
||||
return ir->operands[1];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue