[llvm-bugs] [Bug 42917] New: Missed vectorization for loop with MAX

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 7 07:39:28 PDT 2019


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

            Bug ID: 42917
           Summary: Missed vectorization for loop with MAX
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

#define max(a,b) (((a) > (b))? (a) : (b))

unsigned p[512];
void vmax() {
    for (int i = 0; i < 512; i+=2) {
        p[i] = max(p[i], p[i+1]);
    }
}

int main() {
    for (int i = 0; i < 10000000; ++i) {
        vmax();
    }
}

icc -O3 vmax.c -march=haswell
0m0,096s

clang -O3 vmax.c -march=haswell
0m1,518s

clang with #pragma clang loop vectorize(enable) interleave(enable)
0m1,096s

https://godbolt.org/z/5bjKUI

-- 
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/20190807/84498358/attachment.html>


More information about the llvm-bugs mailing list