Skip to content
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

[InstCombine] Fold Minimum over Trailing/Leading Bits Counts #90402

Merged
merged 2 commits into from
Jul 13, 2024

Commits on Jul 4, 2024

  1. Configuration menu
    Copy the full SHA
    6b6d4e7 View commit details
    Browse the repository at this point in the history

Commits on Jul 5, 2024

  1. [InstCombine] Fold Minimum over Trailing/Leading Bits Counts (llvm#90000

    )
    
    The new transformation folds `umin(cttz(x), c)` to `cttz(x | (1 << c))`
    and `umin(ctlz(x), c)` to `ctlz(x | ((1 << (bitwidth - 1)) >> c))`. The
    transformation is only implemented for constant `c` to not increase the
    number of instructions.
    
    The idea of the transformation is to set the c-th lowest (for `cttz`) or
    highest (for `ctlz`) bit in the operand. In this way, the `cttz` or
    `ctlz` instruction always returns at most `c`.
    
    Alive2 proofs: https://alive2.llvm.org/ce/z/y8Hdb8
    mskamp committed Jul 5, 2024
    Configuration menu
    Copy the full SHA
    9e1dfa9 View commit details
    Browse the repository at this point in the history