[DAGCombine][PowerPC] Simplify nabs by using legal `smin` operation
authorKai Luo <lkail@cn.ibm.com>
Tue, 8 Dec 2020 03:22:32 +0000 (03:22 +0000)
committerKai Luo <lkail@cn.ibm.com>
Tue, 8 Dec 2020 03:24:07 +0000 (03:24 +0000)
commit44bd8ea167f2138de9317196a7b199840e29fb59
tree671dc48a5df10f0009c98f5df249a4e2d4d1b781
parent49599cb1a20cc4f4d6d2f71965f2069ae8d4f96a
[DAGCombine][PowerPC] Simplify nabs by using legal `smin` operation

Convert `0 - abs(x)` to `smin (x, -x)` if `smin` is a legal operation.

Verification: https://alive2.llvm.org/ce/z/vpquFR

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D92637
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/PowerPC/neg-abs.ll