1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

fix the CodeGen/ARM/2007-03-13-InstrSched.ll regression: allow IV's with scales

to be folded into non-store instructions.

llvm-svn: 35601
This commit is contained in:
Chris Lattner 2007-04-02 18:51:18 +00:00
parent d0366b0024
commit 726d461daf

View File

@ -1332,6 +1332,15 @@ bool ARMTargetLowering::isLegalAddressingMode(const AddrMode &AM,
// r + r // r + r
if (((unsigned)AM.HasBaseReg + AM.Scale) <= 2) if (((unsigned)AM.HasBaseReg + AM.Scale) <= 2)
return true; return true;
case MVT::isVoid:
// Note, we allow "void" uses (basically, uses that aren't loads or
// stores), because arm allows folding a scale into many arithmetic
// operations. This should be made more precise and revisited later.
// Allow r << imm, but the imm has to be a multiple of two.
if (AM.Scale & 1) return false;
return isPowerOf2_32(AM.Scale);
} }
break; break;
} }
@ -1413,12 +1422,19 @@ bool ARMTargetLowering::isLegalAddressScale(int64_t S, const Type *Ty) const {
case MVT::i1: case MVT::i1:
case MVT::i8: case MVT::i8:
case MVT::i32: case MVT::i32:
// r + r // Allow: r + r
if (S == 2) // Allow: r << imm
return true; // Allow: r + r << imm
// r + r << imm
S &= ~1; S &= ~1;
return isPowerOf2_32(S); return isPowerOf2_32(S);
case MVT::isVoid:
// Note, we allow "void" uses (basically, uses that aren't loads or
// stores), because arm allows folding a scale into many arithmetic
// operations. This should be made more precise and revisited later.
// Allow r << imm, but the imm has to be a multiple of two.
if (S & 1) return false;
return isPowerOf2_32(S);
} }
} }