From: Eric Christopher Date: Thu, 9 Sep 2010 00:26:48 +0000 (+0000) Subject: Handle float->double extension. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=4620360842bd8cddc5b1bad7f2f04214c91ac9cb;p=oota-llvm.git Handle float->double extension. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113455 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp index ca42079eb80..5c6dd566a2b 100644 --- a/lib/Target/ARM/ARMFastISel.cpp +++ b/lib/Target/ARM/ARMFastISel.cpp @@ -114,6 +114,7 @@ class ARMFastISel : public FastISel { virtual bool ARMSelectStore(const Instruction *I); virtual bool ARMSelectBranch(const Instruction *I); virtual bool ARMSelectCmp(const Instruction *I); + virtual bool ARMSelectFPExt(const Instruction *I); // Utility routines. private: @@ -719,6 +720,26 @@ bool ARMFastISel::ARMSelectCmp(const Instruction *I) { return true; } +bool ARMFastISel::ARMSelectFPExt(const Instruction *I) { + // Make sure we have VFP and that we're extending float to double. + if (!Subtarget->hasVFP2()) return false; + + Value *V = I->getOperand(0); + if (!I->getType()->isDoubleTy() || + !V->getType()->isFloatTy()) return false; + + unsigned Op = getRegForValue(V); + if (Op == 0) return false; + + unsigned Result = createResultReg(ARM::DPRRegisterClass); + + AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, + TII.get(ARM::VCVTDS), Result) + .addReg(Op)); + UpdateValueMap(I, Result); + return true; +} + // TODO: SoftFP support. bool ARMFastISel::TargetSelectInstruction(const Instruction *I) { // No Thumb-1 for now. @@ -734,6 +755,8 @@ bool ARMFastISel::TargetSelectInstruction(const Instruction *I) { case Instruction::ICmp: case Instruction::FCmp: return ARMSelectCmp(I); + case Instruction::FPExt: + return ARMSelectFPExt(I); default: break; } return false;