summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv50/nv50_pc_optimize.c
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-09-01 17:54:56 +0200
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-09-01 18:02:50 +0200
commit0a8292e096bc37eeb225bf7d3854b6b6edc4bceb (patch)
tree80bbb0365721665a8ff932e7b6ccb7a7c44a3e5c /src/gallium/drivers/nv50/nv50_pc_optimize.c
parentd90502b2b468732e2a42985580bbbe9d9fdfd14e (diff)
nv50: attempt at making more complicated loops work
Nested loops, and loops with multiple exits (BREAK, CONT).
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_pc_optimize.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_pc_optimize.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gallium/drivers/nv50/nv50_pc_optimize.c b/src/gallium/drivers/nv50/nv50_pc_optimize.c
index 4b1cd56fc1..1d2710a8ac 100644
--- a/src/gallium/drivers/nv50/nv50_pc_optimize.c
+++ b/src/gallium/drivers/nv50/nv50_pc_optimize.c
@@ -362,6 +362,9 @@ nv_pass_fold_loads(struct nv_pass *ctx, struct nv_basic_block *b)
nv_reference(ctx->pc, &nvi->src[j], ld->src[0]->value);
if (ld->src[4])
nv_reference(ctx->pc, &nvi->src[4], ld->src[4]->value);
+
+ if (!nv_nvi_refcount(ld))
+ nv_nvi_delete(ld);
}
}
DESCEND_ARBITRARY(j, nv_pass_fold_loads);
@@ -504,7 +507,7 @@ constant_expression(struct nv_pc *pc, struct nv_instruction *nvi,
u1.u32 = src1->reg.imm.u32;
modifiers_apply(&u0.u32, type, nvi->src[0]->mod);
- modifiers_apply(&u0.u32, type, nvi->src[1]->mod);
+ modifiers_apply(&u1.u32, type, nvi->src[1]->mod);
switch (nvi->opcode) {
case NV_OP_MAD:
@@ -951,7 +954,9 @@ nv_pass_flatten(struct nv_pass *ctx, struct nv_basic_block *b)
if (b->exit && b->exit->opcode == NV_OP_JOINAT)
nv_nvi_delete(b->exit);
- if ((nvi = b->out[0]->out[0]->entry)) {
+ i = (b->out[0]->out_kind[0] == CFG_EDGE_LOOP_LEAVE) ? 1 : 0;
+
+ if ((nvi = b->out[0]->out[i]->entry)) {
nvi->is_join = 0;
if (nvi->opcode == NV_OP_JOIN)
nv_nvi_delete(nvi);
@@ -980,7 +985,8 @@ nv_pass_cse(struct nv_pass *ctx, struct nv_basic_block *b)
if (ir->opcode != ik->opcode)
continue;
- if (ik->opcode == NV_OP_LDA ||
+ if (!ir->def[0] || !ik->def[0] ||
+ ik->opcode == NV_OP_LDA ||
ik->opcode == NV_OP_STA ||
ik->opcode == NV_OP_MOV ||
nv_is_vector_op(ik->opcode))
@@ -993,8 +999,6 @@ nv_pass_cse(struct nv_pass *ctx, struct nv_basic_block *b)
ik->flags_def || ir->flags_def)
continue; /* and also not with flags, for now */
- assert(ik->def[0] && ir->def[0]);
-
if (ik->def[0]->reg.file == NV_FILE_OUT ||
ir->def[0]->reg.file == NV_FILE_OUT ||
!values_equal(ik->def[0], ir->def[0]))