[Mesa-dev] [PATCH 1/2] i965/fs: Perform CSE on MAD instructions with final arguments switched.
Kenneth Graunke
kenneth at whitecape.org
Wed Oct 29 16:02:45 PDT 2014
On Wednesday, October 29, 2014 02:09:55 PM Matt Turner wrote:
> Multiplication is commutative.
>
> instructions in affected programs: 48314 -> 47954 (-0.75%)
> ---
> src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
> index 8012001..5fdbf46 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
> @@ -128,7 +128,11 @@ operands_match(fs_inst *a, fs_inst *b)
> fs_reg *xs = a->src;
> fs_reg *ys = b->src;
>
> - if (!is_expression_commutative(a->opcode)) {
> + if (a->opcode == BRW_OPCODE_MAD) {
> + return xs[0].equals(ys[0]) &&
> + ((xs[1].equals(ys[1]) && xs[2].equals(ys[2])) ||
> + (xs[2].equals(ys[1]) && xs[1].equals(ys[2])));
> + } else if (!is_expression_commutative(a->opcode)) {
> bool match = true;
> for (int i = 0; i < a->sources; i++) {
> if (!xs[i].equals(ys[i])) {
>
Series is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141029/e67a9832/attachment.sig>
More information about the mesa-dev
mailing list