i965/fs: Remove SNB embedded-comparison support from optimizations.
authorMatt Turner <mattst88@gmail.com>
Sat, 3 Oct 2015 03:18:34 +0000 (20:18 -0700)
committerMatt Turner <mattst88@gmail.com>
Mon, 5 Oct 2015 20:42:58 +0000 (13:42 -0700)
We never emit IF instructions with an embedded comparison (lost in the
switch to NIR), so this code is not used. If we want to readd support,
we should have a pass that merges a CMP instruction with an IF or a
WHILE instruction after other optimizations have run.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp

index b75f40ba5a1a222f5784e7804f37faba512f9018..8f7bd83ec70e7ec05064aff171e36b2b7b5c0b3c 100644 (file)
@@ -83,18 +83,8 @@ fs_visitor::opt_peephole_predicated_break()
       bblock_t *if_block = jump_block->prev();
       bblock_t *endif_block = jump_block->next();
 
-      /* For Sandybridge with IF with embedded comparison we need to emit an
-       * instruction to set the flag register.
-       */
-      if (devinfo->gen == 6 && if_inst->conditional_mod) {
-         const fs_builder ibld(this, if_block, if_inst);
-         ibld.CMP(ibld.null_reg_d(), if_inst->src[0], if_inst->src[1],
-                  if_inst->conditional_mod);
-         jump_inst->predicate = BRW_PREDICATE_NORMAL;
-      } else {
-         jump_inst->predicate = if_inst->predicate;
-         jump_inst->predicate_inverse = if_inst->predicate_inverse;
-      }
+      jump_inst->predicate = if_inst->predicate;
+      jump_inst->predicate_inverse = if_inst->predicate_inverse;
 
       bblock_t *earlier_block = if_block;
       if (if_block->start_ip == if_block->end_ip) {
index d190d8eb6b43cb09403e94105e48f4e01142dee8..8613725f6b9b233e1dac3f835289fda838027ba7 100644 (file)
@@ -155,18 +155,6 @@ fs_visitor::opt_peephole_sel()
       if (movs == 0)
          continue;
 
-      enum brw_predicate predicate;
-      bool predicate_inverse;
-      if (devinfo->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])
@@ -195,13 +183,6 @@ fs_visitor::opt_peephole_sel()
       if (movs == 0)
          continue;
 
-      /* Emit a CMP if our IF used the embedded comparison */
-      if (devinfo->gen == 6 && if_inst->conditional_mod) {
-         const fs_builder ibld(this, block, if_inst);
-         ibld.CMP(ibld.null_reg_d(), if_inst->src[0], if_inst->src[1],
-                  if_inst->conditional_mod);
-      }
-
       for (int i = 0; i < movs; i++) {
          const fs_builder ibld = fs_builder(this, then_block, then_mov[i])
                                  .at(block, if_inst);
@@ -220,7 +201,7 @@ fs_visitor::opt_peephole_sel()
                ibld.MOV(src0, then_mov[i]->src[0]);
             }
 
-            set_predicate_inv(predicate, predicate_inverse,
+            set_predicate_inv(if_inst->predicate, if_inst->predicate_inverse,
                               ibld.SEL(then_mov[i]->dst, src0,
                                        else_mov[i]->src[0]));
          }