0, 0, 0, 8, 8, 4, 4, 4, 8, 4, 4, 8, 8, 8, 8, 8, /* 15 */
8, 8, 8, 4, 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, /* 31 */
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, /* 47 */
- 4, 8, 8, 8, 8, 8, 0, 0
+ 4, 8, 8, 8, 8, 8, 0, 0, 8
};
/* XXX: silence, you ! */
if (i->flags_def || i->flags_src || i->src[4])
return 8;
+ if (i->is_join)
+ return 8;
+
if (i->src[2]) {
if (i->saturate || i->src[2]->mod)
return 8;
emit_flow(pc, i, 0xa);
break;
case NV_OP_NOP:
+ case NV_OP_JOIN:
pc->emit[0] = 0xf0000001;
pc->emit[1] = 0xe0000000;
break;
break;
}
+ if (i->is_join) {
+ assert(i->is_long && !(pc->emit[1] & 1));
+ pc->emit[1] |= 2;
+ }
+
assert((pc->emit[0] & 1) == i->is_long);
}
static INLINE boolean
inst_cullable(struct nv_instruction *nvi)
{
- return (!(nvi->is_terminator ||
+ return (!(nvi->is_terminator || nvi->is_join ||
nvi->target ||
nvi->fixed ||
nv_nvi_refcount(nvi)));
if (nvi->fixed ||
nvi->is_terminator ||
nvi->flags_src ||
- nvi->flags_def)
+ nvi->flags_def ||
+ nvi->is_join)
return FALSE;
if (nvi->def[0]->join->reg.id < 0)
if (bb_is_if_else_endif(b)) {
- debug_printf("nv_pass_flatten: IF/ELSE/ENDIF construct at BB:%i\n", b->id);
+ debug_printf("pass_flatten: IF/ELSE/ENDIF construct at BB:%i\n", b->id);
for (n0 = 0, nvi = b->out[0]->entry; nvi; nvi = nvi->next, ++n0)
if (!nv50_nvi_can_predicate(nvi))
assert(b->exit && b->exit->opcode == NV_OP_BRA);
nv_nvi_delete(b->exit);
+
+ if (b->exit && b->exit->opcode == NV_OP_JOINAT)
+ nv_nvi_delete(b->exit);
+
+ if ((nvi = b->out[0]->out[0]->entry)) {
+ nvi->is_join = 0;
+ if (nvi->opcode == NV_OP_JOIN)
+ nv_nvi_delete(nvi);
+ }
}
}
DESCEND_ARBITRARY(i, nv_pass_flatten);
src1 = bld_predicate(bld, emit_fetch(bld, insn, 0, 0), TRUE);
- bld_flow(bld, NV_OP_BRA, NV_CC_EQ, src1, NULL, FALSE);
+ bld_flow(bld, NV_OP_BRA, NV_CC_EQ, src1, NULL, (bld->cond_lvl == 0));
++bld->cond_lvl;
bld_new_block(bld, b);
bld->cond_bb[bld->cond_lvl]->exit->target = b;
- if (0 && bld->join_bb[bld->cond_lvl]) {
- bld->join_bb[bld->cond_lvl]->exit->prev->target = b;
+ bld_new_block(bld, b);
- new_instruction(bld->pc, NV_OP_NOP)->is_join = TRUE;
+ if (!bld->cond_lvl && bld->join_bb[bld->cond_lvl]) {
+ bld->join_bb[bld->cond_lvl]->exit->prev->target = b;
+ new_instruction(bld->pc, NV_OP_JOIN)->is_join = TRUE;
}
-
- bld_new_block(bld, b);
}
break;
case TGSI_OPCODE_BGNLOOP: