summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-05-06 13:20:44 -0700
committerEric Anholt <[email protected]>2010-06-24 15:05:20 -0700
commit8c29a1d84d738cfddf16d5f013876ee2cca96a81 (patch)
tree354a2d01acab5f34c6c1ae248a947b77b9dda830
parent829e0a8eff0e657c85fa7fc53a4b456375b434cc (diff)
ir_to_mesa: Add exp/log expression operations.
-rw-r--r--ir_to_mesa.cpp12
-rw-r--r--mesa_codegen.brg32
2 files changed, 44 insertions, 0 deletions
diff --git a/ir_to_mesa.cpp b/ir_to_mesa.cpp
index bc9ad252d02..3fed1577796 100644
--- a/ir_to_mesa.cpp
+++ b/ir_to_mesa.cpp
@@ -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;
diff --git a/mesa_codegen.brg b/mesa_codegen.brg
index 0bfd8dae903..ed9afdc57cd 100644
--- a/mesa_codegen.brg
+++ b/mesa_codegen.brg
@@ -48,6 +48,10 @@
# 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);
+}
+
%%