[llvm-bugs] [Bug 41337] New: ctpop/popcount missing folds

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 1 14:01:03 PDT 2019


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

            Bug ID: 41337
           Summary: ctpop/popcount missing folds
           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 popcount_bitrev(unsigned x) {
    unsigned a = __builtin_bitreverse32(x);
    return __builtin_popcount(a);
}

Since popcount returns number of set bits, we can simplify it to popcount(x).
Same for bswap, I think.

-- 
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/20190401/a5c9d32f/attachment.html>


More information about the llvm-bugs mailing list