[Mesa-dev] [PATCH 19/19] i965/fs: Optimize SEL with the same sources into a MOV.

Matt Turner mattst88 at gmail.com
Fri Apr 18 11:56:55 PDT 2014


instructions in affected programs:     474 -> 462 (-2.53%)
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 602fc4a..1fe84f3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2082,7 +2082,12 @@ 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;
+            progress = true;
+         } else if (inst->saturate && inst->src[1].file == IMM) {
             switch (inst->conditional_mod) {
             case BRW_CONDITIONAL_LE:
             case BRW_CONDITIONAL_L:
-- 
1.8.3.2



More information about the mesa-dev mailing list