diff options
author | Matt Turner <[email protected]> | 2014-09-27 10:34:56 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2014-09-30 17:09:34 -0700 |
commit | 94b68109fbe1cb60cc23a4c5a319039ada81ea81 (patch) | |
tree | 9bfc35ffd2b2bca4f480a6d81b8aba59c662f42a /src/mesa | |
parent | b52126b44f40643aa2c0986c1d51330f4e4130b5 (diff) |
i965/fs: Optimize sqrt+inv into rsq.
Transform
sqrt a, b
rcp c, a
into
sqrt a, b
rsq c, b
The improvement here is that we've broken a dependency between these
instructions. Leads to 330 fewer INV instructions and 330 more RSQ.
Reviewed-by: Anuj Phogat <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index ab4ee34b41c..19e9cb957e0 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2334,6 +2334,17 @@ fs_visitor::opt_algebraic() } } break; + case SHADER_OPCODE_RCP: { + fs_inst *prev = (fs_inst *)inst->prev; + if (prev->opcode == SHADER_OPCODE_SQRT) { + if (inst->src[0].equals(prev->dst)) { + inst->opcode = SHADER_OPCODE_RSQ; + inst->src[0] = prev->src[0]; + progress = true; + } + } + break; + } default: break; } |