ir_to_mesa: Add codegen for rsq expression operation.

This commit is contained in:
Eric Anholt 2010-05-06 14:52:16 -07:00
parent 8c29a1d84d
commit 878740bedf
2 changed files with 11 additions and 0 deletions

View file

@ -361,6 +361,9 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
case ir_unop_sqrt:
this->result = this->create_tree(MB_TERM_sqrt_vec4, ir, op[0], op[1]);
break;
case ir_unop_rsq:
this->result = this->create_tree(MB_TERM_rsq_vec4, ir, op[0], op[1]);
break;
case ir_unop_i2f:
/* Mesa IR lacks types, ints are stored as floats. */
this->result = op[0];

View file

@ -60,6 +60,7 @@
%term dp3_vec4_vec4
%term dp2_vec4_vec4
%term sqrt_vec4
%term rsq_vec4
%term swizzle_vec4
# Each tree will produce stmt. Currently, the only production for
@ -209,6 +210,13 @@ vec4: sqrt_vec4(vec4) 1
tree->src_reg);
}
vec4: rsq_vec4(vec4) 1
{
ir_to_mesa_emit_scalar_op1(tree, OPCODE_RSQ,
tree->dst_reg,
tree->left->src_reg);
}
vec4: exp_vec4(vec4) 1
{
ir_to_mesa_emit_scalar_op1(tree, OPCODE_EXP,