<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Add a NIR pass to lower indirects to conditional load/store operations."
   href="https://bugs.freedesktop.org/show_bug.cgi?id=92929">92929</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Add a NIR pass to lower indirects to conditional load/store operations.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>glsl-compiler
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>idr@freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jason@jlekstrand.net
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>One of the things that NIR is currently missing is a pass to lower indirect
load/store operations to if-ladders.  For example, an indirect load on a
5-element array would be rewritten as

if (i < 2) {
    if (i < 1) {
        a = foo[0];
    } else {
        b = foo[1];
    }
    c = phi(a, b);
} else {
    if (i < 3) {
        d = foo[2];
    } else {
        if (i < 4) {
            e = foo[3];
        } else {
            f = foo[4];
        }
        g = phi(e, f);
    }
    h = phi(d, g);
}
result = phi(c, h);

where the if-ladder effectively does a binary search over the space of possible
indirect values.  Implementing this shouldn't be terribly hard from a compiler
theory perspective; it's mostly an exercise in recursion.  Lots of recursion...</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>