Mesa (master): i965/fs: Optimize OR with identical sources into a MOV.

Matt Turner mattst88 at kemper.freedesktop.org
Fri Nov 1 22:21:01 UTC 2013


Module: Mesa
Branch: master
Commit: a8f76d829bdcdb5f238ba6206f1b768098745022
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a8f76d829bdcdb5f238ba6206f1b768098745022

Author: Matt Turner <mattst88 at gmail.com>
Date:   Sun Oct 27 19:34:48 2013 -0700

i965/fs: Optimize OR with identical sources into a MOV.

Helps a lot of Steam games.

total instructions in shared programs: 1409360 -> 1409124 (-0.02%)
instructions in affected programs:     20842 -> 20606 (-1.13%)

Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Paul Berry <stereotype441 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 236e86c..2350cd0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1872,6 +1872,14 @@ fs_visitor::opt_algebraic()
             break;
          }
          break;
+      case BRW_OPCODE_OR:
+         if (inst->src[0].equals(inst->src[1])) {
+            inst->opcode = BRW_OPCODE_MOV;
+            inst->src[1] = reg_undef;
+            progress = true;
+            break;
+         }
+         break;
       default:
 	 break;
       }




More information about the mesa-commit mailing list