<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - i965/fs generates slow code for vector comparisons"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=77456">77456</a>
          </td>
        </tr>

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

        <tr>
          <th>Summary</th>
          <td>i965/fs generates slow code for vector comparisons
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>intel-3d-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mattst88@gmail.com
          </td>
        </tr>

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

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

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

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

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=97371" name="attach_97371" title="t.shader_test">attachment 97371</a> <a href="attachment.cgi?id=97371&action=edit" title="t.shader_test">[details]</a></span>
t.shader_test

The fragment shader runs in scalar mode, so to do vec4 comparisons we generate
multiple compares and join them together using and or ors, depending on the
comparison.

INTEL_DEBUG=fs,no16 bin/shader_runner t.shader_test -auto

generates:

      cmp.e.f0(8)     g3<1>D          g2.3<0,1,0>F    g2.7<0,1,0>F
      cmp.e.f0(8)     g4<1>D          g2.2<0,1,0>F    g2.6<0,1,0>F
      cmp.e.f0(8)     g5<1>D          g2.1<0,1,0>F    g2.5<0,1,0>F
      cmp.e.f0(8)     g6<1>D          g2<0,1,0>F      g2.4<0,1,0>F
      and(8)          g7<1>D          g5<8,8,1>D      g6<8,8,1>D
      and(8)          g8<1>D          g4<8,8,1>D      g7<8,8,1>D
      and(8)          g9<1>D          g3<8,8,1>D      g8<8,8,1>D
      and.ne.f0(8)    null            g9<8,8,1>D      1D        
...
(+f0) sel ...

We could have just predicated all but the first cmp instruction and skipped the
and instructions completely:

      cmp.e.f0(8)     g3<1>D          g2.3<0,1,0>F    g2.7<0,1,0>F
(+f0) cmp.e.f0(8)     g4<1>D          g2.2<0,1,0>F    g2.6<0,1,0>F
(+f0) cmp.e.f0(8)     g5<1>D          g2.1<0,1,0>F    g2.5<0,1,0>F
(+f0) cmp.e.f0(8)     g6<1>D          g2<0,1,0>F      g2.4<0,1,0>F
...
(+f0) sel ...

I think a similar thing can be done for !=, where the join operation is or.</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>