i965: Share the predicate field between FS and VS.
authorEric Anholt <eric@anholt.net>
Wed, 3 Oct 2012 20:23:05 +0000 (13:23 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 17 Oct 2012 19:24:00 +0000 (12:24 -0700)
Note that BRW_PREDICATE_NONE is 0 and BRW_PREDICATE_NORMAL is 1, so that's a
lot like the true/false we had in the FS before.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 files changed:
src/mesa/drivers/dri/i965/brw_cfg.cpp
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
src/mesa/drivers/dri/i965/brw_fs_cse.cpp
src/mesa/drivers/dri/i965/brw_fs_emit.cpp
src/mesa/drivers/dri/i965/brw_fs_fp.cpp
src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_shader.h
src/mesa/drivers/dri/i965/brw_vec4.h

index 539cb084d4e2464230634e576c2e9d6c1f603fc6..8382764ce34a334cf199c49dc0b483d21d212c52 100644 (file)
@@ -171,7 +171,7 @@ cfg_t::cfg_t(fs_visitor *v)
 
         next = new_block();
         next->start = (fs_inst *)inst->next;
-        if (inst->predicated)
+        if (inst->predicate)
            cur->add_successor(mem_ctx, next);
 
         set_next_block(next);
@@ -182,7 +182,7 @@ cfg_t::cfg_t(fs_visitor *v)
 
         next = new_block();
         next->start = (fs_inst *)inst->next;
-        if (inst->predicated)
+        if (inst->predicate)
            cur->add_successor(mem_ctx, next);
 
         set_next_block(next);
index 42393106c7206b1ba718e230b2faae1a7b7fbbd2..56cb447fafeab981e0f2948c32fa3215d161198b 100644 (file)
@@ -141,7 +141,7 @@ fs_inst::equals(fs_inst *inst)
            src[1].equals(inst->src[1]) &&
            src[2].equals(inst->src[2]) &&
            saturate == inst->saturate &&
-           predicated == inst->predicated &&
+           predicate == inst->predicate &&
            conditional_mod == inst->conditional_mod &&
            mlen == inst->mlen &&
            base_mrf == inst->base_mrf &&
@@ -736,7 +736,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
                      emit(FS_OPCODE_MOV_DISPATCH_TO_FLAGS, attr);
                      fs_inst *inst = emit_linterp(attr, fs_reg(interp),
                                                   interpolation_mode, false);
-                     inst->predicated = true;
+                     inst->predicate = BRW_PREDICATE_NORMAL;
                      inst->predicate_inverse = true;
                   }
                  if (intel->gen < 6) {
@@ -1351,7 +1351,7 @@ fs_visitor::register_coalesce_2()
       fs_inst *inst = (fs_inst *)node;
 
       if (inst->opcode != BRW_OPCODE_MOV ||
-         inst->predicated ||
+         inst->predicate ||
          inst->saturate ||
          inst->src[0].file != GRF ||
          inst->src[0].negate ||
@@ -1431,7 +1431,7 @@ fs_visitor::register_coalesce()
         continue;
 
       if (inst->opcode != BRW_OPCODE_MOV ||
-         inst->predicated ||
+         inst->predicate ||
          inst->saturate ||
          inst->dst.file != GRF || (inst->src[0].file != GRF &&
                                    inst->src[0].file != UNIFORM)||
@@ -1532,7 +1532,7 @@ fs_visitor::compute_to_mrf()
       next_ip++;
 
       if (inst->opcode != BRW_OPCODE_MOV ||
-         inst->predicated ||
+         inst->predicate ||
          inst->dst.file != MRF || inst->src[0].file != GRF ||
          inst->dst.type != inst->src[0].type ||
          inst->src[0].abs || inst->src[0].negate || inst->src[0].smear != -1)
@@ -1581,7 +1581,7 @@ fs_visitor::compute_to_mrf()
             * that writes that reg, but it would require smarter
             * tracking to delay the rewriting until complete success.
             */
-           if (scan_inst->predicated)
+           if (scan_inst->predicate)
               break;
 
            /* If it's half of register setup and not the same half as
@@ -1758,7 +1758,7 @@ fs_visitor::remove_duplicate_mrf_writes()
       if (inst->opcode == BRW_OPCODE_MOV &&
          inst->dst.file == MRF &&
          inst->src[0].file == GRF &&
-         !inst->predicated) {
+         !inst->predicate) {
         last_mrf_move[inst->dst.reg] = inst;
       }
    }
@@ -1788,7 +1788,7 @@ fs_visitor::get_instruction_generating_reg(fs_inst *start,
                                           fs_reg reg)
 {
    if (end == start ||
-       end->predicated ||
+       end->predicate ||
        end->force_uncompressed ||
        end->force_sechalf ||
        !reg.equals(end->dst)) {
index 87cbbe22538070878fc5a98e4a515200fdb9393d..392b6120f67a492adf70d54a81c666c78ce5ff87 100644 (file)
@@ -158,8 +158,6 @@ public:
    fs_reg dst;
    fs_reg src[3];
    bool saturate;
-   bool predicated;
-   bool predicate_inverse;
    int conditional_mod; /**< BRW_CONDITIONAL_* */
 
    int mlen; /**< SEND message length */
index 7ab1c5113aa6294850d6a0ba35596551daa7ff33..1275e697097b7673ff8c38272f2fba2b02e5f2cb 100644 (file)
@@ -253,7 +253,7 @@ fs_visitor::opt_copy_propagate_local(void *mem_ctx, bblock_t *block)
            inst->src[0].file == IMM) &&
          inst->src[0].type == inst->dst.type &&
          !inst->saturate &&
-         !inst->predicated &&
+         !inst->predicate &&
          !inst->force_uncompressed &&
          !inst->force_sechalf &&
          inst->src[0].smear == -1) {
index a231868c0b9855b304e926f568d1693c71294b5d..49584334c0c5f75b648a7f7bd16f2cc0fc677072 100644 (file)
@@ -92,7 +92,7 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
        inst = (fs_inst *) inst->next) {
 
       /* Skip some cases. */
-      if (is_expression(inst) && !inst->predicated && inst->mlen == 0 &&
+      if (is_expression(inst) && !inst->predicate && inst->mlen == 0 &&
           !inst->force_uncompressed && !inst->force_sechalf &&
           !inst->conditional_mod)
       {
index 55c36ca69a763b79e1b460b8a1fb89c36aa3d7cd..54e614fb1f477efe9107b319379eb7713d883f16 100644 (file)
@@ -803,7 +803,7 @@ fs_visitor::generate_code()
       dst = brw_reg_from_fs_reg(&inst->dst);
 
       brw_set_conditionalmod(p, inst->conditional_mod);
-      brw_set_predicate_control(p, inst->predicated);
+      brw_set_predicate_control(p, inst->predicate);
       brw_set_predicate_inverse(p, inst->predicate_inverse);
       brw_set_saturate(p, inst->saturate);
 
index 080435b5114c86f9976d7ff38a0936aabbf2681f..c0a88105e8135cafb7bbd03b75ffc8371dcb9efc 100644 (file)
@@ -93,7 +93,7 @@ fs_visitor::emit_fp_sop(uint32_t conditional_mod,
          inst->conditional_mod = conditional_mod;
 
          inst = emit(BRW_OPCODE_SEL, regoffset(dst, i), one, fs_reg(0.0f));
-         inst->predicated = true;
+         inst->predicate = BRW_PREDICATE_NORMAL;
       }
    }
 }
@@ -177,7 +177,7 @@ fs_visitor::emit_fragment_program_code()
 
                inst = emit(BRW_OPCODE_SEL, regoffset(dst, i),
                            regoffset(src[1], i), regoffset(src[2], i));
-               inst->predicated = true;
+               inst->predicate = BRW_PREDICATE_NORMAL;
             }
          }
          break;
@@ -261,7 +261,7 @@ fs_visitor::emit_fragment_program_code()
             inst->conditional_mod = BRW_CONDITIONAL_L;
 
             inst = emit(BRW_OPCODE_IF);
-            inst->predicated = true;
+            inst->predicate = BRW_PREDICATE_NORMAL;
             emit(FS_OPCODE_DISCARD);
             emit(BRW_OPCODE_ENDIF);
          }
@@ -300,7 +300,7 @@ fs_visitor::emit_fragment_program_code()
             if (fpi->DstReg.WriteMask & WRITEMASK_Y) {
                emit(BRW_OPCODE_MOV, regoffset(dst, 1), regoffset(src[0], 0));
                inst = emit(BRW_OPCODE_MOV, regoffset(dst, 1), fs_reg(0.0f));
-               inst->predicated = true;
+               inst->predicate = BRW_PREDICATE_NORMAL;
             }
 
             if (fpi->DstReg.WriteMask & WRITEMASK_Z) {
@@ -308,7 +308,7 @@ fs_visitor::emit_fragment_program_code()
                          regoffset(src[0], 1), regoffset(src[0], 3));
 
                inst = emit(BRW_OPCODE_MOV, regoffset(dst, 2), fs_reg(0.0f));
-               inst->predicated = true;
+               inst->predicate = BRW_PREDICATE_NORMAL;
             }
          }
 
index f41d6332dd094c22707773c4b3134721c3cc2cef..b0065145d1dd070203330e855f74e5fce49682ac 100644 (file)
@@ -78,7 +78,7 @@ fs_live_variables::setup_def_use()
          */
         if (inst->dst.file == GRF &&
             inst->regs_written() == v->virtual_grf_sizes[inst->dst.reg] &&
-            !inst->predicated &&
+            !inst->predicate &&
             !inst->force_uncompressed &&
             !inst->force_sechalf) {
            int reg = inst->dst.reg;
index 37c8917b3396762875eee2fcf267605f3d781daf..5fb3db94ecc6b1e6a0c6fcdf3b75126ad1369583 100644 (file)
@@ -408,7 +408,7 @@ fs_visitor::spill_reg(int spill_reg)
           * inst->regs_written(), then we need to unspill the destination
           * since we write back out all of the regs_written().
          */
-        if (inst->predicated || inst->force_uncompressed || inst->force_sechalf) {
+        if (inst->predicate || inst->force_uncompressed || inst->force_sechalf) {
             fs_reg unspill_reg = inst->dst;
             for (int chan = 0; chan < inst->regs_written(); chan++) {
                emit_unspill(inst, unspill_reg,
index c8eeb41f470f6d06165fd520756f02756b914108..11e985880f5c4c161f506dd92a28a67758533127 100644 (file)
@@ -298,7 +298,7 @@ instruction_scheduler::calculate_deps()
         add_dep(last_mrf_write[inst->base_mrf + i], n);
       }
 
-      if (inst->predicated) {
+      if (inst->predicate) {
         assert(last_conditional_mod);
         add_dep(last_conditional_mod, n);
       }
@@ -382,7 +382,7 @@ instruction_scheduler::calculate_deps()
         add_dep(n, last_mrf_write[inst->base_mrf + i], 2);
       }
 
-      if (inst->predicated) {
+      if (inst->predicate) {
         add_dep(n, last_conditional_mod);
       }
 
index e5f28b6aded440a3ad803b74355f4009f34daad7..2dd212a8de887f6da8ff48ae56687ebd41fa2a64 100644 (file)
@@ -191,7 +191,7 @@ fs_visitor::emit_minmax(uint32_t conditionalmod, fs_reg dst,
       inst->conditional_mod = conditionalmod;
 
       inst = emit(BRW_OPCODE_SEL, dst, src0, src1);
-      inst->predicated = true;
+      inst->predicate = BRW_PREDICATE_NORMAL;
    }
 }
 
@@ -329,12 +329,12 @@ fs_visitor::visit(ir_expression *ir)
       inst = emit(BRW_OPCODE_CMP, reg_null_f, op[0], fs_reg(0.0f));
       inst->conditional_mod = BRW_CONDITIONAL_G;
       inst = emit(BRW_OPCODE_MOV, this->result, fs_reg(1.0f));
-      inst->predicated = true;
+      inst->predicate = BRW_PREDICATE_NORMAL;
 
       inst = emit(BRW_OPCODE_CMP, reg_null_f, op[0], fs_reg(0.0f));
       inst->conditional_mod = BRW_CONDITIONAL_L;
       inst = emit(BRW_OPCODE_MOV, this->result, fs_reg(-1.0f));
-      inst->predicated = true;
+      inst->predicate = BRW_PREDICATE_NORMAL;
 
       break;
    case ir_unop_rcp:
@@ -623,7 +623,7 @@ fs_visitor::emit_assignment_writes(fs_reg &l, fs_reg &r,
 
         if (predicated || !l.equals(r)) {
            fs_inst *inst = emit(BRW_OPCODE_MOV, l, r);
-           inst->predicated = predicated;
+           inst->predicate = predicated ? BRW_PREDICATE_NORMAL : BRW_PREDICATE_NONE;
         }
 
         l.reg_offset++;
@@ -724,7 +724,7 @@ fs_visitor::visit(ir_assignment *ir)
         if (ir->write_mask & (1 << i)) {
            inst = emit(BRW_OPCODE_MOV, l, r);
            if (ir->condition)
-              inst->predicated = true;
+              inst->predicate = BRW_PREDICATE_NORMAL;
            r.reg_offset++;
         }
         l.reg_offset++;
@@ -1673,7 +1673,7 @@ fs_visitor::visit(ir_if *ir)
       emit_bool_to_cond_code(ir->condition);
 
       inst = emit(BRW_OPCODE_IF);
-      inst->predicated = true;
+      inst->predicate = BRW_PREDICATE_NORMAL;
    }
 
    foreach_list(node, &ir->then_instructions) {
@@ -1730,7 +1730,7 @@ fs_visitor::visit(ir_loop *ir)
       inst->conditional_mod = brw_conditional_for_comparison(ir->cmp);
 
       inst = emit(BRW_OPCODE_BREAK);
-      inst->predicated = true;
+      inst->predicate = BRW_PREDICATE_NORMAL;
    }
 
    foreach_list(node, &ir->body_instructions) {
index da2b7387f81bebadd868c928244508a5725040e3..0abc6671134ee800ada5b0ea727bfb7a2195d08b 100644 (file)
@@ -30,6 +30,9 @@
 class backend_instruction : public exec_node {
 public:
    enum opcode opcode; /* BRW_OPCODE_* or FS_OPCODE_* */
+
+   uint32_t predicate;
+   bool predicate_inverse;
 };
 
 class backend_visitor : public ir_visitor {
index 8ab8431af53fc1b2d0ebf6ecc37ec1afbf6b16ad..bad6f20eddac17b0f4d4012c962d46ddcb93a3c7 100644 (file)
@@ -171,8 +171,6 @@ public:
    src_reg src[3];
 
    bool saturate;
-   bool predicate_inverse;
-   uint32_t predicate;
 
    int conditional_mod; /**< BRW_CONDITIONAL_* */