diff options
author | Owen Anderson <resistor@mac.com> | 2008-08-26 23:14:49 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-08-26 23:14:49 +0000 |
commit | 7c3dd1f2cead8b5e37024f352716b1e7df6d231e (patch) | |
tree | 32b47fd3a45cabb43b5a4afdf34252e906052ea5 | |
parent | 46bf54702f3d06e26fcc6520ad347540696f263d (diff) | |
download | external_llvm-7c3dd1f2cead8b5e37024f352716b1e7df6d231e.zip external_llvm-7c3dd1f2cead8b5e37024f352716b1e7df6d231e.tar.gz external_llvm-7c3dd1f2cead8b5e37024f352716b1e7df6d231e.tar.bz2 |
Add support for fast isel of zext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55396 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/FastISel.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index b0369b3..99ffc3f 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -330,6 +330,35 @@ FastISel::SelectInstructions(BasicBlock::iterator Begin, // or attempt constant folding. return I; + case Instruction::ZExt: + if (!isa<ConstantInt>(I->getOperand(0))) { + MVT SrcVT = MVT::getMVT(I->getOperand(0)->getType()); + MVT DstVT = MVT::getMVT(I->getType()); + + if (SrcVT == MVT::Other || !SrcVT.isSimple() || + DstVT == MVT::Other || !DstVT.isSimple() || + !TLI.isTypeLegal(SrcVT) || !TLI.isTypeLegal(DstVT)) + // Unhandled type. Halt "fast" selection and bail. + return I; + + unsigned InputReg = ValueMap[I->getOperand(0)]; + if (!InputReg) + // Unhandled operand. Halt "fast" selection and bail. + return I; + + unsigned ResultReg = FastEmit_r(SrcVT.getSimpleVT(), + DstVT.getSimpleVT(), + ISD::ZERO_EXTEND, + InputReg); + if (!ResultReg) + return I; + + ValueMap[I] = ResultReg; + break; + } else + // TODO: Support constant operands + return I; + case Instruction::SIToFP: if (!isa<ConstantInt>(I->getOperand(0))) { MVT SrcVT = MVT::getMVT(I->getOperand(0)->getType()); |