Mesa (master): i965/fs: Optimize LRP with x == y into a MOV.

Matt Turner mattst88 at kemper.freedesktop.org
Tue Jan 21 22:26:43 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Thu Jan  9 20:57:36 2014 -0800

i965/fs: Optimize LRP with x == y into a MOV.

total instructions in shared programs: 1487331 -> 1485988 (-0.09%)
instructions in affected programs:     45638 -> 44295 (-2.94%)
GAINED:                                7
LOST:                                  0

Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 4a96126..78ddf0d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2000,6 +2000,16 @@ fs_visitor::opt_algebraic()
             break;
          }
          break;
+      case BRW_OPCODE_LRP:
+         if (inst->src[1].equals(inst->src[2])) {
+            inst->opcode = BRW_OPCODE_MOV;
+            inst->src[0] = inst->src[1];
+            inst->src[1] = reg_undef;
+            inst->src[2] = reg_undef;
+            progress = true;
+            break;
+         }
+         break;
       case BRW_OPCODE_SEL:
          if (inst->saturate && inst->src[1].file == IMM) {
             switch (inst->conditional_mod) {




More information about the mesa-commit mailing list