Original pattern: (builtin_parity(x) ^ builtin_parity(y))
LLVM rewrites it as: (builtin_popcount(x) ^ builtin_popcount(y)) & 1
Optimized form: __builtin_popcount(X^Y) & 1
Alive proof: https://alive2.llvm.org/ce/z/-GdWFr
Paths
| Differential D101802
[InstCombine] ctpop(X) ^ ctpop(Y) & 1 --> ctpop(X^Y) & 1 (PR50094) ClosedPublic Authored by xbolva00 on May 3 2021, 5:04 PM.
Details Summary Original pattern: (builtin_parity(x) ^ builtin_parity(y)) LLVM rewrites it as: (builtin_popcount(x) ^ builtin_popcount(y)) & 1 Optimized form: __builtin_popcount(X^Y) & 1 Alive proof: https://alive2.llvm.org/ce/z/-GdWFr
Diff Detail
Event TimelineComment Actions LGTM with one minor
This revision is now accepted and ready to land.May 4 2021, 4:01 AM
Closed by commit rG80b897e21bf0: [InstCombine] ctpop(X) ^ ctpop(Y) & 1 --> ctpop(X^Y) & 1 (PR50094) (authored by xbolva00). · Explain WhyMay 4 2021, 4:16 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 342697 llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/test/Transforms/InstCombine/ctpop.ll
|