Implement optimizeCompareInstr for PPC
authorHal Finkel <hfinkel@anl.gov>
Thu, 18 Apr 2013 22:15:08 +0000 (22:15 +0000)
committerHal Finkel <hfinkel@anl.gov>
Thu, 18 Apr 2013 22:15:08 +0000 (22:15 +0000)
commit860c08cad5b7c1359123bb2b0e74df4b6e48a15c
treea83b097b231bcf4ab36f0456adefa42b8f5de8fe
parenta88a016f2d99488f2eff0eb6be256f2f43602afa
Implement optimizeCompareInstr for PPC

Many PPC instructions have a so-called 'record form' which stores to a specific
condition register the result of comparing the result of the instruction with
zero (always as a signed comparison). For integer operations on PPC64, this is
always a 64-bit comparison.

This implementation is derived from the implementation in the ARM backend;
there are some differences because PPC condition registers are allocatable
virtual registers (although the record forms always use a specific one), and we
look for a matching subtraction instruction after the compare (but before the
first use) in addition to before it.

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