https://bugs.llvm.org/show_bug.cgi?id=37388

            Bug ID: 37388
           Summary: Logic operations on AVX512 __mmask16 do not generate
                    appropriate instructions
           Product: libraries
           Version: 6.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedb...@nondot.org
          Reporter: fabi...@radgametools.com
                CC: llvm-bugs@lists.llvm.org

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".

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to