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

[mlir][arith] Match folding of arith.remf to llvm.frem semantics #96537

Merged
merged 5 commits into from
Jun 25, 2024

Commits on Jun 24, 2024

  1. [mlir][arith] Match folding of arith.remf to llvm.frem semantics

    There are multiple ways to define the remainder operation. Depending
    on the definition, the result is either always positive or has the sign
    of the dividend.
    The pattern lowering `arith.remf` to LLVM assumes that the semantics
    match `llvm.frem`, which seems to be reasonable. The folder, however,
    is implemented via `APFloat::remainder()` which has different semantics.
    
    This patch matches the folding behaviour to lowering behavior by using
    `APFloat::mod()`, which matches the behavior of `llvm.frem` and libm's
    `fmod()`. It also updates the documentation of `arith.remf` to explicitly
    state that it follows the semantics of `llvm.frem`.
    
    frem documentation: https://llvm.org/docs/LangRef.html#frem-instruction
    
    Fix llvm#94431
    ubfx committed Jun 24, 2024
    Configuration menu
    Copy the full SHA
    3e7020e View commit details
    Browse the repository at this point in the history

Commits on Jun 25, 2024

  1. Configuration menu
    Copy the full SHA
    0f912be View commit details
    Browse the repository at this point in the history
  2. Update folder comment

    ubfx committed Jun 25, 2024
    Configuration menu
    Copy the full SHA
    21ec4ee View commit details
    Browse the repository at this point in the history
  3. Update mlir/test/Dialect/Arith/canonicalize.mlir

    Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com>
    ubfx and kuhar authored Jun 25, 2024
    Configuration menu
    Copy the full SHA
    cf6d70c View commit details
    Browse the repository at this point in the history
  4. Update mlir/include/mlir/Dialect/Arith/IR/ArithOps.td

    Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com>
    ubfx and kuhar authored Jun 25, 2024
    Configuration menu
    Copy the full SHA
    24c82de View commit details
    Browse the repository at this point in the history