summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv50
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-09-12 19:43:22 +0200
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-09-13 17:26:41 +0200
commitcca3906a9b1d994c431ceeccccbde0ce87a2f6b4 (patch)
treea4f3db49cecefd051fa1f484ddf35987064a0291 /src/gallium/drivers/nv50
parent98c87c382d080ff5a048564e942e649fbaf43879 (diff)
nv50: check for immediates when turning MUL ADD into MAD
Diffstat (limited to 'src/gallium/drivers/nv50')
-rw-r--r--src/gallium/drivers/nv50/nv50_pc_optimize.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gallium/drivers/nv50/nv50_pc_optimize.c b/src/gallium/drivers/nv50/nv50_pc_optimize.c
index ea1da6268d..fba60984ac 100644
--- a/src/gallium/drivers/nv50/nv50_pc_optimize.c
+++ b/src/gallium/drivers/nv50/nv50_pc_optimize.c
@@ -562,6 +562,11 @@ constant_expression(struct nv_pc *pc, struct nv_instruction *nvi,
nvi->src[0] = nvi->src[2];
nvi->src[2] = NULL;
nvi->opcode = NV_OP_ADD;
+
+ if (val->reg.imm.u32 == 0) {
+ nvi->src[1] = NULL;
+ nvi->opcode = NV_OP_MOV;
+ }
}
}
@@ -703,6 +708,10 @@ nv_pass_lower_arith(struct nv_pass *ctx, struct nv_basic_block *b)
else
continue;
+ /* could have an immediate from above constant_* */
+ if (src0->reg.file != NV_FILE_GPR || src1->reg.file != NV_FILE_GPR)
+ continue;
+
nvi->opcode = NV_OP_MAD;
mod = nvi->src[(src == src0) ? 0 : 1]->mod;
nv_reference(ctx->pc, &nvi->src[(src == src0) ? 0 : 1], NULL);