diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-03-15 22:54:20 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-03-15 22:54:20 +0000 |
commit | 0ac754f6f43a0e5a56f712aebb663581ae512e4c (patch) | |
tree | 00c8bf0a5bd9c35ac268a61659e2c57c0ab232e6 /lib | |
parent | 90d9e022850240e3b5a8f943ea8e7b85987673b3 (diff) |
[fast-isel] Address Eli's comments for r152847. Specifically, add a test case
and still allow immediate encoding, just not with cmn.
rdar://11038907
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/ARMFastISel.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp index 4651a3ac92..6f33556760 100644 --- a/lib/Target/ARM/ARMFastISel.cpp +++ b/lib/Target/ARM/ARMFastISel.cpp @@ -1384,16 +1384,15 @@ bool ARMFastISel::ARMEmitCmp(const Value *Src1Value, const Value *Src2Value, SrcVT == MVT::i1) { const APInt &CIVal = ConstInt->getValue(); Imm = (isZExt) ? (int)CIVal.getZExtValue() : (int)CIVal.getSExtValue(); - // We can't encode LONG_MIN (i.e., 0x80000000) as an immediate because - // there is no way to represent 2147483648 as a signed 32-bit int. - if (Imm != (int)0x80000000) { - if (Imm < 0) { - isNegativeImm = true; - Imm = -Imm; - } - UseImm = isThumb2 ? (ARM_AM::getT2SOImmVal(Imm) != -1) : - (ARM_AM::getSOImmVal(Imm) != -1); + // For INT_MIN/LONG_MIN (i.e., 0x80000000) we need to use a cmp, rather + // then a cmn, because there is no way to represent 2147483648 as a + // signed 32-bit int. + if (Imm < 0 && Imm != (int)0x80000000) { + isNegativeImm = true; + Imm = -Imm; } + UseImm = isThumb2 ? (ARM_AM::getT2SOImmVal(Imm) != -1) : + (ARM_AM::getSOImmVal(Imm) != -1); } } else if (const ConstantFP *ConstFP = dyn_cast<ConstantFP>(Src2Value)) { if (SrcVT == MVT::f32 || SrcVT == MVT::f64) |