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

            Bug ID: 45077
           Summary: [SLP] Failure to vectorize interleaving of elements
                    from two vector loads
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: lebedev...@gmail.com
                CC: llvm-bugs@lists.llvm.org

#include <array>

std::array<uint16_t, 16>
zz(const uint16_t*const row0, const uint16_t*const row1) {
    std::array<uint16_t, 16> baseline;

    // Preload the entire block from last two rows.
    std::array<std::array<uint16_t, 16>, 2> prev;
    for (int c = 0; c < 16; ++c)
      prev[1][c] = row0[c];
    for (int c = 0; c < 16; ++c)
      prev[0][c] = row1[c];

    // The differences are specified as compared to the pixels of the previous
    // row for even pixels, or to pixels from two rows above for odd pixels.
    for (int c = 0; c < 16; ++c)
      baseline[c] = prev[c & 1][c];

    return baseline;
}

Currently results in rather scalar code, however i believe this should
vectorize into *something* like

define <16 x i16> @zz(<16 x i16>* %line0, <16 x i16>* %line1) {
    %l0data = load <16 x i16>, <16 x i16>* %line0
    %l1data = load <16 x i16>, <16 x i16>* %line1
    %res = shufflevector <16 x i16> %l0data, <16 x i16> %l1data,
                         <16 x i32> <i32 0, i32 17, i32 2, i32 19, i32 4, i32
21, i32 6, i32 23, i32 8, i32 25, i32 10, i32 27, i32 12, i32 29, i32 14, i32
31>
    ret <16 x i16> %res
}

https://godbolt.org/z/Pj7XkH

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

Reply via email to