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: [email protected]
          Reporter: [email protected]
                CC: [email protected]

#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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to