Skip to content

Commit 15bc243

Browse files
committed
Move to thumb2 loads, fixes a problem with incoming registers
as thumb1. Fixes lencod. llvm-svn: 116027
1 parent 134f415 commit 15bc243

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

llvm/lib/Target/ARM/ARMFastISel.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -661,20 +661,19 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
661661
default:
662662
// This is mostly going to be Neon/vector support.
663663
return false;
664-
// Using thumb1 instructions for now, use the appropriate RC.
665664
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;
668667
VT = MVT::i32;
669668
break;
670669
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;
673672
VT = MVT::i32;
674673
break;
675674
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;
678677
break;
679678
case MVT::f32:
680679
Opc = ARM::VLDRS;
@@ -690,18 +689,16 @@ bool ARMFastISel::ARMEmitLoad(EVT VT, unsigned &ResultReg,
690689

691690
ResultReg = createResultReg(RC);
692691

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)
698699
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
699700
TII.get(Opc), ResultReg)
700701
.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));
705702
else
706703
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL,
707704
TII.get(Opc), ResultReg)

0 commit comments

Comments
 (0)