Skip to content

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

@RKSimon

Description

@RKSimon
Collaborator
  • 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

Activity

llvmbot

llvmbot commented on Mar 6, 2024

@llvmbot
Member

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

llvmbot commented on Mar 6, 2024

@llvmbot
Member

@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

Atousa commented on Mar 6, 2024

@Atousa
Contributor

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

EugeneZelenko

EugeneZelenko commented on Mar 6, 2024

@EugeneZelenko
Contributor

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

added a commit that references this issue on Mar 14, 2024
aff0570
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issuehttps://github.com/llvm/llvm-project/contributellvm:support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @Atousa@RKSimon@EugeneZelenko@llvmbot

    Issue actions

      [ADT] Add APIntOps::avgfloors/avgflooru/avgceils/avgceilu · Issue #84211 · llvm/llvm-project