Open llvmbot opened 11 years ago
Hi!
This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
1) Assign the issue to you.
2) Fix the issue locally.
3) Run the test suite locally.
3.1) Remember that the subdirectories under test/
create fine-grained testing targets, so you can
e.g. use make check-clang-ast
to only run Clang's AST tests.
4) Create a git
commit
5) Run git clang-format HEAD~1
to format your changes.
6) Submit the patch to Phabricator.
6.1) Detailed instructions can be found here
For more instructions on how to submit a patch to LLVM, see our documentation.
If you have any further questions about this issue, don't hesitate to ask via a comment on this Github issue.
@llvm/issue-subscribers-good-first-issue
The codegen is changed on the trunk - https://godbolt.org/z/4Tn7xsdb5, it now uses series of conditional jump and comparison.
Extended Description
This is very similar to bug 17128 (count trailing zeros), but I'm filing a separate bug just in case the solution involves some differences in implementation in the compiler.
On the surface, this one maps to existing hardware instructions (Power = ctlzw/d, ARM = clz) more easily than count-trailing-zeros. x86 has bsr/lzcnt as well as bsf/tzcnt.
Here's a test file with a couple of implementations of count-leading-zeros. Currently, llvm recognizes that both functions have bit-testing loops ('bt' instructions is generated), but doesn't know that they can be simplified to count-leading-zeros: