[LLVMbugs] [Bug 19657] New: [SLP vectorization] scalar loads not combined into vector load

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 5 14:03:52 PDT 2014


            Bug ID: 19657
           Summary: [SLP vectorization] scalar loads not combined into
                    vector load
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ ./clang -v 
clang version 3.5.0 (207996)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

On the following C code that multiplies and adds 4 double-precision array
$ cat vmul.c
void foo(double *x) {
    x[0] = x[0] * x[0] + x[0];
    x[1] = x[1] * x[1] + x[1];
    x[2] = x[2] * x[2] + x[2];
    x[3] = x[3] * x[3] + x[3];

The generated code contains scalar loads for x[2] and x[3], but all other
operations are vectorized. It would be better in size and speed to optimize the
scalar loads into a single vector load:

$ ./clang -O2 -S -o - vmul.c -march=btver2
    vmovupd    (%rdi), %xmm0               <---- vector load: good
    vmulpd    %xmm0, %xmm0, %xmm1
    vaddpd    %xmm1, %xmm0, %xmm0
    vmovupd    %xmm0, (%rdi)
    vmovsd    16(%rdi), %xmm0             <---- scalar load: bad
    vmovhpd    24(%rdi), %xmm0, %xmm0      <---- scalar load: bad
    vmulpd    %xmm0, %xmm0, %xmm1
    vaddpd    %xmm1, %xmm0, %xmm0
    vmovupd    %xmm0, 16(%rdi)
    popq    %rbp

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/20140505/55cd4f80/attachment.html>

More information about the llvm-bugs mailing list