Module: Mesa Branch: nv50-compiler Commit: cca3906a9b1d994c431ceeccccbde0ce87a2f6b4 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cca3906a9b1d994c431ceeccccbde0ce87a2f6b4
Author: Christoph Bumiller <[email protected]> Date: Sun Sep 12 19:43:22 2010 +0200 nv50: check for immediates when turning MUL ADD into MAD --- 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 ea1da62..fba6098 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); _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
