Convert 0 - abs(x) to smin (x, -x) if smin is a legal operation.
Verification: https://alive2.llvm.org/ce/z/vpquFR
Paths
| Differential D92637
[DAGCombine][PowerPC] Simplify nabs by using legal `smin` operation ClosedPublic Authored by lkail on Dec 4 2020, 12:04 AM.
Details
Summary Convert 0 - abs(x) to smin (x, -x) if smin is a legal operation. Verification: https://alive2.llvm.org/ce/z/vpquFR
Diff Detail
Unit TestsFailed
Event TimelineHerald added subscribers: shchenz, hiraditya, nemanjai. · View Herald TranscriptDec 4 2020, 12:04 AM
This revision is now accepted and ready to land.Dec 7 2020, 2:04 AM This revision was landed with ongoing or failed builds.Dec 7 2020, 7:24 PM Closed by commit rG44bd8ea167f2: [DAGCombine][PowerPC] Simplify nabs by using legal `smin` operation (authored by lkail). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 309838 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
|
We might be able to adapt TargetLowering::expandABS with a Negate bool to handle this - we're doing some very similar expansions there already.