summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2011-11-10 01:30:39 +0000
committerChad Rosier <mcrosier@apple.com>2011-11-10 01:30:39 +0000
commit6cba97c5557ac51d8ae09b9f5cbad6891124db4d (patch)
treec5807d2a9b1da82cfd2004ec037bbe167fd7e181 /lib
parent83337302595a6b85523be8522c2b6105c8e159d1 (diff)
downloadllvm-6cba97c5557ac51d8ae09b9f5cbad6891124db4d.tar.gz
llvm-6cba97c5557ac51d8ae09b9f5cbad6891124db4d.tar.bz2
llvm-6cba97c5557ac51d8ae09b9f5cbad6891124db4d.tar.xz
For immediate encodings of icmp, zero or sign extend first. Then
determine if the value is negative and flip the sign accordingly. rdar://10422026 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144258 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM/ARMFastISel.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp
index 44c88aa7fd..4c47ff9cdf 100644
--- a/lib/Target/ARM/ARMFastISel.cpp
+++ b/lib/Target/ARM/ARMFastISel.cpp
@@ -1216,7 +1216,6 @@ bool ARMFastISel::ARMEmitCmp(const Value *Src1Value, const Value *Src2Value,
// Check to see if the 2nd operand is a constant that we can encode directly
// in the compare.
- uint64_t Imm;
int EncodedImm = 0;
bool EncodeImm = false;
bool isNegativeImm = false;
@@ -1224,10 +1223,11 @@ bool ARMFastISel::ARMEmitCmp(const Value *Src1Value, const Value *Src2Value,
if (SrcVT == MVT::i32 || SrcVT == MVT::i16 || SrcVT == MVT::i8 ||
SrcVT == MVT::i1) {
const APInt &CIVal = ConstInt->getValue();
-
- isNegativeImm = CIVal.isNegative();
- Imm = (isNegativeImm) ? (-CIVal).getZExtValue() : CIVal.getZExtValue();
- EncodedImm = (int)Imm;
+ EncodedImm = (isZExt) ? (int)CIVal.getZExtValue() : (int)CIVal.getSExtValue();
+ if (EncodedImm < 0) {
+ isNegativeImm = true;
+ EncodedImm = -EncodedImm;
+ }
EncodeImm = isThumb2 ? (ARM_AM::getT2SOImmVal(EncodedImm) != -1) :
(ARM_AM::getSOImmVal(EncodedImm) != -1);
}