<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] Failure to flip VPBLENDVB inputs with an inverted selection mask"
   href="https://bugs.llvm.org/show_bug.cgi?id=42825">42825</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86][SSE] Failure to flip VPBLENDVB inputs with an inverted selection mask
          </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>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Current Codegen: <a href="https://godbolt.org/z/hseT6Z">https://godbolt.org/z/hseT6Z</a>

__m128i sel2(__m128i x, __m128i y, __m128i s) {
    return _mm_blendv_epi8(x, y, _mm_xor_si128(s, _mm_set1_epi32(-1)));
}

clang -g0 -O3 -march=btver2

define <2 x i64> @_Z4sel2Dv2_xS_S_(<2 x i64>, <2 x i64>, <2 x i64>) {
  %4 = bitcast <2 x i64> %0 to <16 x i8>
  %5 = bitcast <2 x i64> %1 to <16 x i8>
  %6 = bitcast <2 x i64> %2 to <16 x i8>
  %7 = xor <16 x i8> %6, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8
-1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>
  %8 = tail call <16 x i8> @llvm.x86.sse41.pblendvb(<16 x i8> %4, <16 x i8> %5,
<16 x i8> %7) #2
  %9 = bitcast <16 x i8> %8 to <2 x i64>
  ret <2 x i64> %9
}

_Z4sel2Dv2_xS_S_:
  vpcmpeqd %xmm3, %xmm3, %xmm3
  vpxor %xmm3, %xmm2, %xmm2
  vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
  retq

we should be able to flip the inputs and remove the selection mask inversion:

_Z4sel2Dv2_xS_S_:
  vpblendvb %xmm2, %xmm0, %xmm1, %xmm0
  retq</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>