summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/nv50/nv50_pc.c21
-rw-r--r--src/gallium/drivers/nv50/nv50_pc.h1
-rw-r--r--src/gallium/drivers/nv50/nv50_tgsi_to_nc.c10
3 files changed, 25 insertions, 7 deletions
diff --git a/src/gallium/drivers/nv50/nv50_pc.c b/src/gallium/drivers/nv50/nv50_pc.c
index c934450d42..78aca8fd56 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 e8d9942307..8f15a82026 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 b4f5a884c4..8ad0b18c79 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);
}