<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] kunpack intrinsics generate instructions with swapped operands after r319777"
   href="https://bugs.llvm.org/show_bug.cgi?id=36360">36360</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86] kunpack intrinsics generate instructions with swapped operands after r319777
          </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>craig.topper@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>r319777/r319778 removed the kunpack intrinsics and replaced them with native IR
using shift+and+or. But in the process the operands got swapped relative to
their previous behavior due to inconsistent documentation from Intel.

Intel documentation says this for kunpackb intrinsic

  k[7:0] := b[7:0]
  k[15:8] := a[7:0]
  k[MAX:16] := 0


But for kunpackw it says

  k[31:0] := a[31:0]
  k[63:32] := b[31:0]
  k[MAX:64] := 0

Notice the order of 'a' and 'b' is reversed here. kunpackd is documented
similarly to kunpackw.

clang 5.0, gcc, and icc all implement the kunpackb behavior for all 3
intrinsics. But trunk is implenting the kunpackw/kunpackd behavior.

I'll fix this for trunk. I've filed a separate PR36357 for reverting the
patches from 6.0. There have been other changes here post 6.0 so it should be
easier to revert than to bring the trunk implementation into 7.0 or fix 6.0
with a separate fix.</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>