- case ir_binop_pow:
- /* 1^x == 1 */
- if (is_vec_one(op_const[0]))
- return op_const[0];
-
- /* x^1 == x */
- if (is_vec_one(op_const[1]))
- return ir->operands[0];
-
- /* pow(2,x) == exp2(x) */
- if (is_vec_two(op_const[0]))
- return expr(ir_unop_exp2, ir->operands[1]);
-
- if (is_vec_two(op_const[1])) {
- ir_variable *x = new(ir) ir_variable(ir->operands[1]->type, "x",
- ir_var_temporary);
- base_ir->insert_before(x);
- base_ir->insert_before(assign(x, ir->operands[0]));
- return mul(x, x);
- }
-
- if (is_vec_four(op_const[1])) {
- ir_variable *x = new(ir) ir_variable(ir->operands[1]->type, "x",
- ir_var_temporary);
- base_ir->insert_before(x);
- base_ir->insert_before(assign(x, ir->operands[0]));
-
- ir_variable *squared = new(ir) ir_variable(ir->operands[1]->type,
- "squared",
- ir_var_temporary);
- base_ir->insert_before(squared);
- base_ir->insert_before(assign(squared, mul(x, x)));
- return mul(squared, squared);
- }
-
- break;
-