Skip to content

[DAG] Fold trunc(avg(x,y)) for avgceil/floor u/s nodes if they have sufficient leading zero/sign bits #147773

Open
@RKSimon

Description

@RKSimon

Similar to #147683

If a ISD::AVG* node has sufficient leading zero/sign bits then it should still work in a truncated type.

  • Create alive2 links to prove when all 4 avg patterns can be safely truncated
  • Add test coverage (using aarch64 hadd intrinsics is probably easiest as that will always start from the correct nodes)
  • Add suitable folds in DAGCombiner::visitTRUNCATE - including legality checks

Metadata

Metadata

Labels

good first issuehttps://github.com/llvm/llvm-project/contributellvm:SelectionDAGSelectionDAGISel as well

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions