[llvm-bugs] [Bug 52049] New: Missing combine of shl+bswap to rol

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 3 03:01:39 PDT 2021


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

            Bug ID: 52049
           Summary: Missing combine of shl+bswap to rol
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

unsigned read_be16 (unsigned char *data)
{
  return *(data + 1) | (*data << 8);
}


LLVM
read_be16(unsigned char*):                         # @read_be16(unsigned char*)
        movzx   eax, word ptr [rdi]
        shl     eax, 16
        bswap   eax
        ret

GCC
read_be16(unsigned char*):
        movzx   eax, WORD PTR [rdi]
        rol     ax, 8
        movzx   eax, ax
        ret


https://godbolt.org/z/s8ha55Y7W

-- 
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/20211003/89e10329/attachment.html>


More information about the llvm-bugs mailing list