[llvm-bugs] [Bug 45715] New: Failure to recognize bswap.i64 pattern

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 28 08:28:37 PDT 2020


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

            Bug ID: 45715
           Summary: Failure to recognize bswap.i64 pattern
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: gabravier at gmail.com
                CC: llvm-bugs at lists.llvm.org

uint64_t swap64(uint64_t x)
{
    return __builtin_bswap32(x >> 32) | ((uint64_t)__builtin_bswap32(x) << 32);
}

This is equivalent to `__builtin_bswap64(x)`. GCC does this transformation, but
only if `__builtin_bswap32` is replaced by a function equivalent to it (i.e.
that is recognized by GCC as equivalent to `__builtin_bswap32`). It would be
nice if LLVM could recognize this as equivalent to `__builtin_bswap64`

Comparison here : https://godbolt.org/z/gtJQdM

-- 
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/20200428/583391c9/attachment.html>


More information about the llvm-bugs mailing list