[llvm-commits] [llvm] r113455 - /llvm/trunk/lib/Target/ARM/ARMFastISel.cpp

Eric Christopher echristo at apple.com
Wed Sep 8 17:26:49 PDT 2010


Author: echristo
Date: Wed Sep  8 19:26:48 2010
New Revision: 113455

URL: http://llvm.org/viewvc/llvm-project?rev=113455&view=rev
Log:
Handle float->double extension.

Modified:
    llvm/trunk/lib/Target/ARM/ARMFastISel.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=113455&r1=113454&r2=113455&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Wed Sep  8 19:26:48 2010
@@ -114,6 +114,7 @@
     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 @@
   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 @@
     case Instruction::ICmp:
     case Instruction::FCmp:
         return ARMSelectCmp(I);
+    case Instruction::FPExt:
+        return ARMSelectFPExt(I);
     default: break;
   }
   return false;





More information about the llvm-commits mailing list