[NVPTX] Implement `TLI.isTruncateFree(EVT, EVT)` and `TLI.isZExtFree()`
NVPTX currently does not override TLI.isTruncateFree(EVT, EVT) and TLI.isZExtFree(), and it probably should.
zext/truncate between i32/i64 can probably be considered free, as the values already live in separate 32-bit registers in hardware.
Originally posted by @Artem-B in https://github.com/llvm/llvm-project/pull/98666#discussion_r1681805956
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 has already been assigned to this issue. If you believe that no one is actually working on it despite an assignment, ping the person. After one week without a response, the assignee may be changed.
- In the comments of this issue, request for it to be assigned to you, 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: Justin Fargnoli (justinfargnoli)
zext/truncate between i32/i64 can probably be considered free, as the values already live in separate 32-bit registers in hardware.
Originally posted by @Artem-B in https://github.com/llvm/llvm-project/pull/98666#discussion_r1681805956
i want to work on this issue
@Quark-69, that's fantastic to hear! Please let me know if I should expand on what the ask is or if I can help in any way :)
@Quark-69 Go for it. Patches are welcome.
@justinfargnoli there were 2 virtual functions for isZextfree and 1 for istruncatefree that weren't implemented in the nvptx library. So I have to implement all these? Also can you elaborate a little for the issue and give me some testing strategies.
@justinfargnoli Hello! I wanted to check in to see if this PR looks correct, or if there’s anything I might have missed. This is my current approach based on my understanding for isZextfree and istruncatefree for the nvptx arch.
@justinfargnoli there were 2 virtual functions for isZextfree and 1 for istruncatefree that weren't implemented in the nvptx library. So I have to implement all these?
You can implement however many you'd like! The issue is just tracking the fact that these three are unimplemented. If you'd only like to implement 1, feel free to do just that.
@justinfargnoli Hello! I wanted to check in to see if this PR looks correct, or if there’s anything I might have missed. This is my current approach based on my understanding for isZextfree and istruncatefree for the nvptx arch.
I followed up on the PR. I'm happy you took an initial stab at it. Great work so far!
@Quark-69 Hi, are you still working on this issue?
@lwshanbd I wasn't able to generate a test case which reflected some changes in the assembly before and after adding istruncatefree(). So yeah I finally left it.
Hi @justinfargnoli, could you assign it to me? I just submit a new PR of this issue.
@justinfargnoli: Could you please elaborate? Both merge requests referring to this issue were not merged.