Mesa (master): i965/fs: Decide predicate/ predicate_inverse outside of the for loop.

Matt Turner mattst88 at kemper.freedesktop.org
Thu Jul 24 18:28:10 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Tue Feb 11 13:12:07 2014 -0800

i965/fs: Decide predicate/predicate_inverse outside of the for loop.

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

---

 src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp |   23 +++++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
index c0bba8e..03c7ee6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
@@ -156,6 +156,18 @@ fs_visitor::opt_peephole_sel()
       fs_inst *sel_inst[MAX_MOVS] = { NULL };
       fs_inst *mov_imm_inst[MAX_MOVS] = { NULL };
 
+      enum brw_predicate predicate;
+      bool predicate_inverse;
+      if (brw->gen == 6 && if_inst->conditional_mod) {
+         /* For Sandybridge with IF with embedded comparison */
+         predicate = BRW_PREDICATE_NORMAL;
+         predicate_inverse = false;
+      } else {
+         /* Separate CMP and IF instructions */
+         predicate = if_inst->predicate;
+         predicate_inverse = if_inst->predicate_inverse;
+      }
+
       /* Generate SEL instructions for pairs of MOVs to a common destination. */
       for (int i = 0; i < movs; i++) {
          if (!then_mov[i] || !else_mov[i])
@@ -190,15 +202,8 @@ fs_visitor::opt_peephole_sel()
             }
 
             sel_inst[i] = SEL(then_mov[i]->dst, src0, else_mov[i]->src[0]);
-
-            if (brw->gen == 6 && if_inst->conditional_mod) {
-               /* For Sandybridge with IF with embedded comparison */
-               sel_inst[i]->predicate = BRW_PREDICATE_NORMAL;
-            } else {
-               /* Separate CMP and IF instructions */
-               sel_inst[i]->predicate = if_inst->predicate;
-               sel_inst[i]->predicate_inverse = if_inst->predicate_inverse;
-            }
+            sel_inst[i]->predicate = predicate;
+            sel_inst[i]->predicate_inverse = predicate_inverse;
          }
       }
 




More information about the mesa-commit mailing list