This will tell loop idiom recognize that it can convert popcount loops
to intrinsics. I didn't bother checking for illegal types. Type legalization
knows how to split a ctpop into multiple ctops added together. Assuming we only
receive reasonable integer bit widths, a few cpop instructions added together
is probably better than the loop.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Makes sense - nice. Should it test that we don't expect popcount without zbb enabled?
Sanity check: experimental-b implies experimental-zbb and so will also generate the popcount, right?
Add more test RUN lines. Use update_test_checks.py because I'm not a big fan of -NOT checks.
llvm/test/Transforms/LoopIdiom/RISCV/popcnt.ll | ||
---|---|---|
29 | Maybe it's late in the day but I expected there not to be a loop here. Am I missing something? |
llvm/test/Transforms/LoopIdiom/RISCV/popcnt.ll | ||
---|---|---|
29 | LoopIdiomRecognize requires other passes to do the cleanup. The main goal of LoopIdiomRecognize is to rewrite the loop into countable form. It does this by putting the ctpop outside the loop and decrement it each iteration. Other passes will need to determine that the loop doesn't do anything else and remove it. |
LGTM
llvm/test/Transforms/LoopIdiom/RISCV/popcnt.ll | ||
---|---|---|
29 | Oh yes I see now how the PHIs in while.end.loopexit and while.end help show that. Thanks! |
clang-format not found in user's PATH; not linting file.