aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2010-09-02 18:27:01 +0200
committerChristoph Bumiller <[email protected]>2010-09-02 18:28:47 +0200
commit443abc80db9e1a288ce770e76cccd43664348098 (patch)
tree4b82cb45fe2d5a36700addcba84685617d8521e9 /src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
parent9f9ae4eee1939dd15853b8cd1a4fad2c7197aa9a (diff)
nv50: fix build-predicate function
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_tgsi_to_nc.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_tgsi_to_nc.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
index 6bd2de4c744..e1c6ed87bfe 100644
--- a/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
+++ b/src/gallium/drivers/nv50/nv50_tgsi_to_nc.c
@@ -625,23 +625,35 @@ bld_get_address(struct bld_context *bld, int id, struct nv_value *indirect)
static struct nv_value *
bld_predicate(struct bld_context *bld, struct nv_value *src, boolean bool_only)
{
- struct nv_instruction *nvi = src->insn;
+ struct nv_instruction *s0i, *nvi = src->insn;
- if (nvi->opcode == NV_OP_LDA ||
- nvi->opcode == NV_OP_PHI ||
- nvi->bb != bld->pc->current_block) {
- nvi = new_instruction(bld->pc, NV_OP_CVT);
- nv_reference(bld->pc, &nvi->src[0], src);
+ if (!nvi) {
+ nvi = bld_insn_1(bld,
+ (src->reg.file == NV_FILE_IMM) ? NV_OP_MOV : NV_OP_LDA,
+ src)->insn;
+ src = nvi->def[0];
} else
if (bool_only) {
- while (nvi->opcode == NV_OP_ABS || nvi->opcode == NV_OP_CVT ||
- nvi->opcode == NV_OP_NEG) {
- /* TGSI SET gets conversion to f32, we only need source 0/~0 */
- if (!nvi->def[0]->insn->flags_src)
- nvi = nvi->src[0]->value->insn;
+ 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)
+ 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) {
+ nvi = new_instruction(bld->pc, NV_OP_CVT);
+ nv_reference(bld->pc, &nvi->src[0], src);
+ }
+
if (!nvi->flags_def) {
nvi->flags_def = new_value(bld->pc, NV_FILE_FLAGS, NV_TYPE_U16);
nvi->flags_def->insn = nvi;