When merging Thumb2 loads/stores, do not give up when the offset is one of

the special values that for ARM would be used with IB or DA modes.  Fall
through and consider materializing a new base address is it would be
profitable.

llvm-svn: 112329
This commit is contained in:
Bob Wilson 2010-08-27 23:57:52 +00:00
parent 269457515a
commit ca5af12920
1 changed files with 7 additions and 10 deletions

View File

@ -193,20 +193,17 @@ ARMLoadStoreOpt::MergeOps(MachineBasicBlock &MBB,
return false;
ARM_AM::AMSubMode Mode = ARM_AM::ia;
// VFP and Thumb2 do not support IB or DA modes.
bool isNotVFP = isi32Load(Opcode) || isi32Store(Opcode);
if (isNotVFP && Offset == 4) {
if (isThumb2)
// Thumb2 does not support ldmib / stmib.
return false;
bool haveIBAndDA = isNotVFP && !isThumb2;
if (Offset == 4 && haveIBAndDA)
Mode = ARM_AM::ib;
} else if (isNotVFP && Offset == -4 * (int)NumRegs + 4) {
if (isThumb2)
// Thumb2 does not support ldmda / stmda.
return false;
else if (Offset == -4 * (int)NumRegs + 4 && haveIBAndDA)
Mode = ARM_AM::da;
} else if (isNotVFP && Offset == -4 * (int)NumRegs) {
else if (Offset == -4 * (int)NumRegs && isNotVFP)
// VLDM/VSTM do not support DB mode without also updating the base reg.
Mode = ARM_AM::db;
} else if (Offset != 0) {
else if (Offset != 0) {
// If starting offset isn't zero, insert a MI to materialize a new base.
// But only do so if it is cost effective, i.e. merging more than two
// loads / stores.