[DAG] SelectionDAG::ComputeNumSignBits - add ISD::ABDS handling
We can probably handle this best by thinking in terms of the abds(lhs, rhs) -> sub(smax(lhs,rhs), smin(lhs,rhs)) expansion:
numsignbits = max(sub(min(numsignbits(lhs),numsignbits(rhs)),1),1)
Although I'm sure there will be special cases that can improve on that.
Test coverage probably easiest to add to aarch64 which has neon support for ABDS instructions - either in codegen tests or via AArch64SelectionDAGTest.cpp
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:
- Check that no other contributor is working on this issue. If someone is assigned to the issue or claimed to be working on it, ping the person. After one week without a response, the assignee may be changed.
- Leave a comment indicating that you are working on the issue, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
- Fix the issue locally.
- Run the test suite locally. Remember that the subdirectories under
test/create fine-grained testing targets, so you can e.g. usemake check-clang-astto only run Clang's AST tests. - Create a Git commit.
- Run
git clang-format HEAD~1to format your changes. - Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.
@llvm/issue-subscribers-good-first-issue
Author: Simon Pilgrim (RKSimon)
numsignbits = max(sub(min(numsignbits(lhs),numsignbits(rhs)),1),1)
Although I'm sure there will be special cases that can improve on that.
Test coverage probably easiest to add to aarch64 which has neon support for ABDS instructions - either in codegen tests or via AArch64SelectionDAGTest.cpp
@RKSimon can i work on this?
@RKSimon I've fixed this issue, since it's my first contribution, could you please review it to see if it's implemented correctly?
@cpist I thought @Xylecrack was working on it?
@RKSimon Oh! Based on what you said, I thought this might be what you meant, so I gave it a try. In that case, I'll wait for Xylecrack to post their results. After then, check if I did it correctly after looking at the content.
Confirmed that the computeKnownBits handling already covers this - #175321 is now about improving test coverage.