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: unassignedb...@nondot.org
          Reporter: david.bolvan...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to