[llvm-bugs] [Bug 47623] New: [SLP] Missing vectorization

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 23 04:11:12 PDT 2020


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

            Bug ID: 47623
           Summary: [SLP] Missing 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

int a[8], b[8];

void foo(void)
{
  a[0] = b[0];
  a[1] = b[2];
  a[2] = b[0];
  a[3] = b[2];
  a[4] = b[0];
  a[5] = b[2];
  a[6] = b[0];
  a[7] = b[2];
}

Clang:
foo():                                # @foo()
        mov     eax, dword ptr [rip + b]
        mov     dword ptr [rip + a], eax
        mov     ecx, dword ptr [rip + b+8]
        mov     dword ptr [rip + a+4], ecx
        mov     dword ptr [rip + a+8], eax
        mov     dword ptr [rip + a+12], ecx
        mov     dword ptr [rip + a+16], eax
        mov     dword ptr [rip + a+20], ecx
        mov     dword ptr [rip + a+24], eax
        mov     dword ptr [rip + a+28], ecx
        ret
a:
        .zero   32

b:
        .zero   32

GCC:
foo():
        movd    xmm0, DWORD PTR b[rip]
        movd    xmm1, DWORD PTR b[rip+8]
        punpckldq       xmm0, xmm1
        punpcklqdq      xmm0, xmm0
        movaps  XMMWORD PTR a[rip], xmm0
        movaps  XMMWORD PTR a[rip+16], xmm0
        ret
b:
        .zero   32
a:
        .zero   32


https://godbolt.org/z/nosYfb

-- 
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/20200923/f8574011/attachment.html>


More information about the llvm-bugs mailing list