[llvm-commits] [llvm] r55381 - /llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
Owen Anderson
resistor at mac.com
Tue Aug 26 13:37:00 PDT 2008
Author: resistor
Date: Tue Aug 26 15:37:00 2008
New Revision: 55381
URL: http://llvm.org/viewvc/llvm-project?rev=55381&view=rev
Log:
Add support for fast isel of sitofp, and remove some unnecessary and imprecise legality checks.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=55381&r1=55380&r2=55381&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Tue Aug 26 15:37:00 2008
@@ -293,10 +293,6 @@
!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 @@
// 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;
More information about the llvm-commits
mailing list