bool try_emit_saturate(ir_expression *ir);
bool try_emit_line(ir_expression *ir);
bool try_emit_mad(ir_expression *ir);
- void try_replace_with_sel();
+ bool try_replace_with_sel();
bool opt_peephole_sel();
bool opt_peephole_predicated_break();
bool opt_saturate_propagation();
void
fs_visitor::nir_emit_if(nir_if *if_stmt)
{
- if (brw->gen < 6) {
- no16("Can't support (non-uniform) control flow on SIMD16\n");
- }
-
/* first, put the condition into f0 */
fs_inst *inst = emit(MOV(reg_null_d,
retype(get_nir_src(if_stmt->condition),
emit(BRW_OPCODE_ENDIF);
- try_replace_with_sel();
+ if (!try_replace_with_sel() && brw->gen < 6) {
+ no16("Can't support (non-uniform) control flow on SIMD16\n");
+ }
}
void
*
* If src0 is an immediate value, we promote it to a temporary GRF.
*/
-void
+bool
fs_visitor::try_replace_with_sel()
{
fs_inst *endif_inst = (fs_inst *) instructions.get_tail();
fs_inst *match = (fs_inst *) endif_inst->prev;
for (int i = 0; i < 4; i++) {
if (match->is_head_sentinel() || match->opcode != opcodes[4-i-1])
- return;
+ return false;
match = (fs_inst *) match->prev;
}
sel->predicate = if_inst->predicate;
sel->predicate_inverse = if_inst->predicate_inverse;
}
+
+ return true;
}
+
+ return false;
}
void
fs_visitor::visit(ir_if *ir)
{
- if (brw->gen < 6) {
- no16("Can't support (non-uniform) control flow on SIMD16\n");
- }
-
/* Don't point the annotation at the if statement, because then it plus
* the then and else blocks get printed.
*/
emit(BRW_OPCODE_ENDIF);
- try_replace_with_sel();
+ if (!try_replace_with_sel() && brw->gen < 6) {
+ no16("Can't support (non-uniform) control flow on SIMD16\n");
+ }
}
void