[PPC][DAGCombine] Convert SETCC to subtract when the result is zero extended
authorEhsan Amiri <amehsan@ca.ibm.com>
Fri, 18 Nov 2016 10:41:44 +0000 (10:41 +0000)
committerEhsan Amiri <amehsan@ca.ibm.com>
Fri, 18 Nov 2016 10:41:44 +0000 (10:41 +0000)
commit85818684c6ccb136ccf5a1dfdca6968fe7d1037b
treed34d450ba915b8a6239fab40e40f2da77c604854
parentc00c9a9f61e44dbb75e5b023de038f6096ab9329
[PPC][DAGCombine] Convert SETCC to subtract when the result is zero extended

When we see a SETCC whose only users are zero extend operations, we can replace
it with a subtraction. This results in doing all calculations in GPRs and
avoids CR use.

Currently we do this only for ULT, ULE, UGT and UGE condition codes. There are
ways that this can be extended. For example for signed condition codes. In that
case we will be introducing additional sign extend instructions, so more careful
profitability analysis may be required.

Another direction to extend this is for equal, not equal conditions. Also when
users of SETCC are any_ext or sign_ext, we might be able to do something
similar.

llvm-svn: 287329
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.h
llvm/test/CodeGen/PowerPC/setcc-to-sub.ll [new file with mode: 0644]