summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2012-12-02 00:08:15 -0800
committerMatt Turner <mattst88@gmail.com>2013-02-28 13:19:00 -0800
commit0a1d145e5f1e6120e70e9b46e069167a0d653579 (patch)
tree30e57f6ef19800b87e8ad0fd859eec726fd97a69 /src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
parent015a48743dfcf138cce5752098e01a6cfd6efefe (diff)
downloadexternal_mesa3d-0a1d145e5f1e6120e70e9b46e069167a0d653579.zip
external_mesa3d-0a1d145e5f1e6120e70e9b46e069167a0d653579.tar.gz
external_mesa3d-0a1d145e5f1e6120e70e9b46e069167a0d653579.tar.bz2
i965/fs: Use the LRP instruction for ir_triop_lrp when possible.
v2 [mattst88]: - Add BRW_OPCODE_LRP to list of CSE-able expressions. - Fix op_var[] array size. - Rename arguments to emit_lrp to (x, y, a) to clear confusion. - Add LRP function to brw_fs.cpp/.h. - Corrected comment about LRP instruction arguments in emit_lrp. v3 [mattst88]: - Duplicate MAD code for LRP instead of using a function pointer. - Check for != GRF instead of == IMM in emit_lrp. - Lower LRP on gen < 6. Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> 1
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
index ea06225..30d8d9b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
@@ -135,7 +135,7 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
ir_expression *expr = ir->rhs->as_expression();
bool found_vector = false;
unsigned int i, vector_elements = 1;
- ir_variable *op_var[2];
+ ir_variable *op_var[3];
if (!expr)
return visit_continue;
@@ -342,6 +342,20 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
assert(!"not yet supported");
break;
+ case ir_triop_lrp:
+ for (i = 0; i < vector_elements; i++) {
+ ir_rvalue *op0 = get_element(op_var[0], i);
+ ir_rvalue *op1 = get_element(op_var[1], i);
+ ir_rvalue *op2 = get_element(op_var[2], i);
+
+ assign(ir, i, new(mem_ctx) ir_expression(expr->operation,
+ element_type,
+ op0,
+ op1,
+ op2));
+ }
+ break;
+
case ir_unop_pack_snorm_2x16:
case ir_unop_pack_snorm_4x8:
case ir_unop_pack_unorm_2x16: