aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2013-08-19 10:44:41 -0700
committerMatt Turner <[email protected]>2013-09-09 15:01:08 -0700
commit847726295861af4a34f0ec8eb7b3dfe9a6e178bd (patch)
treecc35d15994ccf5a35062145ba8a146d1600eafe2
parent7aaa38728f93bfb69573e0d866f24e8cb41836f0 (diff)
i965: Add support for ir_triop_csel.
Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp1
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp6
3 files changed, 13 insertions, 0 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 fa02d9be87b..b4c33e636a9 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
@@ -362,6 +362,7 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
case ir_triop_fma:
case ir_triop_lrp:
+ case ir_triop_csel:
case ir_triop_bitfield_extract:
for (i = 0; i < vector_elements; i++) {
ir_rvalue *op0 = get_element(op_var[0], i);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 543fe5e8ab1..d935c7b26e3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -728,6 +728,12 @@ fs_visitor::visit(ir_expression *ir)
case ir_triop_lrp:
emit_lrp(this->result, op[0], op[1], op[2]);
break;
+
+ case ir_triop_csel:
+ emit(CMP(reg_null_d, op[0], fs_reg(0), BRW_CONDITIONAL_NZ));
+ inst = emit(BRW_OPCODE_SEL, this->result, op[1], op[2]);
+ inst->predicate = BRW_PREDICATE_NORMAL;
+ break;
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 3a2f047f46d..7ced32c6e8b 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1588,6 +1588,12 @@ vec4_visitor::visit(ir_expression *ir)
emit(LRP(result_dst, op[2], op[1], op[0]));
break;
+ case ir_triop_csel:
+ emit(CMP(dst_null_d(), op[0], src_reg(0), BRW_CONDITIONAL_NZ));
+ inst = emit(BRW_OPCODE_SEL, result_dst, op[1], op[2]);
+ inst->predicate = BRW_PREDICATE_NORMAL;
+ break;
+
case ir_triop_bfi:
op[0] = fix_3src_operand(op[0]);
op[1] = fix_3src_operand(op[1]);