<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [X86][SSE2] Failure to vectorize int16_t[8] to pminsw pattern"
   href="https://bugs.llvm.org/show_bug.cgi?id=48879">48879</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86][SSE2] Failure to vectorize int16_t[8] to pminsw pattern
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>llvm-dev@redking.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, pengfei.wang@intel.com, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre><a href="https://gcc.godbolt.org/z/57nGK3">https://gcc.godbolt.org/z/57nGK3</a>

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....</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>