<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] Improve handling of moving with AH/BH/CH/DH"
   href="https://bugs.llvm.org/show_bug.cgi?id=46094">46094</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86] Improve handling of moving with AH/BH/CH/DH
          </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, efriedma@quicinc.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Based off a discussion <a href="https://reviews.llvm.org/D80466">https://reviews.llvm.org/D80466</a>

For byte packing cases:

define i16 @pack(i8 %hi, i8 %lo) {
  %lox = zext i8 %lo to i16
  %hix = zext i8 %hi to i16
  %hix_shift = shl i16 %hix, 8
  %pack = or i16 %lox, %hix_shift
  ret i16 %pack
}

we can either shift+or or use movb to move %hi's byte directly into upper byte
of %lo's register.

  movzbl  %sil, %eax
  shll    $8, %edi
  orl     %edi, %eax
  retq

vs

  movzbl  %sil, %eax
  movb    %dl, %ah
  retq

The pros/cons are incredibly specific to the target hardware, the registers we
have available and what instructions we're feeding the packing operation
outof/into.</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>