diff options
author | Tapani Pälli <[email protected]> | 2015-03-16 10:08:08 +0200 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2015-03-17 07:59:30 +0200 |
commit | 627c68308683abbd6e563a09af6013a33938a790 (patch) | |
tree | d24266b6bd8a788ce2198e8fe923f7c5d58e6666 /src/mesa | |
parent | 60f77b22b1e3bbef7e4d1f10012acf830d81ed7b (diff) |
i965/fs: in MAD optimizations, switch last argument to be immediate
Commit bb33a31 introduced optimizations that transform cases of MAD
in to simpler forms but it did not take in to account that src[0]
can not be immediate and did not report progress. Patch switches
src[0] and src[1] if src[0] is immediate and adds progress
reporting. If both sources are immediates, this is taken care of by
the same opt_algebraic pass on later run.
v2: Fix for all cases, use temporary fs_reg (Matt, Kenneth)
Signed-off-by: Tapani Pälli <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89569
Reviewed-by: Francisco Jerez <[email protected]> (v1)
Reviewed-by: Kenneth Graunke <[email protected]>
Cc: "10.5" <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 8702ea8a21f..53ceb29e919 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2491,6 +2491,7 @@ fs_visitor::opt_algebraic() inst->opcode = BRW_OPCODE_MUL; inst->src[0] = inst->src[2]; inst->src[2] = reg_undef; + progress = true; } else if (inst->src[1].is_one()) { inst->opcode = BRW_OPCODE_ADD; inst->src[1] = inst->src[2]; @@ -2521,8 +2522,16 @@ fs_visitor::opt_algebraic() default: break; } - } + /* Swap if src[0] is immediate. */ + if (progress && inst->is_commutative()) { + if (inst->src[0].file == IMM) { + fs_reg tmp = inst->src[1]; + inst->src[1] = inst->src[0]; + inst->src[0] = tmp; + } + } + } return progress; } |