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

            Bug ID: 39597
           Summary: vectorization differences
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedb...@nondot.org
          Reporter: tras...@gmail.com
                CC: llvm-bugs@lists.llvm.org

void foo(unsigned* x)
{
    for (int i = 0; i < 8; ++i)
            x[i] = (x[i] % 3 == 0) ? 0 : x[i];
}

void bar(unsigned* x)
{
    for (int i = 0; i < 8; ++i)
        if (x[i] % 3 == 0)
            x[i] = 0;
}

$ clang -O3 -march=haswell -Rpass="loop|vect" -Rpass-missed="loop|vect"
-Rpass-analysis="loop|vect"

<source>:3:5: remark: completely unrolled loop with 8 iterations
[-Rpass=loop-unroll]
<source>:9:5: remark: completely unrolled loop with 8 iterations
[-Rpass=loop-unroll]
<source>:4:18: remark: Stores SLP vectorized with cost -17 and with tree size 8
[-Rpass=slp-vectorizer]

$ clang -O3 -fno-unroll-loops -march=haswell -Rpass="loop|vect"
-Rpass-missed="loop|vect" -Rpass-analysis="loop|vect"

<source>:3:5: remark: vectorized loop (vectorization width: 8, interleaved
count: 1) [-Rpass=loop-vectorize]
<source>:9:5: remark: vectorized loop (vectorization width: 8, interleaved
count: 1) [-Rpass=loop-vectorize]


The generated code is different in all 4 cases:
https://godbolt.org/z/7EaJfc

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to