Skip to content

[ADT] Add APIntOps::avgfloors/avgflooru/avgceils/avgceilu #84211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
RKSimon opened this issue Mar 6, 2024 · 4 comments · Fixed by #84431
Closed
2 tasks done

[ADT] Add APIntOps::avgfloors/avgflooru/avgceils/avgceilu #84211

RKSimon opened this issue Mar 6, 2024 · 4 comments · Fixed by #84431
Assignees
Labels
good first issue https://github.com/llvm/llvm-project/contribute llvm:support

Comments

@RKSimon
Copy link
Collaborator

RKSimon commented Mar 6, 2024

  • Move implementations from SelectionDAG.cpp FoldValue into APInt.h APIntOps
    case ISD::AVGFLOORS: {
    unsigned FullWidth = C1.getBitWidth() + 1;
    APInt C1Ext = C1.sext(FullWidth);
    APInt C2Ext = C2.sext(FullWidth);
    return (C1Ext + C2Ext).extractBits(C1.getBitWidth(), 1);
    }
    case ISD::AVGFLOORU: {
    unsigned FullWidth = C1.getBitWidth() + 1;
    APInt C1Ext = C1.zext(FullWidth);
    APInt C2Ext = C2.zext(FullWidth);
    return (C1Ext + C2Ext).extractBits(C1.getBitWidth(), 1);
    }
    case ISD::AVGCEILS: {
    unsigned FullWidth = C1.getBitWidth() + 1;
    APInt C1Ext = C1.sext(FullWidth);
    APInt C2Ext = C2.sext(FullWidth);
    return (C1Ext + C2Ext + 1).extractBits(C1.getBitWidth(), 1);
    }
    case ISD::AVGCEILU: {
    unsigned FullWidth = C1.getBitWidth() + 1;
    APInt C1Ext = C1.zext(FullWidth);
    APInt C2Ext = C2.zext(FullWidth);
    return (C1Ext + C2Ext + 1).extractBits(C1.getBitWidth(), 1);
    }
  • Add APIntTest unit test coverage
@RKSimon RKSimon added good first issue https://github.com/llvm/llvm-project/contribute llvm:support labels Mar 6, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 6, 2024

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. In the comments of the issue, request for it to be assigned to you.
  2. Fix the issue locally.
  3. Run the test suite locally. 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. Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation.

If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.

@llvmbot
Copy link
Member

llvmbot commented Mar 6, 2024

@llvm/issue-subscribers-good-first-issue

Author: Simon Pilgrim (RKSimon)

- [ ] Move implementations from SelectionDAG.cpp FoldValue into APInt.h APIntOps https://github.com/llvm/llvm-project/blob/deff460b46dfcc8d6d5917a2b78c0d52edbe4afb/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp#L6024-L6047 - [ ] Add APIntTest unit test coverage

@Atousa
Copy link
Contributor

Atousa commented Mar 6, 2024

@RKSimon I am interested in working on this issue. Please assign it to me.

@EugeneZelenko
Copy link
Contributor

@Atousa: Just create pull request and mention it on this page.

RKSimon pushed a commit that referenced this issue Mar 14, 2024
Supports both signed and unsigned expansions.

SelectionDAG now calls the APInt implementation of these functions.

Fixes #84211.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue https://github.com/llvm/llvm-project/contribute llvm:support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants