@@ -661,20 +661,19 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
661
661
default :
662
662
// This is mostly going to be Neon/vector support.
663
663
return false ;
664
- // Using thumb1 instructions for now, use the appropriate RC.
665
664
case MVT::i16 :
666
- Opc = isThumb ? ARM::tLDRH : ARM::LDRH;
667
- RC = isThumb ? ARM::tGPRRegisterClass : ARM::GPRRegisterClass;
665
+ Opc = isThumb ? ARM::t2LDRHi8 : ARM::LDRH;
666
+ RC = ARM::GPRRegisterClass;
668
667
VT = MVT::i32 ;
669
668
break ;
670
669
case MVT::i8 :
671
- Opc = isThumb ? ARM::tLDRB : ARM::LDRB;
672
- RC = isThumb ? ARM::tGPRRegisterClass : ARM::GPRRegisterClass;
670
+ Opc = isThumb ? ARM::t2LDRBi8 : ARM::LDRB;
671
+ RC = ARM::GPRRegisterClass;
673
672
VT = MVT::i32 ;
674
673
break ;
675
674
case MVT::i32 :
676
- Opc = isThumb ? ARM::tLDR : ARM::LDR;
677
- RC = isThumb ? ARM::tGPRRegisterClass : ARM::GPRRegisterClass;
675
+ Opc = isThumb ? ARM::t2LDRi8 : ARM::LDR;
676
+ RC = ARM::GPRRegisterClass;
678
677
break ;
679
678
case MVT::f32 :
680
679
Opc = ARM::VLDRS;
@@ -690,18 +689,16 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
690
689
691
690
ResultReg = createResultReg (RC);
692
691
693
- // TODO: Fix the Addressing modes so that these can share some code.
694
- // Since this is a Thumb1 load this will work in Thumb1 or 2 mode.
695
- // The thumb addressing mode has operands swapped from the arm addressing
696
- // mode, the floating point one only has two operands.
697
- if (isFloat)
692
+ // For now with the additions above the offset should be zero - thus we
693
+ // can always fit into an i8.
694
+ assert (Offset == 0 && " Offset not zero!" );
695
+
696
+ // The thumb and floating point instructions both take 2 operands, ARM takes
697
+ // another register.
698
+ if (isFloat || isThumb)
698
699
AddOptionalDefs (BuildMI (*FuncInfo.MBB , FuncInfo.InsertPt , DL,
699
700
TII.get (Opc), ResultReg)
700
701
.addReg (Reg).addImm (Offset));
701
- else if (isThumb)
702
- AddOptionalDefs (BuildMI (*FuncInfo.MBB , FuncInfo.InsertPt , DL,
703
- TII.get (Opc), ResultReg)
704
- .addReg (Reg).addImm (Offset).addReg (0 ));
705
702
else
706
703
AddOptionalDefs (BuildMI (*FuncInfo.MBB , FuncInfo.InsertPt , DL,
707
704
TII.get (Opc), ResultReg)
0 commit comments