[llvm-dev] Vectorizing "hybrid" SOA

via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 16 10:09:54 PST 2017


If the loop gets unrolled by 4x I think SLP could cover it.

I guess the loopvectorizer should in theory be able to do this, so you could look into why it isn’t doing it, perhaps by checking the debug log.

—escha

> On Nov 15, 2017, at 11:13 AM, Tom Chen via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Do anyone know how to get LLVM's vectorizer to work on this code?
> ```
> struct pair {
>   int x[4], y[4];
> };
> 
> void foo(int n, struct pair *a, int *restrict rx, int *restrict ry) {
>   int x = 0, y = 0;
>   for (int i = 0; i < n; i++) {
>     x += (a+(i/4))->x[i%4];
>     y += (a+(i/4))->y[i%4];
>   }
>   *rx = x;
>   *ry = y;
> }
> ```
> I have a pass that converts structures such as {int, int} into {int x 4, int x 4}, but the transformation is profitable if it can work with the vectorizer.
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list