https://bugs.llvm.org/show_bug.cgi?id=48999
Bug ID: 48999
Summary: Failure to optimize combined popcount pattern
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: gabrav...@gmail.com
CC: llvm-bugs@lists.llvm.org
int f(unsigned int a, unsigned int b)
{
return __builtin_popcount(a & 8) + __builtin_popcount(b & 2);
}
This can be optimized to `return __builtin_popcount((a & 8) | (b & 2));`. This
transformation is done by GCC, but not by LLVM.
Godbolt comparison: https://godbolt.org/z/zjP3Ys
(If someone can tell me how to use ctpop in alive2 that'd be nice btw, I
couldn't get it to work personally)
--
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