Mesa (master): i965/fs: Optimize SEL with the same sources into a MOV.

Matt Turner mattst88 at kemper.freedesktop.org
Tue Jun 17 17:07:19 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Fri Apr 18 10:01:41 2014 -0700

i965/fs: Optimize SEL with the same sources into a MOV.

instructions in affected programs:     474 -> 462 (-2.53%)

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 62868d1..d7b969e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2021,7 +2021,13 @@ fs_visitor::opt_algebraic()
          }
          break;
       case BRW_OPCODE_SEL:
-         if (inst->saturate && inst->src[1].file == IMM) {
+         if (inst->src[0].equals(inst->src[1])) {
+            inst->opcode = BRW_OPCODE_MOV;
+            inst->src[1] = reg_undef;
+            inst->predicate = BRW_PREDICATE_NONE;
+            inst->predicate_inverse = false;
+            progress = true;
+         } else if (inst->saturate && inst->src[1].file == IMM) {
             switch (inst->conditional_mod) {
             case BRW_CONDITIONAL_LE:
             case BRW_CONDITIONAL_L:




More information about the mesa-commit mailing list