<html>
    <head>
      <base href="https://bugs.llvm.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 - [X86][SSE] BLENDV Simplification to AND/ANDN"
   href="https://bugs.llvm.org/show_bug.cgi?id=38814">38814</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86][SSE] BLENDV Simplification to AND/ANDN
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

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

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>andrea.dibiagio@gmail.com, craig.topper@gmail.com, llvm-bugs@lists.llvm.org, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In cases where the _mm_blendv_* intrinsics are used with zero/allbits
true/false operands it'd be better to simplify to and/andnot bit operations if
we know the select operand is 'all sign bits'.

This might be even worth it for any true/false operands but we sometimes fail
to convert this back to VSELECT.

<a href="https://gcc.godbolt.org/z/K_7Zd9">https://gcc.godbolt.org/z/K_7Zd9</a>

__m128 sel_v4f32(__m128 *x, __m128 y, __m128 z) {
    return _mm_blendv_ps(*x, _mm_setzero_ps(), _mm_cmpgt_ps(y, z));
}

_Z9sel_v4f32PDv4_fS_S_:
  vmovaps (%rdi), %xmm2
  vcmpltps %xmm0, %xmm1, %xmm0
  vxorps %xmm1, %xmm1, %xmm1
  vblendvps %xmm0, %xmm1, %xmm2, %xmm0
  retq

But could be just vcmpps + vandps/vandnps, allowing further combines,
commutation etc.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>