diff options
author | Eric Christopher <echristo@apple.com> | 2010-09-09 00:26:48 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2010-09-09 00:26:48 +0000 |
commit | f14b9bf98d68c6b5a2dcdc50af48e9d1f4f85636 (patch) | |
tree | ff8e6a02e3696edf4ec2adfa0562afa8a77e4e44 /llvm/lib/Target/ARM/ARMFastISel.cpp | |
parent | cfddabf5a308ad414e69d439ec230f6bfc07351d (diff) | |
download | bcm5719-llvm-f14b9bf98d68c6b5a2dcdc50af48e9d1f4f85636.tar.gz bcm5719-llvm-f14b9bf98d68c6b5a2dcdc50af48e9d1f4f85636.zip |
Handle float->double extension.
llvm-svn: 113455
Diffstat (limited to 'llvm/lib/Target/ARM/ARMFastISel.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMFastISel.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMFastISel.cpp b/llvm/lib/Target/ARM/ARMFastISel.cpp index ca42079eb80..5c6dd566a2b 100644 --- a/llvm/lib/Target/ARM/ARMFastISel.cpp +++ b/llvm/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; |