From: Eric Anholt Date: Thu, 6 May 2010 21:52:16 +0000 (-0700) Subject: ir_to_mesa: Add codegen for rsq expression operation. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=878740bedf418e5bf42ed6d350c938d29abaaf25;p=mesa.git ir_to_mesa: Add codegen for rsq expression operation. --- diff --git a/ir_to_mesa.cpp b/ir_to_mesa.cpp index 3fed1577796..b28747e6a26 100644 --- a/ir_to_mesa.cpp +++ b/ir_to_mesa.cpp @@ -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]; diff --git a/mesa_codegen.brg b/mesa_codegen.brg index ed9afdc57cd..e8d499fd74e 100644 --- a/mesa_codegen.brg +++ b/mesa_codegen.brg @@ -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,