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

Eric Christopher echristo at apple.com
Thu Oct 7 18:13:17 PDT 2010


Author: echristo
Date: Thu Oct  7 20:13:17 2010
New Revision: 116027

URL: http://llvm.org/viewvc/llvm-project?rev=116027&view=rev
Log:
Move to thumb2 loads, fixes a problem with incoming registers
as thumb1.

Fixes lencod.

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=116027&r1=116026&r2=116027&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Thu Oct  7 20:13:17 2010
@@ -661,20 +661,19 @@
     default:
       // This is mostly going to be Neon/vector support.
       return false;
-    // Using thumb1 instructions for now, use the appropriate RC.
     case MVT::i16:
-      Opc = isThumb ? ARM::tLDRH : ARM::LDRH;
-      RC = isThumb ? ARM::tGPRRegisterClass : ARM::GPRRegisterClass;
+      Opc = isThumb ? ARM::t2LDRHi8 : ARM::LDRH;
+      RC = ARM::GPRRegisterClass;
       VT = MVT::i32;
       break;
     case MVT::i8:
-      Opc = isThumb ? ARM::tLDRB : ARM::LDRB;
-      RC = isThumb ? ARM::tGPRRegisterClass : ARM::GPRRegisterClass;
+      Opc = isThumb ? ARM::t2LDRBi8 : ARM::LDRB;
+      RC = ARM::GPRRegisterClass;
       VT = MVT::i32;
       break;
     case MVT::i32:
-      Opc = isThumb ? ARM::tLDR : ARM::LDR;
-      RC = isThumb ? ARM::tGPRRegisterClass : ARM::GPRRegisterClass;
+      Opc = isThumb ? ARM::t2LDRi8 : ARM::LDR;
+      RC = ARM::GPRRegisterClass;
       break;
     case MVT::f32:
       Opc = ARM::VLDRS;
@@ -690,18 +689,16 @@
 
   ResultReg = createResultReg(RC);
 
-  // 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.
-  // The thumb addressing mode has operands swapped from the arm addressing
-  // mode, the floating point one only has two operands.
-  if (isFloat)
+  // For now with the additions above the offset should be zero - thus we
+  // can always fit into an i8.
+  assert(Offset == 0 && "Offset not zero!");
+  
+  // The thumb and floating point instructions both take 2 operands, ARM takes
+  // another register.
+  if (isFloat || isThumb)
     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));
   else
     AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
                             TII.get(Opc), ResultReg)





More information about the llvm-commits mailing list