[Mesa-dev] [PATCH 15/15] i965/fs: Optimize saturating SEL.G(E) with imm val <= 0.0f.

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


Only one program's instruction count is changed, but a shader in Tropics
is also affected.

instructions in affected programs:     162 -> 159 (-1.85%)
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 7d92c7a..5ac0d17 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1922,6 +1922,20 @@ fs_visitor::opt_algebraic()
                   break;
                }
                break;
+            case BRW_CONDITIONAL_GE:
+            case BRW_CONDITIONAL_G:
+               switch (inst->src[1].type) {
+               case BRW_REGISTER_TYPE_F:
+                  if (inst->src[1].imm.f <= 0.0f) {
+                     inst->opcode = BRW_OPCODE_MOV;
+                     inst->src[1] = reg_undef;
+                     inst->conditional_mod = BRW_CONDITIONAL_NONE;
+                     progress = true;
+                  }
+                  break;
+               default:
+                  break;
+               }
             default:
                break;
             }
-- 
1.8.3.2



More information about the mesa-dev mailing list