<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 - Logic operations on AVX512 __mmask16 do not generate appropriate instructions"
   href="https://bugs.llvm.org/show_bug.cgi?id=37388">37388</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Logic operations on AVX512 __mmask16 do not generate appropriate instructions
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>6.0
          </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>fabiang@radgametools.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Test case:

// ---- begin
#include <immintrin.h>

extern "C" void f(void *p, __m512i a, __m512i b, __m512i c, __m512i d)
{
    __mmask16 mask1 = _mm512_test_epi32_mask(a, b);
    __mmask16 mask2 = _mm512_cmple_epu32_mask(c, d);
    __mmask16 mask3 = mask1 & ~mask2;
    _mm512_mask_storeu_epi32(p, mask3, a);
}
// ---- end

compiled with 6.0 release "clang-cl -c -O2 -FA avx512_logic.cpp -mavx512f" (the
equivalent should work with the gcc-compatible drivers too, nothing
MSVC-specific in here) produces:

# ---- begin
f:                                      # @f
# %bb.0:
        movq    40(%rsp), %rax
        vmovdqa32       (%rdx), %zmm0
        vptestmd        (%r8), %zmm0, %k0
        kmovw   %k0, %edx
        vmovdqa32       (%r9), %zmm1
        vpcmpleud       (%rax), %zmm1, %k0
        kmovw   %k0, %eax
        notl    %eax
        andl    %edx, %eax
        kmovw   %eax, %k1
        vmovdqu32       %zmm0, (%rcx) {%k1}
        vzeroupper
        retq
# ---- end

expected: the kmovw/notl/andl/kmovw sequence should instead be a single "kandnw
%k1, %k0, %k1".</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>