[Mesa-dev] [PATCH 124/133] nir: Remove predication

Jason Ekstrand jason at jlekstrand.net
Mon Dec 15 22:13:07 PST 2014


We stopped generating predicates in glsl_to_nir some time ago.  Right now,
it's all dead untested code that I'm not convinced always worked in the
first place.  If we decide we want them back, we can revert this patch.
---
 src/glsl/nir/nir.c                       |  35 ---------
 src/glsl/nir/nir.h                       |  14 ----
 src/glsl/nir/nir_lower_variables.c       |  37 ++--------
 src/glsl/nir/nir_opt_copy_propagate.c    |   4 -
 src/glsl/nir/nir_opt_cse.c               |   7 --
 src/glsl/nir/nir_print.c                 |  30 --------
 src/glsl/nir/nir_split_var_copies.c      |   6 --
 src/glsl/nir/nir_to_ssa.c                | 121 +------------------------------
 src/glsl/nir/nir_validate.c              |  12 ---
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp |  73 +++----------------
 10 files changed, 18 insertions(+), 321 deletions(-)

diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c
index 2d49d6a..7ed811b 100644
--- a/src/glsl/nir/nir.c
+++ b/src/glsl/nir/nir.c
@@ -377,9 +377,6 @@ nir_alu_instr_create(void *mem_ctx, nir_op op)
    for (unsigned i = 0; i < num_srcs; i++)
       alu_src_init(&instr->src[i]);
 
-   instr->has_predicate = false;
-   src_init(&instr->predicate);
-
    return instr;
 }
 
@@ -402,9 +399,6 @@ nir_load_const_instr_create(void *mem_ctx)
    instr->num_components = 0;
    instr->array_elems = 0;
 
-   instr->has_predicate = false;
-   src_init(&instr->predicate);
-
    return instr;
 }
 
@@ -425,9 +419,6 @@ nir_intrinsic_instr_create(void *mem_ctx, nir_intrinsic_op op)
    for (unsigned i = 0; i < num_srcs; i++)
       src_init(&instr->src[i]);
 
-   instr->has_predicate = false;
-   src_init(&instr->predicate);
-
    return instr;
 }
 
@@ -442,9 +433,6 @@ nir_call_instr_create(void *mem_ctx, nir_function_overload *callee)
    instr->params = ralloc_array(mem_ctx, nir_deref_var *, instr->num_params);
    instr->return_deref = NULL;
 
-   instr->has_predicate = false;
-   src_init(&instr->predicate);
-
    return instr;
 }
 
@@ -458,9 +446,6 @@ nir_tex_instr_create(void *mem_ctx, unsigned num_srcs)
    for (unsigned i = 0; i < num_srcs; i++)
       src_init(&instr->src[i]);
 
-   instr->has_predicate = false;
-   src_init(&instr->predicate);
-
    instr->sampler_index = 0;
    instr->has_sampler_indirect = false;
    src_init(&instr->sampler_indirect);
@@ -1518,10 +1503,6 @@ visit_alu_src(nir_alu_instr *instr, nir_foreach_src_cb cb, void *state)
       if (!visit_src(&instr->src[i].src, cb, state))
          return false;
 
-   if (instr->has_predicate)
-      if (!visit_src(&instr->predicate, cb, state))
-         return false;
-
    return true;
 }
 
@@ -1532,10 +1513,6 @@ visit_tex_src(nir_tex_instr *instr, nir_foreach_src_cb cb, void *state)
       if (!visit_src(&instr->src[i], cb, state))
          return false;
 
-   if (instr->has_predicate)
-      if (!visit_src(&instr->predicate, cb, state))
-         return false;
-
    if (instr->has_sampler_indirect)
       if (!visit_src(&instr->sampler_indirect, cb, state))
          return false;
@@ -1562,20 +1539,12 @@ visit_intrinsic_src(nir_intrinsic_instr *instr, nir_foreach_src_cb cb,
       if (!visit_deref_src(instr->variables[i], cb, state))
          return false;
 
-   if (instr->has_predicate)
-      if (!visit_src(&instr->predicate, cb, state))
-         return false;
-
    return true;
 }
 
 static bool
 visit_call_src(nir_call_instr *instr, nir_foreach_src_cb cb, void *state)
 {
-   if (instr->has_predicate)
-      if (!visit_src(&instr->predicate, cb, state))
-         return false;
-
    return true;
 }
 
@@ -1583,10 +1552,6 @@ static bool
 visit_load_const_src(nir_load_const_instr *instr, nir_foreach_src_cb cb,
                      void *state)
 {
-   if (instr->has_predicate)
-      if (!visit_src(&instr->predicate, cb, state))
-         return false;
-
    return true;
 }
 
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index a31c628..d11299b 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -606,8 +606,6 @@ extern const nir_op_info nir_op_infos[nir_num_opcodes];
 typedef struct nir_alu_instr {
    nir_instr instr;
    nir_op op;
-   bool has_predicate;
-   nir_src predicate;
    nir_alu_dest dest;
    nir_alu_src src[];
 } nir_alu_instr;
@@ -679,9 +677,6 @@ typedef struct {
    nir_deref_var **params;
    nir_deref_var *return_deref;
 
-   bool has_predicate;
-   nir_src predicate;
-
    struct nir_function_overload *callee;
 } nir_call_instr;
 
@@ -713,9 +708,6 @@ typedef struct {
 
    nir_deref_var *variables[2];
 
-   bool has_predicate;
-   nir_src predicate;
-
    nir_src src[];
 } nir_intrinsic_instr;
 
@@ -813,9 +805,6 @@ typedef enum {
 typedef struct {
    nir_instr instr;
 
-   bool has_predicate;
-   nir_src predicate;
-
    enum glsl_sampler_dim sampler_dim;
    nir_alu_type dest_type;
 
@@ -945,9 +934,6 @@ typedef struct {
     */
    unsigned array_elems;
 
-   bool has_predicate;
-   nir_src predicate;
-
    nir_dest dest;
 } nir_load_const_instr;
 
diff --git a/src/glsl/nir/nir_lower_variables.c b/src/glsl/nir/nir_lower_variables.c
index 075ae64..eff7d5d 100644
--- a/src/glsl/nir/nir_lower_variables.c
+++ b/src/glsl/nir/nir_lower_variables.c
@@ -552,11 +552,6 @@ emit_copy_load_store(nir_intrinsic_instr *copy_instr,
       store->src[0].is_ssa = true;
       store->src[0].ssa = &load->dest.ssa;
 
-      if (copy_instr->has_predicate) {
-         store->has_predicate = true;
-         store->predicate = nir_src_copy(copy_instr->predicate, state->mem_ctx);
-      }
-
       nir_instr_insert_before(&copy_instr->instr, &store->instr);
       register_store_instr(store, false, state);
    }
@@ -837,32 +832,12 @@ lower_deref_to_ssa_block(nir_block *block, void *void_state)
 
             assert(intrin->src[0].is_ssa);
 
-            nir_alu_instr *mov;
-            if (intrin->has_predicate) {
-               mov = nir_alu_instr_create(state->mem_ctx, nir_op_bcsel);
-               mov->src[0].src = nir_src_copy(intrin->predicate,
-                                              state->mem_ctx);
-               /* Splat the condition to all channels */
-               memset(mov->src[0].swizzle, 0, sizeof mov->src[0].swizzle);
-
-               mov->src[1].src.is_ssa = true;
-               mov->src[1].src.ssa = intrin->src[0].ssa;
-               for (unsigned i = intrin->num_components; i < 4; i++)
-                  mov->src[1].swizzle[i] = 0;
-
-               mov->src[2].src.is_ssa = true;
-               mov->src[2].src.ssa = get_ssa_def_for_block(node, block, state);
-               for (unsigned i = intrin->num_components; i < 4; i++)
-                  mov->src[2].swizzle[i] = 0;
-
-            } else {
-               mov = nir_alu_instr_create(state->mem_ctx, nir_op_imov);
-
-               mov->src[0].src.is_ssa = true;
-               mov->src[0].src.ssa = intrin->src[0].ssa;
-               for (unsigned i = intrin->num_components; i < 4; i++)
-                  mov->src[0].swizzle[i] = 0;
-            }
+            nir_alu_instr *mov = nir_alu_instr_create(state->mem_ctx,
+                                                      nir_op_imov);
+            mov->src[0].src.is_ssa = true;
+            mov->src[0].src.ssa = intrin->src[0].ssa;
+            for (unsigned i = intrin->num_components; i < 4; i++)
+               mov->src[0].swizzle[i] = 0;
 
             mov->dest.write_mask = (1 << intrin->num_components) - 1;
             mov->dest.dest.is_ssa = true;
diff --git a/src/glsl/nir/nir_opt_copy_propagate.c b/src/glsl/nir/nir_opt_copy_propagate.c
index 1f81b17..8771405 100644
--- a/src/glsl/nir/nir_opt_copy_propagate.c
+++ b/src/glsl/nir/nir_opt_copy_propagate.c
@@ -256,10 +256,6 @@ copy_prop_instr(nir_instr *instr)
          while (copy_prop_alu_src(alu_instr, i))
             progress = true;
 
-      if (alu_instr->has_predicate)
-         while (copy_prop_src(&alu_instr->predicate, instr, NULL))
-            progress = true;
-
       if (!alu_instr->dest.dest.is_ssa && alu_instr->dest.dest.reg.indirect)
          while (copy_prop_src(alu_instr->dest.dest.reg.indirect, instr, NULL))
             progress = true;
diff --git a/src/glsl/nir/nir_opt_cse.c b/src/glsl/nir/nir_opt_cse.c
index 14bd6bf..0ad575c 100644
--- a/src/glsl/nir/nir_opt_cse.c
+++ b/src/glsl/nir/nir_opt_cse.c
@@ -67,13 +67,6 @@ nir_instrs_equal(nir_instr *instr1, nir_instr *instr2)
       if (alu1->op != alu2->op)
          return false;
 
-      if (alu1->has_predicate != alu2->has_predicate)
-         return false;
-
-      if (alu1->has_predicate &&
-          !nir_srcs_equal(alu1->predicate, alu2->predicate))
-         return false;
-
       /* TODO: We can probably acutally do something more inteligent such
        * as allowing different numbers and taking a maximum or something
        * here */
diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c
index 67df9a5..42fb3af 100644
--- a/src/glsl/nir/nir_print.c
+++ b/src/glsl/nir/nir_print.c
@@ -178,12 +178,6 @@ print_alu_dest(nir_alu_dest *dest, FILE *fp)
 static void
 print_alu_instr(nir_alu_instr *instr, FILE *fp)
 {
-   if (instr->has_predicate) {
-      fprintf(fp, "(");
-      print_src(&instr->predicate, fp);
-      fprintf(fp, ") ");
-   }
-
    print_alu_dest(&instr->dest, fp);
 
    fprintf(fp, " = %s", nir_op_infos[instr->op].name);
@@ -328,12 +322,6 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_var_state *state,
 {
    unsigned num_srcs = nir_intrinsic_infos[instr->intrinsic].num_srcs;
 
-   if (instr->has_predicate) {
-      fprintf(fp, "(");
-      print_src(&instr->predicate, fp);
-      fprintf(fp, ") ");
-   }
-
    if (nir_intrinsic_infos[instr->intrinsic].has_dest) {
       print_dest(&instr->dest, fp);
       fprintf(fp, " = ");
@@ -385,12 +373,6 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_var_state *state,
 static void
 print_tex_instr(nir_tex_instr *instr, print_var_state *state, FILE *fp)
 {
-   if (instr->has_predicate) {
-      fprintf(fp, "(");
-      print_src(&instr->predicate, fp);
-      fprintf(fp, ") ");
-   }
-
    print_dest(&instr->dest, fp);
 
    fprintf(fp, " = ");
@@ -510,12 +492,6 @@ print_tex_instr(nir_tex_instr *instr, print_var_state *state, FILE *fp)
 static void
 print_call_instr(nir_call_instr *instr, print_var_state *state, FILE *fp)
 {
-   if (instr->has_predicate) {
-      fprintf(fp, "(");
-      print_src(&instr->predicate, fp);
-      fprintf(fp, ") ");
-   }
-
    fprintf(fp, "call %s ", instr->callee->function->name);
 
    for (unsigned i = 0; i < instr->num_params; i++) {
@@ -560,12 +536,6 @@ print_const_value(nir_const_value value, unsigned num_components, FILE *fp)
 static void
 print_load_const_instr(nir_load_const_instr *instr, unsigned tabs, FILE *fp)
 {
-   if (instr->has_predicate) {
-      fprintf(fp, "(");
-      print_src(&instr->predicate, fp);
-      fprintf(fp, ") ");
-   }
-
    print_dest(&instr->dest, fp);
 
    fprintf(fp, " = load_const ");
diff --git a/src/glsl/nir/nir_split_var_copies.c b/src/glsl/nir/nir_split_var_copies.c
index 19724b6..70ce30a 100644
--- a/src/glsl/nir/nir_split_var_copies.c
+++ b/src/glsl/nir/nir_split_var_copies.c
@@ -131,12 +131,6 @@ nir_split_var_copy_instr(nir_intrinsic_instr *old_copy,
          nir_intrinsic_instr *new_copy =
             nir_intrinsic_instr_create(state->mem_ctx, nir_intrinsic_copy_var);
 
-         if (old_copy->has_predicate) {
-            new_copy->has_predicate = true;
-            new_copy->predicate = nir_src_copy(old_copy->predicate,
-                                               state->mem_ctx);
-         }
-
          nir_deref *src = nir_copy_deref(state->mem_ctx, src_head);
          nir_deref *dest = nir_copy_deref(state->mem_ctx, dest_head);
 
diff --git a/src/glsl/nir/nir_to_ssa.c b/src/glsl/nir/nir_to_ssa.c
index 87305f2..01297e6 100644
--- a/src/glsl/nir/nir_to_ssa.c
+++ b/src/glsl/nir/nir_to_ssa.c
@@ -148,9 +148,6 @@ typedef struct {
 
    /* map from SSA value -> original register */
    struct hash_table *ssa_map;
-
-   /* predicate for this instruction */
-   nir_src *predicate;
 } rewrite_state;
 
 static nir_ssa_def *get_ssa_src(nir_register *reg, rewrite_state *state)
@@ -220,27 +217,6 @@ rewrite_def_forwards(nir_dest *dest, void *_state)
    if (state->states[index].stack == NULL)
       return true;
 
-   nir_alu_instr *csel = NULL;
-   if (state->predicate) {
-         /*
-          * To capture the information that we may or may not overwrite this
-          * register due to the predicate, we need to emit a conditional select
-          * that takes the old version of the register and the new version.
-          * This is basically a watered-down version of the Psi-SSA
-          * representation, without any of the optimizations.
-          *
-          * TODO: do we actually need full-blown Psi-SSA?
-          */
-      csel = nir_alu_instr_create(state->mem_ctx, nir_op_bcsel);
-      csel->dest.dest.reg.reg = dest->reg.reg;
-      csel->dest.write_mask = (1 << dest->reg.reg->num_components) - 1;
-      csel->src[0].src = nir_src_copy(*state->predicate, state->mem_ctx);
-      /* Splat the condition to all channels */
-      memset(csel->src[0].swizzle, 0, sizeof csel->src[0].swizzle);
-      csel->src[2].src.is_ssa = true;
-      csel->src[2].src.ssa = get_ssa_src(dest->reg.reg, state);
-   }
-
    dest->is_ssa = true;
 
    char *name = NULL;
@@ -260,21 +236,6 @@ rewrite_def_forwards(nir_dest *dest, void *_state)
    _mesa_hash_table_insert(state->ssa_map, _mesa_hash_pointer(&dest->ssa),
                            &dest->ssa, reg);
 
-   if (state->predicate) {
-      csel->src[1].src.is_ssa = true;
-      csel->src[1].src.ssa = &dest->ssa;
-
-      nir_instr *old_parent_instr = state->parent_instr;
-      nir_src *old_predicate = state->predicate;
-      state->parent_instr = &csel->instr;
-      state->predicate = NULL;
-      rewrite_def_forwards(&csel->dest.dest, state);
-      state->parent_instr = old_parent_instr;
-      state->predicate = old_predicate;
-
-      nir_instr_insert_after(state->parent_instr, &csel->instr);
-   }
-
    return true;
 }
 
@@ -282,7 +243,6 @@ static void
 rewrite_alu_instr_forward(nir_alu_instr *instr, rewrite_state *state)
 {
    state->parent_instr = &instr->instr;
-   state->predicate = instr->has_predicate ? &instr->predicate : NULL;
 
    nir_foreach_src(&instr->instr, rewrite_use, state);
 
@@ -384,14 +344,9 @@ rewrite_alu_instr_forward(nir_alu_instr *instr, rewrite_state *state)
          }
       }
 
-      vec->has_predicate = instr->has_predicate;
-      if (instr->has_predicate)
-         vec->predicate = nir_src_copy(instr->predicate, state->mem_ctx);
-
       nir_instr_insert_after(&instr->instr, &vec->instr);
 
       state->parent_instr = &vec->instr;
-      state->predicate = vec->has_predicate ? &vec->predicate : NULL;
       rewrite_def_forwards(&vec->dest.dest, state);
    } else {
       rewrite_def_forwards(&instr->dest.dest, state);
@@ -402,54 +357,9 @@ static void
 rewrite_phi_instr(nir_phi_instr *instr, rewrite_state *state)
 {
    state->parent_instr = &instr->instr;
-   state->predicate = NULL;
    rewrite_def_forwards(&instr->dest, state);
 }
 
-static nir_src *
-get_instr_predicate(nir_instr *instr)
-{
-   nir_alu_instr *alu_instr;
-   nir_load_const_instr *load_const_instr;
-   nir_intrinsic_instr *intrinsic_instr;
-   nir_tex_instr *tex_instr;
-
-   switch (instr->type) {
-   case nir_instr_type_alu:
-      alu_instr = nir_instr_as_alu(instr);
-      if (alu_instr->has_predicate)
-         return &alu_instr->predicate;
-      else
-         return NULL;
-
-   case nir_instr_type_load_const:
-      load_const_instr = nir_instr_as_load_const(instr);
-      if (load_const_instr->has_predicate)
-         return &load_const_instr->predicate;
-      else
-         return NULL;
-
-   case nir_instr_type_intrinsic:
-      intrinsic_instr = nir_instr_as_intrinsic(instr);
-      if (intrinsic_instr->has_predicate)
-         return &intrinsic_instr->predicate;
-      else
-         return NULL;
-
-   case nir_instr_type_tex:
-      tex_instr = nir_instr_as_tex(instr);
-      if (tex_instr->has_predicate)
-         return &tex_instr->predicate;
-      else
-         return NULL;
-
-   default:
-      break;
-   }
-
-   return NULL;
-}
-
 static void
 rewrite_instr_forward(nir_instr *instr, rewrite_state *state)
 {
@@ -464,7 +374,6 @@ rewrite_instr_forward(nir_instr *instr, rewrite_state *state)
    }
 
    state->parent_instr = instr;
-   state->predicate = get_instr_predicate(instr);
 
    nir_foreach_src(instr, rewrite_use, state);
    nir_foreach_dest(instr, rewrite_def_forwards, state);
@@ -581,35 +490,7 @@ init_rewrite_state(nir_function_impl *impl, rewrite_state *state)
           * called after phi nodes are inserted so we can count phi node
           * definitions too.
           */
-         unsigned stack_size = 0;
-         struct set_entry *entry;
-         set_foreach(reg->defs, entry) {
-            nir_instr *def = (nir_instr *) entry->key;
-
-            stack_size++;
-
-            /*
-             * predicates generate an additional predicate destination that
-             * gets pushed on the stack
-             *
-             * Note: ALU instructions generate an additional instruction too,
-             * but as of now only the additional instruction is pushed onto
-             * the stack, and not the original instruction because it doesn't
-             * need to be (actually, we could do the same with predicates,
-             * but it was easier to just use the existing codepath).
-             */
-
-            if (def->type == nir_instr_type_intrinsic) {
-               nir_intrinsic_instr *intrinsic_instr =
-                  nir_instr_as_intrinsic(def);
-               if (nir_intrinsic_infos[intrinsic_instr->intrinsic].has_dest &&
-                   intrinsic_instr->has_predicate)
-                  stack_size++;
-            } else {
-               if (get_instr_predicate(def) != NULL)
-                  stack_size++;
-            }
-         }
+         unsigned stack_size = reg->defs->entries;
 
          state->states[reg->index].stack = ralloc_array(state->states,
                                                         nir_ssa_def *,
diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c
index ed6e482..71bc9f6 100644
--- a/src/glsl/nir/nir_validate.c
+++ b/src/glsl/nir/nir_validate.c
@@ -259,9 +259,6 @@ validate_alu_instr(nir_alu_instr *instr, validate_state *state)
    for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++) {
       validate_alu_src(instr, i, state);
    }
-
-   if (instr->has_predicate)
-      validate_src(&instr->predicate, state);
 }
 
 static void
@@ -379,9 +376,6 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
    default:
       break;
    }
-
-   if (instr->has_predicate)
-      validate_src(&instr->predicate, state);
 }
 
 static void
@@ -422,9 +416,6 @@ validate_call_instr(nir_call_instr *instr, validate_state *state)
    }
 
    validate_deref_var(instr->return_deref, state);
-
-   if (instr->has_predicate)
-      validate_src(&instr->predicate, state);
 }
 
 static void
@@ -437,9 +428,6 @@ validate_load_const_instr(nir_load_const_instr *instr, validate_state *state)
       assert(instr->dest.reg.base_offset + instr->array_elems <=
              instr->dest.reg.reg->num_array_elems);
    }
-
-   if (instr->has_predicate)
-      validate_src(&instr->predicate, state);
 }
 
 static void
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 78636ab..04e09be 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -428,17 +428,8 @@ fs_visitor::nir_emit_alu(nir_alu_instr *instr)
    struct brw_wm_prog_key *fs_key = (struct brw_wm_prog_key *) this->key;
 
    fs_reg op[3];
-   fs_reg dest = get_nir_dest(instr->dest.dest);
-   dest.type = brw_type_for_nir_type(nir_op_infos[instr->op].output_type);
-
-   fs_reg result;
-   if (instr->has_predicate) {
-      result = fs_reg(GRF, virtual_grf_alloc(4));
-      result.type = dest.type;
-   } else {
-      result = dest;
-   }
-
+   fs_reg result = get_nir_dest(instr->dest.dest);
+   result.type = brw_type_for_nir_type(nir_op_infos[instr->op].output_type);
 
    for (unsigned i = 0; i < nir_op_infos[instr->op].num_inputs; i++)
       op[i] = get_nir_alu_src(instr, i);
@@ -978,17 +969,6 @@ fs_visitor::nir_emit_alu(nir_alu_instr *instr)
    default:
       unreachable("unhandled instruction");
    }
-
-   /* emit a predicated move if there was predication */
-   if (instr->has_predicate) {
-      fs_inst *inst = emit(MOV(reg_null_d,
-                               retype(get_nir_src(instr->predicate),
-                                   BRW_REGISTER_TYPE_UD)));
-      inst->conditional_mod = BRW_CONDITIONAL_NZ;
-      inst = MOV(dest, result);
-      inst->predicate = BRW_PREDICATE_NORMAL;
-      emit_percomp(inst, instr->dest.write_mask);
-   }
 }
 
 fs_reg
@@ -1232,12 +1212,6 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
    fs_reg dest;
    if (nir_intrinsic_infos[instr->intrinsic].has_dest)
       dest = get_nir_dest(instr->dest);
-   if (instr->has_predicate) {
-      fs_inst *inst = emit(MOV(reg_null_d,
-                               retype(get_nir_src(instr->predicate),
-                                      BRW_REGISTER_TYPE_UD)));
-      inst->conditional_mod = BRW_CONDITIONAL_NZ;
-   }
 
    bool has_indirect = false;
 
@@ -1304,10 +1278,7 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
       fs_reg reg = fs_reg(retype(brw_vec8_grf(payload.sample_mask_in_reg, 0),
                           BRW_REGISTER_TYPE_D));
       dest.type = reg.type;
-      fs_inst *inst = MOV(dest, reg);
-      if (instr->has_predicate)
-         inst->predicate = BRW_PREDICATE_NORMAL;
-      emit(inst);
+      emit(MOV(dest, reg));
       break;
    }
 
@@ -1339,10 +1310,7 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
             src.type = dest.type;
             index++;
 
-            fs_inst *inst = MOV(dest, src);
-            if (instr->has_predicate)
-               inst->predicate = BRW_PREDICATE_NORMAL;
-            emit(inst);
+            emit(MOV(dest, src));
             dest.reg_offset++;
          }
       }
@@ -1384,16 +1352,9 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
                   fs_reg(2)));
 
          unsigned vec4_offset = instr->const_index[0] / 4;
-         for (int i = 0; i < instr->num_components; i++) {
-            exec_list list = VARYING_PULL_CONSTANT_LOAD(offset(dest, i),
-                                                        surf_index, base_offset,
-                                                        vec4_offset + i);
-
-            fs_inst *last_inst = (fs_inst *) list.get_tail();
-            if (instr->has_predicate)
-                  last_inst->predicate = BRW_PREDICATE_NORMAL;
-            emit(list);
-         }
+         for (int i = 0; i < instr->num_components; i++)
+            emit(VARYING_PULL_CONSTANT_LOAD(offset(dest, i), surf_index,
+                                            base_offset, vec4_offset + i));
       } else {
          fs_reg packed_consts = fs_reg(this, glsl_type::float_type);
          packed_consts.type = dest.type;
@@ -1410,11 +1371,7 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
              */
             assert(packed_consts.subreg_offset < 32);
 
-            fs_inst *inst = MOV(dest, packed_consts);
-            if (instr->has_predicate)
-                  inst->predicate = BRW_PREDICATE_NORMAL;
-            emit(inst);
-
+            emit(MOV(dest, packed_consts));
             dest.reg_offset++;
          }
       }
@@ -1434,10 +1391,7 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
             src.type = dest.type;
             index++;
 
-            fs_inst *inst = MOV(dest, src);
-            if (instr->has_predicate)
-               inst->predicate = BRW_PREDICATE_NORMAL;
-            emit(inst);
+            emit(MOV(dest, src));
             dest.reg_offset++;
          }
       }
@@ -1538,9 +1492,7 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
          fs_reg src = interp_reg(instr->variables[0]->var->data.location, j);
          src.type = dest.type;
 
-         fs_inst *inst = emit(FS_OPCODE_LINTERP, dest, dst_x, dst_y, src);
-         if (instr->has_predicate)
-            inst->predicate = BRW_PREDICATE_NORMAL;
+         emit(FS_OPCODE_LINTERP, dest, dst_x, dst_y, src);
          dest.reg_offset++;
       }
       break;
@@ -1559,10 +1511,7 @@ fs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
                src.reladdr = new(mem_ctx) fs_reg(get_nir_src(instr->src[1]));
             new_dest.type = src.type;
             index++;
-            fs_inst *inst = MOV(new_dest, src);
-            if (instr->has_predicate)
-               inst->predicate = BRW_PREDICATE_NORMAL;
-            emit(inst);
+            emit(MOV(new_dest, src));
             src.reg_offset++;
          }
       }
-- 
2.2.0



More information about the mesa-dev mailing list