Add addrmode5 fp load support. Swap float/thumb operand adding to handle
authorEric Christopher <echristo@apple.com>
Sat, 18 Sep 2010 01:59:37 +0000 (01:59 +0000)
committerEric Christopher <echristo@apple.com>
Sat, 18 Sep 2010 01:59:37 +0000 (01:59 +0000)
thumb with floating point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114256 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMFastISel.cpp

index 45279cc93760fc7aa02ce54359d884b75946e5d5..5701542d8bc3a0e173988a460420509785f85846 100644 (file)
@@ -555,6 +555,7 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
 
   assert(VT.isSimple() && "Non-simple types are invalid here!");
   unsigned Opc;
+  bool isFloat = false;
   switch (VT.getSimpleVT().SimpleTy) {
     default:
       assert(false && "Trying to emit for an unhandled type!");
@@ -570,13 +571,27 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
     case MVT::i32:
       Opc = isThumb ? ARM::tLDR : ARM::LDR;
       break;
+    case MVT::f32:
+      Opc = ARM::VLDRS;
+      isFloat = true;
+      break;
+    case MVT::f64:
+      Opc = ARM::VLDRD;
+      isFloat = true;
+      break;
   }
 
   ResultReg = createResultReg(TLI.getRegClassFor(VT));
 
   // TODO: Fix the Addressing modes so that these can share some code.
   // Since this is a Thumb1 load this will work in Thumb1 or 2 mode.
-  if (isThumb)
+  // The thumb addressing mode has operands swapped from the arm addressing
+  // mode, the floating point one only has two operands.
+  if (isFloat)
+    AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
+                            TII.get(Opc), ResultReg)
+                    .addReg(Reg).addImm(Offset));
+  else if (isThumb)
     AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
                             TII.get(Opc), ResultReg)
                     .addReg(Reg).addImm(Offset).addReg(0));
@@ -657,14 +672,15 @@ bool ARMFastISel::ARMEmitStore(EVT VT, unsigned SrcReg,
 
   // The thumb addressing mode has operands swapped from the arm addressing
   // mode, the floating point one only has two operands.
-  if (isThumb)
+  if (isFloat)
     AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
                             TII.get(StrOpc), SrcReg)
-                    .addReg(DstReg).addImm(Offset).addReg(0));
-  else if (isFloat)
+                    .addReg(DstReg).addImm(Offset));
+  else if (isThumb)
     AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
                             TII.get(StrOpc), SrcReg)
-                    .addReg(DstReg).addImm(Offset));
+                    .addReg(DstReg).addImm(Offset).addReg(0));
+
   else
     AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
                             TII.get(StrOpc), SrcReg)