<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][SSE] Add ISD::MULHS/MULHU vXi64 support"
   href="https://bugs.llvm.org/show_bug.cgi?id=38423">38423</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86][SSE] Add ISD::MULHS/MULHU vXi64 support
          </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>andrea.dibiagio@gmail.com, craig.topper@gmail.com, lebedev.ri@gmail.com, llvm-bugs@lists.llvm.org, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I haven't thoroughly tested this but MULHU should be something like:

define <2 x i64> @mulh_2u64(<2 x i64>, <2 x i64>) {
  %3 = and <2 x i64> %0, <i64 4294967295, i64 4294967295>
  %4 = lshr <2 x i64> %0, <i64 32, i64 32>
  %5 = and <2 x i64> %1, <i64 4294967295, i64 4294967295>
  %6 = lshr <2 x i64> %1, <i64 32, i64 32>
  %7 = mul nuw <2 x i64> %6, %4
  %8 = mul nuw <2 x i64> %5, %4
  %9 = mul nuw <2 x i64> %6, %3
  %10 = mul nuw <2 x i64> %5, %3
  %11 = and <2 x i64> %8, <i64 4294967295, i64 4294967295>
  %12 = and <2 x i64> %9, <i64 4294967295, i64 4294967295>
  %13 = add nuw nsw <2 x i64> %11, %12
  %14 = lshr <2 x i64> %10, <i64 32, i64 32>
  %15 = add nuw nsw <2 x i64> %13, %14
  %16 = lshr <2 x i64> %15, <i64 32, i64 32>
  %17 = lshr <2 x i64> %8, <i64 32, i64 32>
  %18 = add <2 x i64> %17, %7
  %19 = lshr <2 x i64> %9, <i64 32, i64 32>
  %20 = add <2 x i64> %18, %19
  %21 = add <2 x i64> %20, %16
  ret <2 x i64> %21
}

mulh_2u64:
  vpxor %xmm2, %xmm2, %xmm2
  vpblendw $204, %xmm2, %xmm0, %xmm3 # xmm3 =
xmm0[0,1],xmm2[2,3],xmm0[4,5],xmm2[6,7]
  vpblendw $204, %xmm2, %xmm1, %xmm4 # xmm4 =
xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
  vpsrlq $32, %xmm0, %xmm0
  vpsrlq $32, %xmm1, %xmm1
  vpmuludq %xmm0, %xmm1, %xmm5
  vpmuludq %xmm3, %xmm1, %xmm1
  vpmuludq %xmm0, %xmm4, %xmm0
  vpmuludq %xmm3, %xmm4, %xmm3
  vpblendw $204, %xmm2, %xmm0, %xmm4 # xmm4 =
xmm0[0,1],xmm2[2,3],xmm0[4,5],xmm2[6,7]
  vpblendw $204, %xmm2, %xmm1, %xmm2 # xmm2 =
xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
  vpsrlq $32, %xmm0, %xmm0
  vpsrlq $32, %xmm3, %xmm3
  vpsrlq $32, %xmm1, %xmm1
  vpaddq %xmm2, %xmm4, %xmm2
  vpaddq %xmm5, %xmm0, %xmm0
  vpaddq %xmm3, %xmm2, %xmm2
  vpaddq %xmm1, %xmm0, %xmm0
  vpsrlq $32, %xmm2, %xmm2
  vpaddq %xmm2, %xmm0, %xmm0
  retq</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>