[all-commits] [llvm/llvm-project] 120ce8: [DAG] Add visitABD optimizations

David Green via All-commits all-commits at lists.llvm.org
Sun Feb 5 02:29:07 PST 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 120ce83660dea7e70abe1c8f9408f39fe2502f8d
  Author: David Green <david.green at arm.com>
  Date:   2023-02-05 (Sun, 05 Feb 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/TargetLowering.h
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
    M llvm/test/CodeGen/AArch64/abd-combine.ll
    M llvm/test/CodeGen/AArch64/arm64-neon-aba-abd.ll
    M llvm/test/CodeGen/Thumb2/mve-vabdus.ll

  Log Message:
  [DAG] Add visitABD optimizations

This adds basic a visitABD to optimize ABDS and ABDU nodes, similar to the
existing visitAVG method.

The fold I was initially interested in was folding shuffles though the binop.
This also:
- Marks ABDS and ABDU as commutative binops (https://alive2.llvm.org/ce/z/oCDogb
  and https://alive2.llvm.org/ce/z/7zrs86).
- Add reassociative folds.
- Add constant folding using max(x,y)-min(x,y)
- Canonicalizes constants to the RHS
- Folds abds x, 0 -> abs(x) (https://alive2.llvm.org/ce/z/4ZEibv)
- Folds abdu x, 0 -> x (https://alive2.llvm.org/ce/z/J_rKqx)
- Folds abd x, undef -> 0 (https://alive2.llvm.org/ce/z/NV6Nsv and

Differential Revision: https://reviews.llvm.org/D143193

More information about the All-commits mailing list