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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to