[PATCH] D119559: [DAGCombine] Basic combines for AVG nodes.

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 11 09:55:10 PST 2022


dmgreen created this revision.
dmgreen added reviewers: RKSimon, craig.topper, spatel, efriedma.
Herald added subscribers: ecnelises, hiraditya.
dmgreen requested review of this revision.
Herald added a project: LLVM.

This adds very basic combines for AVG nodes, mostly for constant folding and handling degenerate (zero) cases. The code performs mostly same transforms as visitMULHS, adjusted fro AVG nodes.

Constant folding extends to a higher bitwidth and drops the lowest bit. Undef is transformed to 0, as the `add x, undef` could be treated as 0. There is also a transform for `avgfloor x, 0` transforming to `shr x, 1`.


https://reviews.llvm.org/D119559

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/test/CodeGen/AArch64/hadd-combine.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119559.407927.patch
Type: text/x-patch
Size: 10498 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220211/6e8b5b0b/attachment-0001.bin>


More information about the llvm-commits mailing list