<div dir="ltr"><div>Unless I'm missing something, this series doesn't contain anything that uses this patch.  Let's drop it for now and put it in with whatever adds the actual nir_opt_algebraic changes.<br><br></div>Another option would be to silently bail if nir_search tries to create an expression where the opcode has an explicit bit size and it doesn't match the bit size that it needs.  I'm not sure what the best thing to do is.  I'll think on it.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 31, 2016 at 3:00 AM, Samuel Iglesias Gonsálvez <span dir="ltr"><<a href="mailto:siglesias@igalia.com" target="_blank">siglesias@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Some instructions (like flrp in i965) cannot be lowered depending on the<br>
bit size because it doesn't support all bit sizes.<br>
<br>
If the bit size field is defined in nir_opt_algebraic.py, take it into<br>
account.<br>
<br>
Signed-off-by: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>><br>
---<br>
 src/compiler/nir/nir_algebraic.py | 11 ++++++++++-<br>
 1 file changed, 10 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py<br>
</span>index d05564f..9c679ac 100644<br>
--- a/src/compiler/nir/nir_algebraic.py<br>
+++ b/src/compiler/nir/nir_algebraic.py<br>
@@ -180,6 +180,11 @@ class SearchAndReplace(object):<br>
<span class="">       else:<br>
          self.condition = 'true'<br>
<br>
+      if len(transform) > 3:<br>
+         self.bit_size = transform[3]<br>
+      else:<br>
+         self.bit_size = 0<br>
+<br>
       if self.condition not in condition_list:<br>
          condition_list.append(self.condition)<br>
       self.condition_index = condition_list.index(self.condition)<br>
</span>@@ -208,6 +213,7 @@ struct transform {<br>
<span class="">    const nir_search_expression *search;<br>
    const nir_search_value *replace;<br>
    unsigned condition_offset;<br>
+   unsigned bit_size;<br>
 };<br>
<br>
 struct opt_state {<br>
</span>@@ -226,7 +232,7 @@ struct opt_state {<br>
<span class=""><br>
 static const struct transform ${pass_name}_${opcode}_xforms[] = {<br>
 % for xform in xform_list:<br>
-   { &${<a href="http://xform.search.name" rel="noreferrer" target="_blank">xform.search.name</a>}, ${xform.replace.c_ptr}, ${xform.condition_index} },<br>
+   { &${<a href="http://xform.search.name" rel="noreferrer" target="_blank">xform.search.name</a>}, ${xform.replace.c_ptr}, ${xform.condition_index}, ${xform.bit_size}},<br>
 % endfor<br>
 };<br>
 % endfor<br>
</span>@@ -249,6 +255,9 @@ ${pass_name}_block(nir_block *block, void *void_state)<br>
<div class="HOEnZb"><div class="h5">       case nir_op_${opcode}:<br>
          for (unsigned i = 0; i < ARRAY_SIZE(${pass_name}_${opcode}_xforms); i++) {<br>
             const struct transform *xform = &${pass_name}_${opcode}_xforms[i];<br>
+            if (xform->bit_size != 0 &&<br>
+                alu->dest.dest.ssa.bit_size != xform->bit_size)<br>
+               continue;<br>
             if (state->condition_flags[xform->condition_offset] &&<br>
                 nir_replace_instr(alu, xform->search, xform->replace,<br>
                                   state->mem_ctx)) {<br>
--<br>
2.5.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div>