i965: Add support for ir_triop_csel.
authorMatt Turner <mattst88@gmail.com>
Mon, 19 Aug 2013 17:44:41 +0000 (10:44 -0700)
committerMatt Turner <mattst88@gmail.com>
Mon, 9 Sep 2013 22:01:08 +0000 (15:01 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index fa02d9be87b163377f824781b6b672424e16f981..b4c33e636a9f4c1a131655e8ceb6f4790d300451 100644 (file)
@@ -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);
index 543fe5e8ab1199900011b0e79644f04f42bbddf1..d935c7b26e3fde1521cd57854a047307c98dc6aa 100644 (file)
@@ -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;
    }
 }
 
index 3a2f047f46d59f61b92dca2eba05fd4c410553f0..7ced32c6e8b521392f47eda65c010cb5cda6fd77 100644 (file)
@@ -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]);