summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-08-26 20:37:00 +0000
committerOwen Anderson <resistor@mac.com>2008-08-26 20:37:00 +0000
commit3c4dc434eee3f30e19e0d0cf5c7747e458904137 (patch)
treef4e3b8cd8c9ed8f9776d9b81e46d7f4035ed8728 /llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
parentcf7154b2d6f3e2f73c8519dc4e299a563be2ddec (diff)
downloadbcm5719-llvm-3c4dc434eee3f30e19e0d0cf5c7747e458904137.tar.gz
bcm5719-llvm-3c4dc434eee3f30e19e0d0cf5c7747e458904137.zip
Add support for fast isel of sitofp, and remove some unnecessary and imprecise legality checks.
llvm-svn: 55381
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index cc30e321147..81889283532 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -293,10 +293,6 @@ FastISel::SelectInstructions(BasicBlock::iterator Begin,
!TLI.isTypeLegal(SrcVT) || !TLI.isTypeLegal(DstVT))
// Unhandled type. Halt "fast" selection and bail.
return I;
- if (TLI.getOperationAction(ISD::FP_TO_SINT, SrcVT) !=
- TargetLowering::Legal)
- // Unhandled opcode on this type. Halt "fast" seleciton and bail.
- return I;
unsigned InputReg = ValueMap[I->getOperand(0)];
if (!InputReg)
@@ -317,6 +313,34 @@ FastISel::SelectInstructions(BasicBlock::iterator Begin,
// or attempt constant folding.
return I;
+ case Instruction::SIToFP:
+ 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 operan. Halt "fast" selection and bail.
+ return I;
+
+ unsigned ResultReg = FastEmit_r(SrcVT.getSimpleVT(),
+ DstVT.getSimpleVT(),
+ ISD::SINT_TO_FP,
+ InputReg);
+ if (!ResultReg)
+ return I;
+
+ ValueMap[I] = ResultReg;
+ break;
+ } else
+ // TODO: Materialize constant and convert to FP.
+ return I;
default:
// Unhandled instruction. Halt "fast" selection and bail.
return I;
OpenPOWER on IntegriCloud