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 | 343310a71517ec764f5dc86d93f55ffdcee56498 (patch) | |
tree | fe1f21978e8acb5a251f3cd89b2c295018e204fd /llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | |
parent | 28e76caea100b81f69f1672ccc02aa1a680a6c14 (diff) | |
download | bcm5719-llvm-343310a71517ec764f5dc86d93f55ffdcee56498.tar.gz bcm5719-llvm-343310a71517ec764f5dc86d93f55ffdcee56498.zip |
Add support for fast isel of zext.
llvm-svn: 55396
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index b0369b32e0a..99ffc3f7817 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/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()); |