[llvm-bugs] [Bug 27252] New: [ppc] missed vectorization of simple loop

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 6 14:48:46 PDT 2016


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

            Bug ID: 27252
           Summary: [ppc] missed vectorization of simple loop
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: carrot at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Compile the following code with command line

~/llvm/obj3/bin/clang --target=powerpc64le-grtev4-linux-gnu -mvsx -mcpu=power8
-O2 -c t12.c -o t12.o

int foo(unsigned int* buf, unsigned int end, unsigned int endmask){
  unsigned int* p;
  int sum = 0;

  for (p = buf; p < buf + end; ++p) { 
    sum += __builtin_popcount(*p);
  }

  return sum + __builtin_popcount(*p & endmask);
}


The simple loop is unrolled but not vectorized. If I change the last line to

   return sum;

Then the loop can be vectorized.

-- 
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/20160406/a10c421d/attachment.html>


More information about the llvm-bugs mailing list