diff options
author | Christoph Bumiller <[email protected]> | 2010-09-12 19:43:22 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2010-09-13 17:26:41 +0200 |
commit | cca3906a9b1d994c431ceeccccbde0ce87a2f6b4 (patch) | |
tree | a4f3db49cecefd051fa1f484ddf35987064a0291 | |
parent | 98c87c382d080ff5a048564e942e649fbaf43879 (diff) |
nv50: check for immediates when turning MUL ADD into MAD
-rw-r--r-- | src/gallium/drivers/nv50/nv50_pc_optimize.c | 9 |
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 ea1da6268da..fba60984ac8 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); |