[llvm-bugs] [Bug 36360] New: [X86] kunpack intrinsics generate instructions with swapped operands after r319777

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 12 14:00:50 PST 2018


            Bug ID: 36360
           Summary: [X86] kunpack intrinsics generate instructions with
                    swapped operands after r319777
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: craig.topper at gmail.com
                CC: llvm-bugs at lists.llvm.org

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.

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/20180212/87077acd/attachment-0001.html>

More information about the llvm-bugs mailing list