summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2010-09-15 17:12:08 +0000
committerBob Wilson <bob.wilson@apple.com>2010-09-15 17:12:08 +0000
commit660d7ecf325401d596895531daaf28c4669eb22d (patch)
tree4119533dcd8d048df82178af7c40269f672a0c92 /llvm/lib
parentbce48fb06fc98c661b24dd3979f5d916425d8db6 (diff)
downloadbcm5719-llvm-660d7ecf325401d596895531daaf28c4669eb22d.tar.gz
bcm5719-llvm-660d7ecf325401d596895531daaf28c4669eb22d.zip
Reapply Gabor's 113839, 113840, and 113876 with a fix for a problem
encountered while building llvm-gcc for arm. This is probably the same issue that the ppc buildbot hit. llvm::prior works on a MachineBasicBlock::iterator, not a plain MachineInstr. llvm-svn: 113983
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 864c5f9dbbd..4c97b82414c 100644
--- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -1352,6 +1352,21 @@ AnalyzeCompare(const MachineInstr *MI, unsigned &SrcReg, int &CmpValue) const {
SrcReg = MI->getOperand(0).getReg();
CmpValue = MI->getOperand(1).getImm();
return true;
+ case ARM::TSTri: {
+ MachineBasicBlock::const_iterator MII(MI);
+ if (MI->getParent()->begin() == MII)
+ return false;
+ const MachineInstr *AND = llvm::prior(MII);
+ if (AND->getOpcode() != ARM::ANDri)
+ return false;
+ if (MI->getOperand(0).getReg() == AND->getOperand(1).getReg() &&
+ MI->getOperand(1).getImm() == AND->getOperand(2).getImm()) {
+ SrcReg = AND->getOperand(0).getReg();
+ CmpValue = 0;
+ return true;
+ }
+ }
+ break;
}
return false;
@@ -1401,6 +1416,8 @@ OptimizeCompareInstr(MachineInstr *CmpInstr, unsigned SrcReg, int CmpValue,
switch (MI->getOpcode()) {
default: break;
case ARM::ADDri:
+ case ARM::ANDri:
+ case ARM::t2ANDri:
case ARM::SUBri:
case ARM::t2ADDri:
case ARM::t2SUBri:
OpenPOWER on IntegriCloud