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

[DAG] Support saturated truncate #99418

Merged
merged 6 commits into from
Aug 14, 2024
Merged

[DAG] Support saturated truncate #99418

merged 6 commits into from
Aug 14, 2024

Commits on Aug 9, 2024

  1. [DAG] Support saturated truncate

    A truncate is considered saturated if no additional conversion is
    required between the target and return values. If the target is
    saturated when attempting to truncate from a vector, there is an
    opportunity to optimize it.
    
    Previously, each architecture had its own attempt at optimization,
    leading to redundant code. This patch implements common logic by
    introducing three new ISDs:
    
     `ISD::TRUNCATE_SSAT_S`: When the operand is a signed value and
     the range of values matches the range of signed values of the
     destination type.
    
     `ISD::TRUNCATE_SSAT_U`: When the operand is a signed value and
     the range of values matches the range of unsigned values of the
     destination type.
    
     `ISD::TRUNCATE_USAT_U`: When the operand is an unsigned value and
     the range of values matches the range of unsigned values of the
     destination type.
    
    These ISDs indicate a saturated truncate.
    
    Fixes llvm#85903
    ParkHanbum committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    8d81896 View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2024

  1. Configuration menu
    Copy the full SHA
    7df00c5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5477448 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9780ddc View commit details
    Browse the repository at this point in the history
  4. [AArch64] Support saturated truncate

    Add support for saturated truncate with the following changes:
    
    - Add action to Legal for types v8i16, v4i32, and v2i64
    - Implement `isTypeDesirableForOp` to check for truncate conversions
    - Add patterns for saturated truncate of supported types
    ParkHanbum committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    345a104 View commit details
    Browse the repository at this point in the history
  5. [RISCV] Support saturated truncate

    Add support for saturated truncate by implementing the following changes:
    
    - Add `TRUNCATE_[SU]SAT_[SU]` to the Action target of `TRUNCATE`
    - Add `TRUNCATE_[SU]SAT_[SU]` to the TargetLowering target of `TRUNCATE`
    - Convert `TRUNCATE_SSAT_S` to `TRUNCATE_VECTOR_VL_SSAT`
    - Convert `TRUNCATE_[SU]SAT_U` to `TRUNCATE_VECTOR_VL_USAT`
    ParkHanbum committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    9a40cec View commit details
    Browse the repository at this point in the history