[llvm-bugs] [Bug 49934] New: Missed SLP vectorization with AND op with constant

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


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

            Bug ID: 49934
           Summary: Missed SLP vectorization with AND op with constant
           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

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

        for( int x = 0; x < 8; x++ ){
        dst[x] = src[x]&(~63);
    }
}

LLVM -O3
baz(unsigned char*, unsigned char*):                             #
@baz(unsigned char*, unsigned char*)
        mov     al, byte ptr [rsi]
        and     al, -64
        mov     byte ptr [rdi], al
        mov     al, byte ptr [rsi + 1]
        and     al, -64
        mov     byte ptr [rdi + 1], al
        mov     al, byte ptr [rsi + 2]
        and     al, -64
        mov     byte ptr [rdi + 2], al
        mov     al, byte ptr [rsi + 3]
        and     al, -64
        mov     byte ptr [rdi + 3], al
        mov     al, byte ptr [rsi + 4]
        and     al, -64
        mov     byte ptr [rdi + 4], al
        mov     al, byte ptr [rsi + 5]
        and     al, -64
        mov     byte ptr [rdi + 5], al
        mov     al, byte ptr [rsi + 6]
        and     al, -64
        mov     byte ptr [rdi + 6], al
        mov     al, byte ptr [rsi + 7]
        and     al, -64
        mov     byte ptr [rdi + 7], al
        ret

ICC/GCC:
baz(unsigned char*, unsigned char*):
        vmovq   xmm0, QWORD PTR [rsi]
        vmovq   xmm1, QWORD PTR .LC0[rip]
        vpand   xmm0, xmm0, xmm1
        vmovq   QWORD PTR [rdi], xmm0
        ret


https://godbolt.org/z/on8TanTa8

-- 
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/1459c802/attachment-0001.html>


More information about the llvm-bugs mailing list