[llvm-bugs] [Bug 46094] New: [X86] Improve handling of moving with AH/BH/CH/DH

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 27 01:54:30 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46094

            Bug ID: 46094
           Summary: [X86] Improve handling of moving with AH/BH/CH/DH
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: andrea.dibiagio at gmail.com, craig.topper at gmail.com,
                    efriedma at quicinc.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

Based off a discussion https://reviews.llvm.org/D80466

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.

-- 
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/20200527/1e409deb/attachment.html>


More information about the llvm-bugs mailing list