Fix PPC optimizeCompareInstr swapped-sub argument handling
authorHal Finkel <hfinkel@anl.gov>
Fri, 19 Apr 2013 22:08:38 +0000 (22:08 +0000)
committerHal Finkel <hfinkel@anl.gov>
Fri, 19 Apr 2013 22:08:38 +0000 (22:08 +0000)
commit87c1e42be7dadaea7c3e00fb7ccbd77633cea37f
treedda7859621dda1b18b14d7f0e10339a9c9c4288e
parenta58d67af29d38fa37c94f59af37db9df75f349be
Fix PPC optimizeCompareInstr swapped-sub argument handling

When matching a compare with a subtract where the arguments of the compare are
swapped w.r.t. the arguments of the subtract, we need to negate the predicates
(or CR bit indices) of the users. This, however, is not the same as inverting
the predicate (negating LT -> GT, but inverting LT -> GE, for example). The ARM
backend seems to do this correctly, but when I adapted the code for the PPC
backend, I introduced an error in this logic.

Comparison optimization is now enabled again by default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179899 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCInstrInfo.cpp
test/CodeGen/PowerPC/optcmp.ll