Correctly handle the Thumb-2 imm8 addrmode. Specialize frame index elimination more exactly for Thumb-2 to get better code gen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76919 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/ARMISelDAGToDAG.cpp b/lib/Target/ARM/ARMISelDAGToDAG.cpp
index 1e329ce..cdb27c2 100644
--- a/lib/Target/ARM/ARMISelDAGToDAG.cpp
+++ b/lib/Target/ARM/ARMISelDAGToDAG.cpp
@@ -628,7 +628,7 @@
       if (N.getOpcode() == ISD::SUB)
         RHSC = -RHSC;
 
-      if ((RHSC >= -255) && (RHSC <= 255)) { // sign + 8 bits.
+      if ((RHSC >= -255) && (RHSC <= 0)) { // 8 bits (always negative)
         Base   = N.getOperand(0);
         OffImm = CurDAG->getTargetConstant(RHSC, MVT::i32);
         return true;