ir_to_mesa: Add exp/log expression operations.
authorEric Anholt <eric@anholt.net>
Thu, 6 May 2010 20:20:44 +0000 (13:20 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 24 Jun 2010 22:05:20 +0000 (15:05 -0700)
ir_to_mesa.cpp
mesa_codegen.brg

index bc9ad252d0224615afeec52cab43b498c7dba34a..3fed1577796edcfb8d0a4322bada09977fb4c78c 100644 (file)
@@ -319,6 +319,18 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
    this->result = NULL;
 
    switch (ir->operation) {
+   case ir_unop_exp:
+      this->result = this->create_tree(MB_TERM_exp_vec4, ir, op[0], NULL);
+      break;
+   case ir_unop_exp2:
+      this->result = this->create_tree(MB_TERM_exp2_vec4, ir, op[0], NULL);
+      break;
+   case ir_unop_log:
+      this->result = this->create_tree(MB_TERM_log_vec4, ir, op[0], NULL);
+      break;
+   case ir_unop_log2:
+      this->result = this->create_tree(MB_TERM_log2_vec4, ir, op[0], NULL);
+      break;
    case ir_binop_add:
       this->result = this->create_tree(MB_TERM_add_vec4_vec4, ir, op[0], op[1]);
       break;
index 0bfd8dae903b74502da5f45a8f9ccd64e181a869..ed9afdc57cd3082100b47709e9c2d069a6bfd0b4 100644 (file)
 # generate in its trees.
 %term assign
 %term reference_vec4
+%term exp_vec4
+%term exp2_vec4
+%term log_vec4
+%term log2_vec4
 %term add_vec4_vec4
 %term sub_vec4_vec4
 %term mul_vec4_vec4
@@ -205,4 +209,32 @@ vec4: sqrt_vec4(vec4) 1
                            tree->src_reg);
 }
 
+vec4: exp_vec4(vec4) 1
+{
+       ir_to_mesa_emit_scalar_op1(tree, OPCODE_EXP,
+                                  tree->dst_reg,
+                                  tree->left->src_reg);
+}
+
+vec4: exp2_vec4(vec4) 1
+{
+       ir_to_mesa_emit_scalar_op1(tree, OPCODE_EX2,
+                                  tree->dst_reg,
+                                  tree->left->src_reg);
+}
+
+vec4: log_vec4(vec4) 1
+{
+       ir_to_mesa_emit_scalar_op1(tree, OPCODE_LOG,
+                                  tree->dst_reg,
+                                  tree->left->src_reg);
+}
+
+vec4: log2_vec4(vec4) 1
+{
+       ir_to_mesa_emit_scalar_op1(tree, OPCODE_LG2,
+                                  tree->dst_reg,
+                                  tree->left->src_reg);
+}
+
 %%