[Mesa-dev] [PATCH 14/15] i965/fs: Optimize saturating SEL.L(E) with imm val >= 1.0.

Matt Turner mattst88 at gmail.com
Mon Oct 28 19:31:38 CET 2013


total instructions in shared programs: 1287130 -> 1285860 (-0.10%)
instructions in affected programs:     93529 -> 92259 (-1.36%)
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index e709b3e..7d92c7a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1905,6 +1905,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;
       }
-- 
1.8.3.2



More information about the mesa-dev mailing list