nir: define behavior of nir_op_bfm and nir_op_u/ibfe according to SM5 spec.
[mesa.git] / src / compiler / nir / nir_opt_copy_prop_vars.c
index 94bc8affd9e831edc11ecf69eb36cfa907d85e84..a1c8ffabf7a519ae5eacec646a20d91e147250ea 100644 (file)
@@ -433,9 +433,7 @@ load_element_from_ssa_entry_value(struct copy_prop_var_state *state,
                                   nir_builder *b, nir_intrinsic_instr *intrin,
                                   struct value *value, unsigned index)
 {
-   const struct glsl_type *type = entry->dst->type;
-   unsigned num_components = glsl_get_vector_elements(type);
-   assert(index < num_components);
+   assert(index < glsl_get_vector_elements(entry->dst->type));
 
    /* We don't have the element available, so let the instruction do the work. */
    if (!entry->src.ssa.def[index])
@@ -814,6 +812,9 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
       case nir_intrinsic_load_deref: {
          if (debug) dump_instr(instr);
 
+         if (nir_intrinsic_access(intrin) & ACCESS_VOLATILE)
+            break;
+
          nir_deref_instr *src = nir_src_as_deref(intrin->src[0]);
 
          /* Direct array_derefs of vectors operate on the vectors (the parent
@@ -894,6 +895,9 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
       case nir_intrinsic_store_deref: {
          if (debug) dump_instr(instr);
 
+         if (nir_intrinsic_access(intrin) & ACCESS_VOLATILE)
+            break;
+
          nir_deref_instr *dst = nir_src_as_deref(intrin->src[0]);
          assert(glsl_type_is_vector_or_scalar(dst->type));
 
@@ -938,6 +942,10 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
       case nir_intrinsic_copy_deref: {
          if (debug) dump_instr(instr);
 
+         if ((nir_intrinsic_src_access(intrin) & ACCESS_VOLATILE) ||
+             (nir_intrinsic_dst_access(intrin) & ACCESS_VOLATILE))
+            break;
+
          nir_deref_instr *dst = nir_src_as_deref(intrin->src[0]);
          nir_deref_instr *src = nir_src_as_deref(intrin->src[1]);
 
@@ -1007,6 +1015,9 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
       case nir_intrinsic_deref_atomic_comp_swap:
          if (debug) dump_instr(instr);
 
+         if (nir_intrinsic_access(intrin) & ACCESS_VOLATILE)
+            break;
+
          nir_deref_instr *dst = nir_src_as_deref(intrin->src[0]);
          unsigned num_components = glsl_get_vector_elements(dst->type);
          unsigned full_mask = (1 << num_components) - 1;