[llvm-bugs] [Bug 48879] New: [X86][SSE2] Failure to vectorize int16_t[8] to pminsw pattern

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jan 26 03:01:07 PST 2021


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

            Bug ID: 48879
           Summary: [X86][SSE2] Failure to vectorize int16_t[8] to pminsw
                    pattern
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, pengfei.wang at intel.com,
                    spatel+llvm at rotateright.com

https://gcc.godbolt.org/z/57nGK3

typedef int16_t T;
constexpr int N = 8;

std::array<T,N> compute_min(std::array<T,N>& x, std::array<T,N>& y) {
    std::array<T,N> result;
    for (int i = 0; i != N; ++i) {
      result[i] = std::min(x[i], y[i]);
    }
    return result;
}

This ends up as a horrid mix of scalar and <2 x i16> smin patterns.

Much of the problem seems to be that we end up trying to store the final array
as { i64, i64 } aggregate, resulting in a load of zext+shift+or to pack the
i16's.

Even more impressive with -march=atom we end up with masked gather calls....

-- 
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/20210126/0461ab42/attachment.html>


More information about the llvm-bugs mailing list