]> granicus.if.org Git - llvm/commit
[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)
commit072e86da0cfe4dcdbe87a498b6747c2b8ebce2af
tree6162422f1899a64d2820dde5803dfb251f2018d4
parentd1894a13cc9a764bf7fcee218c69d36f29924d7b
[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287329 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCISelLowering.h
test/CodeGen/PowerPC/setcc-to-sub.ll [new file with mode: 0644]