mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
ir_algebraic: Convert ir_unop_logic_not handler to use a switch statement
Currently only ir_binop_equal and ir_binop_nequal are supported, but soon all of the relational operators will be added. Making this change now will simplify those commits.
This commit is contained in:
parent
3adce986c4
commit
fe277089c7
1 changed files with 20 additions and 10 deletions
|
|
@ -161,22 +161,32 @@ ir_algebraic_visitor::handle_expression(ir_rvalue *in_ir)
|
|||
}
|
||||
|
||||
switch (ir->operation) {
|
||||
case ir_unop_logic_not:
|
||||
if (op_expr[0] && op_expr[0]->operation == ir_binop_equal) {
|
||||
case ir_unop_logic_not: {
|
||||
enum ir_expression_operation new_op = ir_unop_logic_not;
|
||||
|
||||
if (op_expr[0] == NULL)
|
||||
break;
|
||||
|
||||
switch (op_expr[0]->operation) {
|
||||
case ir_binop_equal: new_op = ir_binop_nequal; break;
|
||||
case ir_binop_nequal: new_op = ir_binop_equal; break;
|
||||
|
||||
default:
|
||||
/* The default case handler is here to silence a warning from GCC.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
if (new_op != ir_unop_logic_not) {
|
||||
this->progress = true;
|
||||
return new(ir) ir_expression(ir_binop_nequal,
|
||||
ir->type,
|
||||
op_expr[0]->operands[0],
|
||||
op_expr[0]->operands[1]);
|
||||
}
|
||||
if (op_expr[0] && op_expr[0]->operation == ir_binop_nequal) {
|
||||
this->progress = true;
|
||||
return new(ir) ir_expression(ir_binop_equal,
|
||||
return new(ir) ir_expression(new_op,
|
||||
ir->type,
|
||||
op_expr[0]->operands[0],
|
||||
op_expr[0]->operands[1]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ir_binop_add:
|
||||
if (is_vec_zero(op_const[0])) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue