<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 - Spurious shuffle shows up in generated code"
   href="https://bugs.llvm.org/show_bug.cgi?id=52013">52013</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Spurious shuffle shows up in generated code
          </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>All
          </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>tlively@google.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zhin@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Ptal <a href="https://godbolt.org/z/dPa48Gez1">https://godbolt.org/z/dPa48Gez1</a> this is a reduced test case based on this
xnnpack source file
<a href="https://github.com/google/XNNPACK/blob/0bf8afaa43601ab37407f262c90ec3c02436a600/src/f32-spmm/gen/32x1-minmax-wasmsimd-x86.c">https://github.com/google/XNNPACK/blob/0bf8afaa43601ab37407f262c90ec3c02436a600/src/f32-spmm/gen/32x1-minmax-wasmsimd-x86.c</a>

What's interesting is that i8x16.shuffle shows up twice in the generated code,
but there is no explicit use of shuffle in the source.

Looking at the second i8x16.shuffle, on line 52 of the generated code:

30        v128.load32_splat       0:p2align=0
31        local.set       10
...
51        local.get 10
52        i8x16.shuffle   0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3

it tries to shuffle the result of a v128.load32_splat. Which isn't needed:
- the shuffle is a 32x4 splat
- we already did a splat in the v128.load32_splat
- the shuffle is actually a nop</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>