[llvm-bugs] [Bug 43844] New: Failure to vectorize even-odd shuffle

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 30 02:04:43 PDT 2019


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

            Bug ID: 43844
           Summary: Failure to vectorize even-odd shuffle
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at lists.llvm.org

#include <array>
std::array<int, 16> evenodd(const std::array<const int, 16> in) {
    std::array<int, 16> tmp;
    for(int i = 0, j = 0; i < 16 && j < 16; i++) {
        tmp[j] = in[i];

        // First fill all even values, then all odd
        j += 2;
        if(j == 16)
            j = 1;
    }

    return tmp;
}
results in scalar code

while it could be something like

define <16 x i32> @evenodd(<16 x i32> %in) {
    %t = shufflevector <16 x i32> %in, <16 x i32> undef,
                       <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10,
i32 12, i32 14,
                                   i32 1, i32 3, i32 5, i32 7, i32 9, i32 11,
i32 13, i32 15>
    ret <16 x i32> %t
}

https://godbolt.org/z/9Mjrqa

-- 
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/20191030/1f0e9a9b/attachment.html>


More information about the llvm-bugs mailing list