diff options
author | Eric Anholt <[email protected]> | 2011-07-22 16:18:39 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-07-29 12:17:03 -0700 |
commit | 6d8d6b41b85a18685351f3023a4cd41266ba9e68 (patch) | |
tree | 37eab5957fbedbf7c7646baceb64a000ceefa398 /src | |
parent | eb30820f268608cf451da32de69723036dddbc62 (diff) |
i965/fs: If we see a RCP of a constant, try to constant fold it.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 9c3180fbc1c..351d1dd283e 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1056,6 +1056,20 @@ fs_visitor::propagate_constants() progress = true; } break; + + case FS_OPCODE_RCP: + /* The hardware doesn't do math on immediate values + * (because why are you doing that, seriously?), but + * the correct answer is to just constant fold it + * anyway. + */ + assert(i == 0); + if (inst->src[0].imm.f != 0.0f) { + scan_inst->opcode = BRW_OPCODE_MOV; + scan_inst->src[0] = inst->src[0]; + progress = true; + } + break; } } |