summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCFastISel.cpp
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>2013-08-30 03:16:48 +0000
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>2013-08-30 03:16:48 +0000
commite206efd39bcc00600d816b67b041820b35d023fe (patch)
tree1a9760c3ef9d5e8038be3b46d48cb13b9a5d1d0e /lib/Target/PowerPC/PPCFastISel.cpp
parent40433e5df94f05ba93df7e96f7eb3f861915152a (diff)
downloadllvm-e206efd39bcc00600d816b67b041820b35d023fe.tar.gz
llvm-e206efd39bcc00600d816b67b041820b35d023fe.tar.bz2
llvm-e206efd39bcc00600d816b67b041820b35d023fe.tar.xz
[PowerPC] Handle selection of compare instructions in fast-isel.
Mostly trivial patch adding support for compares. The meat of the work was added with the branch support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189639 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PowerPC/PPCFastISel.cpp')
-rw-r--r--lib/Target/PowerPC/PPCFastISel.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Target/PowerPC/PPCFastISel.cpp b/lib/Target/PowerPC/PPCFastISel.cpp
index 14a4b31710..aeda78bf6b 100644
--- a/lib/Target/PowerPC/PPCFastISel.cpp
+++ b/lib/Target/PowerPC/PPCFastISel.cpp
@@ -108,6 +108,7 @@ class PPCFastISel : public FastISel {
bool SelectStore(const Instruction *I);
bool SelectBranch(const Instruction *I);
bool SelectIndirectBr(const Instruction *I);
+ bool SelectCmp(const Instruction *I);
bool SelectBinaryIntOp(const Instruction *I, unsigned ISDOpcode);
bool SelectRet(const Instruction *I);
bool SelectIntExt(const Instruction *I);
@@ -1065,6 +1066,23 @@ bool PPCFastISel::SelectIndirectBr(const Instruction *I) {
return true;
}
+// Attempt to fast-select a compare instruction.
+bool PPCFastISel::SelectCmp(const Instruction *I) {
+ const CmpInst *CI = cast<CmpInst>(I);
+ Optional<PPC::Predicate> OptPPCPred = getComparePred(CI->getPredicate());
+ if (!OptPPCPred)
+ return false;
+
+ unsigned CondReg = createResultReg(&PPC::CRRCRegClass);
+
+ if (!PPCEmitCmp(CI->getOperand(0), CI->getOperand(1), CI->isUnsigned(),
+ CondReg))
+ return false;
+
+ UpdateValueMap(I, CondReg);
+ return true;
+}
+
// Attempt to fast-select an integer extend instruction.
bool PPCFastISel::SelectIntExt(const Instruction *I) {
Type *DestTy = I->getType();