From: Christoph Bumiller Date: Sun, 12 Sep 2010 18:55:09 +0000 (+0200) Subject: nv50: interp cannot write flags reg X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1f1411f2ccc7f808d181c09f925b0780306a05ca;p=mesa.git nv50: interp cannot write flags reg --- diff --git a/src/gallium/drivers/nv50/nv50_pc.c b/src/gallium/drivers/nv50/nv50_pc.c index c934450d424..78aca8fd563 100644 --- a/src/gallium/drivers/nv50/nv50_pc.c +++ b/src/gallium/drivers/nv50/nv50_pc.c @@ -170,6 +170,27 @@ nv50_supported_src_mods(uint opcode, int s) } } +/* We may want an opcode table. */ +boolean +nv50_op_can_write_flags(uint opcode) +{ + if (nv_is_vector_op(opcode)) + return FALSE; + switch (opcode) { /* obvious ones like KIL, CALL, etc. not included */ + case NV_OP_PHI: + case NV_OP_MOV: + case NV_OP_LINTERP: + case NV_OP_PINTERP: + case NV_OP_LDA: + return FALSE; + default: + break; + } + if (opcode >= NV_OP_RCP && opcode <= NV_OP_PREEX2) + return FALSE; + return TRUE; +} + int nv_nvi_refcount(struct nv_instruction *nvi) { diff --git a/src/gallium/drivers/nv50/nv50_pc.h b/src/gallium/drivers/nv50/nv50_pc.h index e8d99423072..8f15a820260 100644 --- a/src/gallium/drivers/nv50/nv50_pc.h +++ b/src/gallium/drivers/nv50/nv50_pc.h @@ -486,6 +486,7 @@ int nv50_indirect_opnd(struct nv_instruction *); boolean nv50_nvi_can_use_imm(struct nv_instruction *, int s); boolean nv50_nvi_can_predicate(struct nv_instruction *); boolean nv50_nvi_can_load(struct nv_instruction *, int s, struct nv_value *); +boolean nv50_op_can_write_flags(uint opcode); ubyte nv50_supported_src_mods(uint opcode, int s); int nv_nvi_refcount(struct nv_instruction *); void nv_nvi_delete(struct nv_instruction *); diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c index b4f5a884c46..8ad0b18c792 100644 --- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c +++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c @@ -700,19 +700,15 @@ bld_predicate(struct bld_context *bld, struct nv_value *src, boolean bool_only) while (nvi->opcode == NV_OP_ABS || nvi->opcode == NV_OP_NEG || nvi->opcode == NV_OP_CVT) { s0i = nvi->src[0]->value->insn; - if (!s0i || - s0i->opcode == NV_OP_LDA || - s0i->opcode == NV_OP_MOV || - s0i->opcode == NV_OP_PHI) + if (!s0i || !nv50_op_can_write_flags(s0i->opcode)) break; nvi = s0i; assert(!nvi->flags_src); } } - if (nvi->opcode == NV_OP_LDA || - nvi->opcode == NV_OP_MOV || - nvi->opcode == NV_OP_PHI || nvi->bb != bld->pc->current_block) { + if (!nv50_op_can_write_flags(nvi->opcode) || + nvi->bb != bld->pc->current_block) { nvi = new_instruction(bld->pc, NV_OP_CVT); nv_reference(bld->pc, &nvi->src[0], src); }