Mesa (master): i965/fs: Optimize saturating SEL.L(E) with imm val >= 1.0.

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


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

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

i965/fs: Optimize saturating SEL.L(E) with imm val >= 1.0.

total instructions in shared programs: 1409124 -> 1406971 (-0.15%)
instructions in affected programs:     158376 -> 156223 (-1.36%)

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

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 2350cd0..56284d9 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1880,6 +1880,28 @@ fs_visitor::opt_algebraic()
             break;
          }
          break;
+      case BRW_OPCODE_SEL:
+         if (inst->saturate && inst->src[1].file == IMM) {
+            switch (inst->conditional_mod) {
+            case BRW_CONDITIONAL_LE:
+            case BRW_CONDITIONAL_L:
+               switch (inst->src[1].type) {
+               case BRW_REGISTER_TYPE_F:
+                  if (inst->src[1].imm.f >= 1.0f) {
+                     inst->opcode = BRW_OPCODE_MOV;
+                     inst->src[1] = reg_undef;
+                     progress = true;
+                  }
+                  break;
+               default:
+                  break;
+               }
+               break;
+            default:
+               break;
+            }
+         }
+         break;
       default:
 	 break;
       }




More information about the mesa-commit mailing list