[llvm-bugs] [Bug 49933] New: Missed SLP vectorization

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 12 05:47:52 PDT 2021


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

            Bug ID: 49933
           Summary: Missed SLP vectorization
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

typedef unsigned char uint8_t;

static inline uint8_t bar( uint8_t x )
{
  return x&(~63) ? -x : x;
}


void foo( uint8_t *__restrict dst, uint8_t *__restrict src)
{

        for( int x = 0; x < 8; x++ )
            dst[x] = bar(src[x]);
}



ICC:
foo(unsigned char*, unsigned char*):
        vpmovzxbd ymm2, QWORD PTR [rsi]                         #5.25
        vpand     ymm0, ymm2, YMMWORD PTR .L_2il0floatpacket.0[rip] #5.12
        vpxor     ymm1, ymm1, ymm1                              #5.25
        vptestmd  k1, ymm0, ymm0                                #5.12
        vpsubd    ymm2{k1}, ymm1, ymm2                          #5.25
        vpmovdb   QWORD PTR [rdi], ymm2                         #13.6
        vzeroupper                                              #14.1
        ret    

LLVM does not vectorize it with avx/avx2/avx512 - cost model issue?

https://godbolt.org/z/Kheeec4cG

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210412/c48fa2f5/attachment.html>


More information about the llvm-bugs mailing list