diff options
author | Eric Anholt <[email protected]> | 2012-09-20 11:06:07 +0200 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-10-08 08:38:49 -0700 |
commit | 9cfc00a84c7a7176a385808e0b92705e79955505 (patch) | |
tree | c839ca376bca6c2cb3ae3aeeb905755d9c31f965 /src/mesa/drivers/dri | |
parent | d81d7a4b65565a873338f54b0a17795d91ccc625 (diff) |
i965/fs: Add a couple more algebraic cases that help some ARB_fp patterns.
ARB_fp doesn't go through the GLSL optimizer, and these were things you see
frequently thanks to conditionals being lowered to SLT/SGE and MUL.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 9ac2a49d948..fea598025ef 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1435,7 +1435,30 @@ fs_visitor::opt_algebraic() break; } + /* a * 0.0 = 0.0 */ + if (inst->src[1].type == BRW_REGISTER_TYPE_F && + inst->src[1].imm.f == 0.0) { + inst->opcode = BRW_OPCODE_MOV; + inst->src[0] = fs_reg(0.0f); + inst->src[1] = reg_undef; + progress = true; + break; + } + break; + case BRW_OPCODE_ADD: + if (inst->src[1].file != IMM) + continue; + + /* a + 0.0 = a */ + if (inst->src[1].type == BRW_REGISTER_TYPE_F && + inst->src[1].imm.f == 0.0) { + inst->opcode = BRW_OPCODE_MOV; + inst->src[1] = reg_undef; + progress = true; + break; + } + break; default: break; } |