<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 - [SIMD] pattern for i32x4.dot_i16x8_s not recognized"
   href="https://bugs.llvm.org/show_bug.cgi?id=50810">50810</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[SIMD] pattern for i32x4.dot_i16x8_s not recognized
          </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: WebAssembly
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>clang@evan.coeusgroup.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>With -msimd128 -O3, the compiler wont't recognize the following snippet as an
i32x4.dot_i16x8_s.

It also scalarizes a lot of stuff; the WASM backend seems to have a lot of
trouble with non-128-bit vectors.  Even if this wasn't recognized as a dot
product, I'd hope to see some extmuls (or at least i16x8.extend_low/high and
i32x4.mul) and shuffles for this.  I can file another bug for that if you want.

Anyways, here is the example (Compiler Explorer:
<a href="https://godbolt.org/z/an4jKTnf5">https://godbolt.org/z/an4jKTnf5</a>):



#include <stdint.h>

typedef  int16_t i16x8 __attribute__((__vector_size__(16)));
typedef  int32_t i32x4 __attribute__((__vector_size__(16)));

i32x4
dot(i16x8 a, i16x8 b) {
    int32_t prod __attribute__((__vector_size__(32))) =
        __builtin_convertvector(a, __typeof__(prod)) *
        __builtin_convertvector(b, __typeof__(prod)); 
    return
        __builtin_shufflevector(prod, prod, 0, 2, 4, 6) +
        __builtin_shufflevector(prod, prod, 1, 3, 5, 7);
}</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>