[Mesa-dev] [PATCH 3/9] i965/fs: Get rid of the sel.sat peephole

Jason Ekstrand jason at jlekstrand.net
Thu Mar 17 17:21:40 UTC 2016


Shader-db results on Broadwell:

total instructions in shared programs: 7517815 -> 7517816 (0.00%)
instructions in affected programs:     46 -> 47 (2.17%)
HURT:                                  1

The one hurt shader is a shader from "The Swapper" that writes to
gl_FrontColor and, as such, gets an implicit sat added to the output write.
Since this is invisible to NIR, the optimization in the previous commit
can't fix it for us.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 34 ----------------------------------
 1 file changed, 34 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index ba6ae59..365231e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2211,40 +2211,6 @@ fs_visitor::opt_algebraic()
             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:
-               switch (inst->src[1].type) {
-               case BRW_REGISTER_TYPE_F:
-                  if (inst->src[1].f >= 1.0f) {
-                     inst->opcode = BRW_OPCODE_MOV;
-                     inst->src[1] = reg_undef;
-                     inst->conditional_mod = BRW_CONDITIONAL_NONE;
-                     progress = true;
-                  }
-                  break;
-               default:
-                  break;
-               }
-               break;
-            case BRW_CONDITIONAL_GE:
-            case BRW_CONDITIONAL_G:
-               switch (inst->src[1].type) {
-               case BRW_REGISTER_TYPE_F:
-                  if (inst->src[1].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;
-            }
          }
          break;
       case BRW_OPCODE_MAD:
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list