break;
case ir_triop_bfi:
+ case ir_triop_csel:
this->type = op1->type;
break;
"vector_extract",
"fma",
"lrp",
+ "csel",
"bfi",
"bitfield_extract",
"vector_insert",
ir_triop_lrp,
+ /**
+ * \name Conditional Select
+ *
+ * A vector conditional select instruction (like ?:, but operating per-
+ * component on vectors).
+ *
+ * \see lower_instructions_visitor::ldexp_to_arith
+ */
+ /*@{*/
+ ir_triop_csel,
+ /*@}*/
+
/**
* \name Second half of a lowered bitfieldInsert() operation.
*
return expr(ir_triop_lrp, x, y, a);
}
+ir_expression *
+csel(operand a, operand b, operand c)
+{
+ return expr(ir_triop_csel, a, b, c);
+}
+
ir_expression *
bitfield_insert(operand a, operand b, operand c, operand d)
{
ir_expression *fma(operand a, operand b, operand c);
ir_expression *lrp(operand x, operand y, operand a);
+ir_expression *csel(operand a, operand b, operand c);
ir_expression *bitfield_insert(operand a, operand b, operand c, operand d);
ir_swizzle *swizzle(operand a, int swizzle, int components);
case ir_binop_lshift:
case ir_binop_rshift:
case ir_binop_vector_extract:
+ case ir_triop_csel:
case ir_triop_bitfield_extract:
break;
break;
}
+ case ir_triop_csel:
+ for (unsigned c = 0; c < components; c++) {
+ data.u[c] = op[0]->value.b[c] ? op[1]->value.u[c]
+ : op[2]->value.u[c];
+ }
+ break;
+
case ir_triop_vector_insert: {
const unsigned idx = op[2]->value.u[0];
assert(ir->operands[2]->type == ir->operands[0]->type || ir->operands[2]->type == glsl_type::float_type);
break;
+ case ir_triop_csel:
+ assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
+ assert(ir->type->vector_elements == ir->operands[0]->type->vector_elements);
+ assert(ir->type == ir->operands[1]->type);
+ assert(ir->type == ir->operands[2]->type);
+ break;
+
case ir_triop_bfi:
assert(ir->operands[0]->type->is_integer());
assert(ir->operands[1]->type == ir->operands[2]->type);
case ir_triop_bitfield_extract:
case ir_triop_vector_insert:
case ir_quadop_bitfield_insert:
+ case ir_triop_csel:
assert(!"not supported");
break;
case ir_quadop_vector:
case ir_binop_vector_extract:
case ir_triop_vector_insert:
+ case ir_triop_csel:
/* This operation is not supported, or should have already been handled.
*/
assert(!"Invalid ir opcode in glsl_to_tgsi_visitor::visit()");